-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrocerylogger.kv
453 lines (394 loc) · 14.1 KB
/
grocerylogger.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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
#: import ListAdapter kivy.adapters.listadapter.ListAdapter
#: import ListItemButton kivy.uix.listview.ListItemButton
#: import Button kivy.uix.button.Button
#: import main GroceryLoggerApp
#:import Factory kivy.factory.Factory
<MessageBox>:
pos_hint: {'x': .3, 'y': .4}
size_hint: (None, None)
size: (400, 150)
title_align: 'center'
title: 'Are you sure you want to delete this profile?'
BoxLayout:
Button:
text: 'Delete'
on_press:
root.dismiss()
root.obj.delete_buttons()
root.obj.transition.direction = "right"
root.obj.current = "profile_screen"
Button:
text: 'Cancel'
on_release: root.dismiss()
<HeaderButton@Button>:
font_size: 20
size_hint_y: .05
background_color: (1.0, 0.0, 0.0, 1.0)
<MiniButton@Button>:
font_size: 16
size_hint: .1, .1
<StandardButton@Button>:
font_size: 16
#background_normal: 'grey.jpg'
#background_down: ''
size_hint: .2, .1
<OtherItems@Popup>:
id: other_popup
size_hint: .6, .5
auto_dismiss: False
title: "Add Other Item"
title_align: "center"
itemname: itemname
itemtext: itemtext
expdatepop: expdatepop
year: year
day: day
month: month
# on_enter: root.ids.itemtext.focus = True
# on_leave: root.ids.itemname.text = ''
# on_leave: root.ids.expdate.text = ''
FloatLayout
TextInput:
id: itemtext
hint_text: "Enter Other Item Name"
write_tab: False
multiline: False
pos_hint: {"center_x": .5, "top": 1}
size_hint: .9,.15
Button:
id: expdatepop
text: "Enter Expiration Date"
pos_hint: {"center_x": .5, "top": .85}
size_hint: .9,.15
on_press:
root.get_name(itemtext)
on_press:
root.get_date_pop(month, day, year)
Spinner:
id: year
text: "Select Year"
pos_hint: {"center_x": .2, "top": .7}
size_hint: .3,.15
values: ['2018','2019','2020']
Spinner:
id: month
text: "Select Month"
pos_hint: {"center_x": .5, "top": .7}
size_hint: .3,.15
values: ['01','02','03','04','05','06','07','08','09','10','11','12']
Spinner:
id: day
text: "Select Day"
pos_hint: {"center_x": .8, "top": .7}
size_hint: .3,.15
values: ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']
Label:
id: itemname
pos_hint: {"center_x": .5, "top": .95}
text: ""
Label:
id: expdatepop
pos_hint: {"center_x": .5, "top": .8}
text: ""
Button:
text: "Submit"
size_hint: .4,.15
pos_hint: {"center_x": .25, "top": .15}
on_press:
root.submit_other(month,day,year)
Button:
text: "Cancel"
size_hint: .4,.15
pos_hint: {"center_x": .75, "top": .15}
on_press: root.dismiss()
<MyScreenManager>:
box2: box2
grid1: grid_list
itemname: itemname
expdate: expdate
#----------SPLASH SCREEN--------------------------------------------------
Screen:
name: "splash_screen"
BoxLayout:
orientation: "horizontal"
Button:
font_size: 32
background_normal: ''
background_color: 1, .3, .4, .85
text: "Gro - Log\n\nVirtual Pantry Logging System"
halign: 'center'
on_release:
root.current = "profile_screen"
#----------PROFILE SCREEN--------------------------------------------------
Screen:
name: "profile_screen"
on_enter:
root.update_buttons()
HeaderButton:
text: "Profile Select"
pos_hint: {"center_x": .5, "top": 1}
BoxLayout:
id: box2
orientation: "horizontal"
pos_hint: {"center_x": .5, "top": .95}
Button:
text: "Add New Profile"
on_release:
root.current = "create_profile_screen"
#----------PROFILE CREATION SCREEN----------------------------------------
Screen:
name: "create_profile_screen"
on_leave: root.ids.textinput.text = ''
on_enter: root.ids.textinput.focus = True
Popup:
title: 'Profile Creation'
title_align: 'center'
auto_dismiss: False
content: box
pos_hint: {'x': .3, 'y': .4}
size_hint: (None, None)
size: (400, 100)
BoxLayout:
id: box
TextInput:
id: textinput
focus: True
hint_text: 'Enter Profile Name'
write_tab: False
multiline: False
font_size: 20
on_text_validate: root.added_buttons.append(Button(text=root.ids.textinput.text))
on_text_validate: root.current = "profile_screen"
Button:
id: createButton
text: 'Create Profile'
size_hint: (.5, 1)
on_press: root.added_buttons.append(Button(text=root.ids.textinput.text))
on_press: root.current = "profile_screen"
on_press: root.transition.direction = "right"
Button:
id: cancelButton
text: 'Cancel'
size_hint: (.3, 1)
on_press: root.current = "profile_screen"
on_press: root.transition.direction = "right"
#----------MENU SCREEN--------------------------------------------------
Screen:
name: "menu_screen"
HeaderButton:
id: bannerbutton
# font_size: 15
# size_hint_y: .04
text: ""
pos_hint: {"center_x": .5, "top": 1}
HeaderButton:
id: expirationbutton
# font_size: 15
# size_hint_y: .04
text: ""
pos_hint: {"center_x": .5, "bottom": 1}
GridLayout:
cols: 2
size_hint: .7, .2
pos_hint: {"center_x": .5, "top": .6}
spacing: 50
Button:
text: "Add Item"
pos_hint: {"bottom": .5}
on_press:
root.transition.direction = "up"
root.current = "additem_screen"
Button:
text: "View Food Inventory"
on_press:
root.transition.direction = "left"
root.current = "inventory_screen"
GridLayout:
cols: 2
size_hint: .3, .1
spacing: 1
pos_hint: {"center_x": .5,'center_y': .1}
Button:
text: "Switch Profile"
on_press:
root.transition.direction = "right"
root.current = "profile_screen"
Button:
text: "Delete Profile"
on_press:
#root.delete_buttons()
#root.transition.direction = "right"
#root.current = "profile_screen"
Factory.MessageBox(root).open()
#----------INVENTORY SCREEN----------------------------------------
Screen:
name:"inventory_screen"
on_enter:
root.depopulate_inventory()
root.populate_inventory()
FloatLayout:
StandardButton:
text: "Back to Main Menu"
pos_hint: {"top": .95}
on_press:
app.root.transition.direction = "right"
app.root.current = "menu_screen"
HeaderButton:
text: "Your Food Inventory"
pos_hint: {"center_x": .5, "top": 1}
GridLayout:
cols: 3
size_hint_y: .1
pos_hint: {"top": .8}
Button:
text: "Item Name"
Button:
text: "Expiration Date"
Button:
text: "Barcode/UPC Number"
GridLayout:
id: grid_list
cols: 1
padding: [0,0,0,350]
pos_hint: {"top":.7}
# barcode for milk: 078742022871
MiniButton:
text: "Delete"
pos_hint: {"center_x": .35 , "center_y": .1}
on_press:
root.delete_items()
StandardButton:
id: search
text: "Search Recipes"
pos_hint: {"center_x": .5, "center_y": .1}
on_press:
app.root.search_recipes()
# root.current = "recipescreen"
MiniButton:
text: "Add"
pos_hint: {"center_x": .65, "center_y": .1}
on_press:
root.transition.direction = "up"
root.current = "additem_screen"
#----------------------------------SearchRecipeScreen---------------------
Screen:
name: "recipescreen"
on_enter: root.PopText()
FloatLayout
size: root.size
HeaderButton:
id: recipename
pos_hint: {"top":1}
text:"Recipe Name"
Label:
halign: 'center'
valign: 'center'
text_size: self.size
pos_hint: {"center_x": .5}
id: ingredients
text:"Ingredients"
Button:
text: "<--"
size_hint: .2,.15
pos_hint: {"center_x": .25, "top": .95}
on_press: root.LeftPopText()
Button:
text: "Back to Inventory"
size_hint: .2,.15
pos_hint: {"center_x": .5, "top": .95}
on_press: root.current = "inventory_screen"
Button:
text: "-->"
size_hint: .2,.15
pos_hint: {"center_x": .75, "top": .95}
on_press: root.RightPopText()
#----------ADD ITEM SCREEN--------------------------------------------------
Screen:
name:"additem_screen"
on_leave: root.ids.barcode_number.text = ''
on_enter: root.ids.barcode_number.focus = True
on_leave: root.ids.itemname.text = ''
on_leave: root.ids.expdate.text = ''
FloatLayout:
Label:
id: itemname
pos_hint: {"center_x": .5, "top": .9}
text: ""
#for debugging purposes, the below expiration date label is printed to the screen, remove in final build
Label:
id: expdate
pos_hint: {"center_x": .5, "top": .8}
text: ""
HeaderButton:
text: "Add Item"
pos_hint: {"center_x": .5, "top": 1}
Button:
size_hint: .2, .1
font_size: 16
text: "Back to Inventory"
pos_hint: {"top": .95}
on_press:
root.transition.direction = "down"
root.current = "inventory_screen"
TextInput:
id: barcode_number
hint_text: "Scan or Enter Barcode Number"
write_tab: False
multiline: False
pos_hint: {"center_x": .4, "top": .7}
size_hint: .4,.05
Button:
text: "Search"
pos_hint: {"center_x": .7, "top": .7}
size_hint: .2,.05
on_press:
root.search_item(barcode_number)
Button:
text: "Enter Expiration Date"
pos_hint: {"center_x": .5, "top": .65}
size_hint: .6,.05
on_press:
root.get_date(month, day, year)
Spinner:
id: year
text: "Select Year"
pos_hint: {"center_x": .3, "top": .6}
size_hint: .2,.05
values: ['2018','2019','2020']
Spinner:
id: month
text: "Select Month"
pos_hint: {"center_x": .5, "top": .6}
size_hint: .2,.05
values: ['01','02','03','04','05','06','07','08','09','10','11','12']
Spinner:
id: day
text: "Select Day"
pos_hint: {"center_x": .7, "top": .6}
size_hint: .2,.05
values: ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']
Button:
font_size: 16
size_hint: .1, .1
text: "Submit"
pos_hint: {"center_x": .4 , "center_y": .1}
on_press:
root.submit(month,day,year,barcode_number)
# root.ids.barcode_number.text = ""
on_release:
root.ids.barcode_number.focus = True
Button:
font_size: 16
size_hint: .1, .1
text: "Other"
pos_hint: {"center_x": .5, "center_y": .1}
on_press:
root.open_popup()
Button:
font_size: 16
size_hint: .1, .1
text: "Cancel"
pos_hint: {"center_x": .6, "center_y": .1}
on_press:
root.transition.direction = "down"
root.current = "inventory_screen"