-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice_controller.kv
More file actions
150 lines (134 loc) · 5.06 KB
/
device_controller.kv
File metadata and controls
150 lines (134 loc) · 5.06 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#:import RGBDrawer drawers.RGBDrawer
#:import WaveDrawer drawers.WaveDrawer
#:import PaletteDrawer drawers.PaletteDrawer
# #:import AnimationsList animations_list.AnimationsList
<DeviceController>:
id: device_controller_
power_button: power_button_
dimmer: dimmer_
dimmer_container: dimmer_container_
red_slider: rgb_drawer_.red_slider
green_slider: rgb_drawer_.green_slider
blue_slider: rgb_drawer_.blue_slider
presets: rgb_drawer_.presets
off_screen: off_screen_
_no_ripple_effect: True
divider: None
size_hint: (1, None)
height: card_.height
MDCard:
id: card_
orientation: 'vertical'
size_hint_x: 0.9
adaptive_height: True
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
padding: dp(10), dp(10), dp(10), dp(10)
md_bg_color: app.theme_cls.primary_color
MDRelativeLayout:
# Add card_bottom first so the shadow effect works. Use RelativeLayout to position
# the sections correctly.
id: levels_
size_hint: (1, None)
height: card_bottom_.height
MDCard:
id: card_bottom_
orientation: 'vertical'
pos_hint: {'top': 1}
adaptive_height: True
padding: dp(0), dp(0), dp(0), dp(10)
spacing: dp(6)
md_bg_color: app.theme_cls.primary_light
MDBoxLayout:
id: card_top_spacer_
size_hint: (1, None)
height: dp(50)
MDBoxLayout:
id: dimmer_container_
orientation: 'vertical'
padding: (dp(20), dp(0))
adaptive_height: True
CtrlSlider:
id: dimmer_
on_value: root.send_brightness(self)
CtrlSeparator:
RGBDrawer:
id: rgb_drawer_
device_controller: root
CtrlSeparator:
WaveDrawer:
id: wave_drawer_
device_controller: root
CtrlSeparator:
PaletteDrawer:
id: palette_drawer_
device_controller: root
MDCard:
id: card_top_
orientation: 'horizontal'
pos_hint: {'top': 1}
size_hint: (1, None)
height: dp(50)
md_bg_color: app.theme_cls.primary_dark
MDRelativeLayout:
id: _status_container
size_hint: (0.1, 1)
MDIconButton:
id: status_icon_
icon: 'bluetooth-audio'
theme_icon_color: 'Custom'
icon_color: 'green'
on_release: root.disconnect_BluetoothSocket() if root.is_connected else root.reconnect_BluetoothSocket()
MDRelativeLayout:
id: label_container_
size_hint: (0.65, 1)
MDLabel:
id: label_
padding: dp(20), dp(0)
text: root.device.nickname if root.device.nickname else root.device.getName()
text_size: self.size
valign: 'middle'
MDBoxLayout:
size_hint: (0.25, 1)
MDSwitch:
id: power_button_
pos_hint: {'right': 1, 'center_y': 0.5}
widget_style: 'ios'
width: dp(45)
on_active: root.power()
MDFloatLayout:
# MDSwitch widget_style: 'ios' and material design 'M3' versions' right
# side extends outside of the widget's boundary. Including this layout
# as padding to make it look right.
size_hint: (0.1, 1)
FavoritesBar:
id: favorites_bar_
device_controller: root
MDRelativeLayout:
MDIconButton:
id: menu_button_
icon: 'dots-vertical'
icon_size: dp(20)
pos_hint: {'bottom': 0, 'right': 1}
ripple_alpha: 0.5
on_release: root.open_options_menu(self)
MDRelativeLayout:
id: card_overlay_
size_hint: (0.9, 1)
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
# radius: dp(15), dp(15), dp(15), dp(15)
# md_bg_color: app.theme_cls.primary_color
md_bg_color: 'gray'
opacity: 0
MDRelativeLayout:
id: off_screen_
x: root.right + dp(100)
md_bg_color: (1, 0, 0, 0.5)
<RenameDeviceTextField>:
size_hint: (None, None)
mode: 'rectangle'
helper_text: 'Rename your device'
helper_text_mode: 'persistent'
helper_text_color_normal: 'white'
helper_text_color_focus: 'white'
text_color_normal: 'white'
text_color_focus: 'white'