forked from ryandoherty/RaceCapture_App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiconbutton.py
50 lines (42 loc) · 1.78 KB
/
iconbutton.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import kivy
kivy.require('1.9.0')
from kivy.uix.button import Button
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.app import Builder
from kivy.graphics import Color
from kivy.metrics import sp, dp
from kivy.properties import NumericProperty, ListProperty, StringProperty, ObjectProperty
from fieldlabel import FieldLabel
from math import sin, cos, pi
from autosportlabs.racecapture.theme.color import ColorScheme
Builder.load_file('iconbutton.kv')
class IconButton(Button):
def __init__(self, **kwargs):
super(IconButton, self).__init__(**kwargs)
class RoundedRect(BoxLayout):
rect_color = ObjectProperty((0.5, 0.5, 0.5, 0.8))
line_width = NumericProperty(dp(10))
radius = NumericProperty(10)
class TileIconButton(ButtonBehavior, AnchorLayout):
title_font = StringProperty('')
title_font_size = NumericProperty(20)
tile_color = ObjectProperty((0.5, 0.5, 0.5, 0.8))
icon_color = ObjectProperty((1.0, 1.0, 1.0, 0.8))
title_color = ObjectProperty((1.0, 1.0, 1.0, 0.8))
icon = StringProperty('')
title = StringProperty('')
def __init__(self, **kwargs):
super(TileIconButton, self).__init__(**kwargs)
class LabelIconButton(ButtonBehavior, AnchorLayout):
title_font = StringProperty('resource/fonts/ASL_regular.ttf')
title_font_size = NumericProperty(sp(20))
tile_color = ObjectProperty(ColorScheme.get_accent())
icon_color = ObjectProperty((0.0, 0.0, 0.0, 1.0))
title_color = ObjectProperty((0.0, 0.0, 0.0, 1.9))
icon = StringProperty('')
icon_size = NumericProperty(sp(25))
title = StringProperty('')
def __init__(self, **kwargs):
super(LabelIconButton, self).__init__(**kwargs)