-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.kv
150 lines (119 loc) · 4.72 KB
/
main.kv
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 FakeDevice bluetooth_helpers.FakeDevice
#:import SlideTransition kivy.uix.screenmanager.SlideTransition
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import Gradient kivy_gradient.Gradient
#:import PalettesScreen palettes_screen.PalettesScreen
<Overlay@Widget>:
canvas:
Color:
rgba: 1, 0, 0, 0.25
Rectangle:
pos: self.pos
size: self.size
# This works for KivyMD widgets:
md_bg_color: app.theme_cls.primary_light
md_bg_color: (1, 0, 0, 0.25)
md_bg_color: 'palegreen'
# string values must match https://www.w3.org/TR/SVG11/types.html#ColorKeywords
# Note: Padding adds space between the border of a layout and its widgets.
# VariableListProperty defaults to [0, 0, 0, 0].
# [padding_left, padding_top, padding_right, padding_bottom] or
# [padding_horizontal, padding_vertical] or
# [padding]
<ControllersScreen>:
loaded_devices: app.loaded_devices
controllers_list: controllers_list_
md_bg_color: app.theme_cls.bg_light
MDScrollView:
do_scroll_x: False
scroll_distance: dp(300)
# scroll_timeout: 250
MDList:
id: controllers_list_
spacing: dp(20)
<ColorPickerScreen>:
<RootScreen>:
name: 'root'
screen_manager: _screen_manager
MDTopAppBar:
id: top_app_bar_
title: 'LED Remote Control'
anchor_title: 'left'
elevation: 4
shadow_color: app.theme_cls.bg_darkest
pos_hint: {'top': 1}
left_action_items: [['menu', lambda x: root.open_nav_drawer_()]]
MDNavigationLayout:
MDScreenManager:
id: _screen_manager
transition: SlideTransition(direction='right')
ControllersScreen:
name: 'controllers'
size_hint_y: 1 - top_app_bar_.height / root.height
pos_hint_y: {'y': 0}
FindDevicesScreen:
name: 'find_devices'
size_hint_y: 1 - top_app_bar_.height / root.height
DeviceInfoScreen
name: 'device_info'
size_hint_y: 1 - top_app_bar_.height / root.height
ColorPickerScreen:
name: 'color_picker'
size_hint_y: 1 - top_app_bar_.height / root.height
ConfigureLEDsScreen:
name: 'configure_leds'
size_hint_y: 1 - top_app_bar_.height / root.height
PalettesScreen:
name: 'palettes'
size_hint_y: 1 - top_app_bar_.height / root.height
MDNavigationDrawer:
id: nav_drawer_
enable_swiping: False
radius: (0, 16, 16, 0)
MDNavigationDrawerMenu:
MDNavigationDrawerHeader:
title: 'LED Remote Control'
spacing: '4dp'
padding: '12dp', 0, 0, '56dp'
MDNavigationDrawerLabel:
text: 'Menu'.upper()
MDNavigationDrawerDivider:
NavDrawerItem:
icon: 'magnify'
text: 'Find Devices'
on_press:
_screen_manager.current = 'find_devices'
nav_drawer_.set_state('close')
NavDrawerItem:
icon: 'bluetooth'
text: 'Controllers'
on_press:
_screen_manager.current = 'controllers'
nav_drawer_.set_state('close')
NavDrawerItem:
icon: 'trash-can'
text: 'Clear Saved Data'
on_press:
app.clear_saved_data()
nav_drawer_.set_state('close')
NavDrawerItem:
icon: 'folder-information-outline'
text: 'Show Saved Data'
on_press:
app.show_saved_data()
nav_drawer_.set_state('close')
NavDrawerItem:
icon: 'brightness-5'
text: 'Light Mode'
on_press:
app.theme_cls.theme_style = 'Light' if app.theme_cls.theme_style == 'Dark' else 'Dark'
self.icon = 'brightness-3' if self.icon == 'brightness-5' else 'brightness-5'
self.text = 'Dark Mode' if self.text == 'Light Mode' else 'Light Mode'
# nav_drawer_.set_state('close')
<NavDrawerItem@MDNavigationDrawerItem>
# text_color: "#4a4939"
# icon_color: "#4a4939"
selected_color: app.theme_cls.secondary_text_color
text_color: app.theme_cls.secondary_text_color
focus_behavior: False
_no_ripple_effect: True