-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmpg.kv
109 lines (102 loc) · 3.25 KB
/
mpg.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
<MPGWidget>:
# RelativeLayout
on_selected_axis: root.selected_index= ord(args[1]) - ord('X') if args[1] != 'Fo' else -1
on_selected_index: root.index_changed(args[1])
BoxLayout:
orientation: 'horizontal'
pos_hint: {'top': 1.0}
size_hint_y: None
height: 56
padding: 8
spacing: 8
ToggleButton:
text: 'X'
group: 'axis'
state: 'down'
size_hint_y: None
height: 40
on_state: if self.state == 'down': root.selected_axis= self.text
ToggleButton:
text: 'Y'
group: 'axis'
size_hint_y: None
height: 40
on_state: if self.state == 'down': root.selected_axis= self.text
ToggleButton:
text: 'Z'
group: 'axis'
size_hint_y: None
height: 40
on_state: if self.state == 'down': root.selected_axis= self.text
ToggleButton:
id: Fo
text: 'Fo'
group: 'axis'
size_hint_y: None
height: 40
on_state: if self.state == 'down': root.selected_axis= self.text
GridLayout:
cols: 2
CheckBox:
id: x01
group: 'cb1'
Label:
text: '0.01'
size_hint_x: None
width: self.texture_size[0]
CheckBox:
id: x001
group: 'cb1'
Label:
text: '0.001'
size_hint_x: None
width: self.texture_size[0]
Label:
pos_hint: {'top': 0.92}
id: pos_lab
text: '{:+09.3f}'.format(root.last_pos) if root.selected_index >= 0 else '{:9.0f}'.format(root.last_pos)
font_size: '70sp'
font_name: "data/fonts/RobotoMono-Regular.ttf"
size_hint_y: None
height: self.texture_size[1]
Knob:
pos_hint: {'center_x': 0.5, 'y': -0.03}
size: 300, 300
min: 0
max: 100
step: 1
value: 0 # Default position of knob.
knobimg_source: "img/knob_metal.png" # Knob texture
show_label: False # Show central label
show_marker: False # Do not show surrounding marker
on_tick: root.handle_change(self.ticks)
#on_release: root.handle_action()
Button:
pos_hint: {'right': 0.99, 'y': 0.01}
disabled: mpg_mode_tb.state == 'down'
text: 'Run'
size_hint: None, None
size: dp(80), dp(40)
on_press: root.handle_action()
Button:
pos_hint: {'right': 0.99, 'y': 0.6}
text: 'Zero'
size_hint: None, None
size: dp(80), dp(40)
on_press: root.last_pos= 0
disabled: Fo.state == 'down'
ToggleButton:
id: mpg_mode_tb
pos_hint: {'x': 0.01, 'y': 0.01}
text: 'MPG Mode'
size_hint: None, None
size: dp(80), dp(40)
disabled: Fo.state == 'down'
ToggleButton:
id: abs_mode_tb
disabled: mpg_mode_tb.state == 'down' or Fo.state == 'down'
pos_hint: {'x': 0.01, 'y': 0.6}
text: 'ABS' if self.state == 'down' else 'REL'
size_hint: None, None
size: dp(80), dp(40)
on_state: root.abs_mode_changed()