-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.kv
336 lines (272 loc) · 8.66 KB
/
app.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# Bits n' Bytes UI Kivy Definitions
# Author: Wilson McDade
###########################
###########################
#
# Define Screens:
#
###########################
ScreenManager:
id: sm
StartScreen:
md_bg_color: self.theme_cls.backgroundColor
name: 'Start'
RelativeLayout:
# Still working on this, lets leave it out for now
ImageButton:
source: 'images/tapIcon.png'
text: 'Tap card to start'
pos_hint: {'center_x': 0.5, 'center_y': 0.15}
# How can we make this bigger?
MDIconButton:
pos_hint: {'center_x': 0.9, 'center_y': 0.9}
icon: 'information-outline'
style: 'filled'
on_press:
root.transition.direction = 'up'
root.current = 'Info'
Image:
source: 'images/logo.png'
size_hint: .45, .45
pos_hint: {'center_x': 0.5, 'center_y': 0.6}
### Remove this once NFC works :tm:
MDButton:
pos_hint: {'center_x': 0.5, 'center_y': 0.2}
style: 'filled'
on_press:
# Change transition direction
root.transition.direction = 'left'
# Set current screen to Cart
root.current = 'Cart'
MDButtonText:
text:'Go to Cart'
MDButton:
pos_hint:{'center_x': 0.2, 'center_y': 0.2}
style: 'filled'
on_press:
root.transition.direction = 'left'
root.current = 'Debug'
MDButtonText:
text: 'Go to Debug'
CartScreen:
name: 'Cart'
BoxLayout:
orientation: 'horizontal'
ScrollView:
RecycleView:
id: cart_view
viewclass: 'CartItem'
RecycleBoxLayout:
default_size: None, dp(150)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(10)
BoxLayout:
size_hint: (0.5, 1)
orientation: 'vertical'
Button:
text: 'Cancel Transaction'
background_normal: ''
background_down: 'images/oof.png'
background_color: 0.9686, 0.4118, 0.0078, 1
on_press: app.cancel_transaction()
BoxLayout:
size_hint: (1, 5)
orientation: 'vertical'
Label:
text: 'Current User Information'
Label:
name: 'name_field'
text: 'Name:'
Label:
name: 'card_field'
text: 'Card:'
Label:
name: 'email_field'
text: 'Email:'
Label:
name: 'phone_field'
text: 'Phone:'
Label:
text: 'Finished? Close the door'
### Do not leave this in
#MDButton:
# pos_hint: {'center_x': 0.5, 'center_y': 0.2}
# style: 'filled'
# on_press:
# root.transition.direction = 'right'
# root.current = 'Start'
#MDButtonText:
# text:'Go to Start'
InfoScreen:
md_bg_color: self.theme_cls.backgroundColor
name: 'Info'
MDButton:
style: 'filled'
on_press:
root.transition.direction = 'down'
root.current = 'Start'
MDButtonText:
text:'Back to Start'
GridLayout:
cols:2
MemberCard:
name: 'Wilson'
job_title: 'Cool Guy'
major: 'CS'
MemberCard:
name: 'Sahil'
job_title: 'Cool Guy'
major: 'CS'
MemberCard:
name: 'Jason'
job_title: 'Cool Guy'
major: 'CS'
MemberCard:
name: 'Isaac'
job_title: 'Cool Guy'
major: 'CS'
CancelScreen:
md_bg_color: self.theme_cls.backgroundColor
name: 'Cancel'
Label:
text: 'Close door to end transaction'
color: 0, 0, 0, 1
font_size: 30
ThankYouScreen:
md_bg_color: self.theme_cls.backgroundColor
name: 'ThankYou'
Label:
text: 'Your transaction is finished. Thank you!'
color: 0, 0, 0, 1
font_size: 30
AttractScreen:
name: 'Attract'
DebugScreen:
md_bg_color: self.theme_cls.backgroundColor
name: 'Debug'
# Go back to start button
MDButton:
pos_hint: {'center_x': 0.6, 'center_y': 0.95}
style: 'filled'
on_press:
root.transition.direction = 'left'
root.current = 'Start'
MDButtonText:
text:'Go to Start'
# Open door button
MDButton:
pos_hint: {'center_x': 0.4, 'center_y': 0.95}
style: 'filled'
on_press: app.open_door()
MDButtonText:
text: 'Open Door'
GridLayout:
cols: 4
rows: 4
#adaptive_height: True
#padding: "2dp"
#pos_hint: {'center_x': 0.5, 'center_y': 0.5}
ShelfItem:
shelf: 1
slot: 1
ShelfItem:
shelf: 2
slot: 1
ShelfItem:
shelf: 3
slot: 1
ShelfItem:
shelf: 4
slot: 1
ShelfItem:
shelf: 1
slot: 2
# weight values of all shelves (4 shelves with 4 slot) see each value of each slot
# calibration button to get weights of individual items
###########################
#
# Define Custom Widgets:
#
###########################
<ImageButton>:
size_hint: (0.611, 0.207)
pos_hint: (0.7, 0.7)
canvas:
Color:
rgb: 0.42, 0.0, 0.39
RoundedRectangle:
size: self.size
pos: self.pos
radius: [(20, 20), (20, 20), (20, 20), (20, 20)]
RelativeLayout:
Image:
size_hint: .6, .6
pos_hint: {'center_x': 2.5, 'center_y': .7}
source: root.source
Label:
text: root.text
text_size: root.size
font_size: '26.365sp'
font_name: 'Roboto'
pos_hint: {'center_x': 5.7, 'center_y': 1.05}
#x: self.parent.x + (self.parent.width / 2) - (self.width / 2)
#y: self.parent.y + (self.parent.height / 2) - (self.height / 3)
<CartItem>
size: "144dp", "170dp"
AsyncImage:
source: root.source
MDLabel:
text: root.title
MDLabel:
text: root.price
MDLabel:
font_style: 'Display'
text: root.quantity
<MemberCard>
orientation: 'vertical'
size_hint: None, None
size: "144dp", "170dp"
MDLabel:
font_style: "Display"
role: "small"
text: root.name
color: "black"
halign: "center"
padding: "2dp", "2dp"
MDLabel:
font_style: "Title"
role: "small"
text: root.job_title
color: "black"
halign: "center"
padding: "4dp", "4dp"
MDLabel:
font_style: "Title"
role: "medium"
text: root.major
color: "black"
halign: "center"
padding: "4dp", "4dp"
<ShelfItem>:
size_hint: None, None
width: "150dp" # Set the width of the shelf item to fit the label text.
height: "120dp"
BoxLayout:
orientation: 'vertical'
padding: dp(2) # Adjust the padding as needed
spacing: dp(5)
MDLabel:
text: root.text
size_hint_y: None
height: self.texture_size[1] # Height just enough for the text.
size_hint_x: 2.5 # Take full width of the parent.
halign: 'center'
valign: 'center'
text_size: self.width, None
MDButton:
on_release: #TODO: implement calibrate function
MDButtonText:
text: "Calibrate"