-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcost.kv
385 lines (366 loc) · 10.6 KB
/
cost.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
#:import printAll cost.printAll
#:import load cPickle.load
#:import dump cPickle.dump
#:import SlideTransition kivy.uix.screenmanager.SlideTransition
#:import SwapTransition kivy.uix.screenmanager.SwapTransition
#:import WipeTransition kivy.uix.screenmanager.WipeTransition
#:import FadeTransition kivy.uix.screenmanager.FadeTransition
#:import Clock kivy.clock.Clock
#:import date datetime.date
#:import App kivy.app.App
#:import DateIn myWids.DateIn
#:import sumTime cost.sumTime
#:import breakdown cost.breakdown
#:import partial functools.partial
<MainScreen>:
lo: _lo
viewbtn: _viewbtn
BoxLayout:
id: _lo
orientation: 'vertical'
spacing: "30dp"
padding: "10dp"
Label:
text: "Cost (v 1.2.1)"
font_size: "30dp"
Button:
text: 'View'
id: _viewbtn
on_press:
root.manager.get_screen('view').reload()
root.manager.get_screen('view').log.goto('_bottom:')
root.manager.transition=SlideTransition(direction="left")
root.manager.current='view'
Button:
text: 'Add'
on_press:
root.manager.transition=SlideTransition(direction="right")
root.manager.current='qadd'
Button:
text: 'Analyze'
on_release:
root.manager.transition=SlideTransition(direction="down")
root.manager.current='anlz'
Button:
text: 'Need Help?'
on_release:
root.manager.transition=SlideTransition(direction="up")
root.manager.current='help'
<ViewScreen>:
log: cost_log
check: cb
BoxLayout:
orientation: 'vertical'
RstDocument:
id: cost_log
BoxLayout:
orientation: 'horizontal'
size_hint: 1,.1
Button:
text: 'Back'
size_hint: .5,1
on_press:
root.manager.transition=SlideTransition(direction="right")
root.manager.current='main'
Label:
text: 'Show Categories'
size_hint: .7,1
CheckBox:
id: cb
size_hint: .1,1
<AddScreen>:
name_box: name_in
price_box: price_in
date_box: date_in
cat_box: cat_in
save: save_btn
BoxLayout:
orientation: 'vertical'
GridLayout:
spacing: "50dp"
padding: "20dp"
cols: 2
Label:
text: 'Name'
size_hint_x: 0.5
CostTextInput:
id: name_in
next: price_in
Label:
text: 'Price'
size_hint_x: .5
CostTextInput:
multiline: False
id: price_in
next: date_in
Label:
text: 'Date'
size_hint_x: .5
CostTextInput:
multiline: False
text: date.today().strftime('%B %d %Y')
id: date_in
next: cat_in
Label:
text: 'Category'
size_hint_x: .5
CostTextInput:
multiline: False
id: cat_in
next: save_btn
Button:
text: 'Return to main (without saving)'
size_hint: 1,.1
on_press:
root.manager.transition=SlideTransition(direction='left')
root.manager.current='main'
Label:
size_hint: 1, 0.1
Button:
id: save_btn
text: 'Save and Return'
size_hint: 1,.1
on_press:
success=root.print_data()
root.manager.transition=SlideTransition(direction='left')
root.manager.current=('main' if success else 'add')
<AnlzScreen>:
BoxLayout:
spacing: "30dp"
padding: "10dp"
orientation: 'vertical'
Label:
text: 'Analyze'
font_size: '30dp'
Button:
text: 'Totals'
on_release:
root.manager.get_screen('tot').reset()
root.manager.transition=SlideTransition(direction="down")
root.manager.current='tot'
Button:
text: 'Breakdowns'
on_release:
root.manager.transition=SlideTransition(direction="right")
root.manager.current='bkdwn'
Button:
text: 'Back to Main'
on_release:
root.manager.transition=SlideTransition(direction='up')
root.manager.current='main'
Label:
<HelpScreen>:
BoxLayout:
spacing: "30dp"
padding: "10dp"
orientation: "vertical"
Label:
text: 'Help'
font_size: "30dp"
Button:
text: 'Input Problems?'
on_release:
root.manager.transition=SlideTransition(direction='left')
root.manager.current='in'
Button:
text: 'Made a Mistake?'
on_release:
root.manager.get_screen('rm').reset()
root.manager.transition=SlideTransition(direction='up')
root.manager.current='rm'
Button:
text: 'Clear Record'
on_release: root.clearRecord()
Button:
text: 'Back to Main'
on_release:
root.manager.transition=SlideTransition(direction="down")
root.manager.current='main'
<RMScreen>:
l: left
r: right
date_bx: date_in
log: the_log
lab: _lab
day_btn: rm_day_btn
ent_btn: rm_ent_btn
cancel: _cancel
BoxLayout:
BoxLayout:
id: left
orientation: "vertical"
Label:
id: _blank_one
Label:
id: _lab
halign: 'center'
size_hint: 1,.2
text: "What day?"
DateIn:
id: date_in
size_hint: 1, None
height: "40dp"
text: date.today().strftime('%B %d %Y')
Label:
id: _blank_two
BoxLayout:
cols: 2
size_hint_y: None
height: "80dp"
orientation: "vertical"
Button:
id: rm_day_btn
text: 'Remove entire Day'
Button:
id: rm_ent_btn
text: 'Remove individual entry'
BoxLayout:
id: right
orientation: "vertical"
RstDocument:
id: the_log
Button:
id: _cancel
text: 'Cancel'
size_hint_y: None
height: "40dp"
on_release:
root.toHelp(self)
<InputScreen>:
doc: r_doc
RstDocument:
id: r_doc
GridLayout:
size_hint: 1,.1
cols: 2
Button:
text: 'Return to Main'
on_release:
root.toHelp()
Clock.schedule_once(root.toMain, .5)
Button:
text: 'Return to Help'
on_release: root.toHelp()
<BkdwnScreen>:
rst: _rst
wk_btn: _wk_btn
mo_btn: _mo_btn
at_btn: _at_btn
BoxLayout:
orientation: 'vertical'
Label:
text: 'Breakdown of costs'
font_size: '30dp'
size_hint_y: .5
Label:
valign: 'top'
font_size: '15dp'
id: _rst
GridLayout:
size_hint_y: .25
cols: 3
Button:
id: _wk_btn
text: 'Weekly'
Button:
id: _mo_btn
text: 'Monthly'
Button:
id: _at_btn
text: 'All time'
BoxLayout:
size_hint: 1, .25
orientation: 'horizontal'
Button:
size_hint_y: .25
text: 'Back'
on_release:
root.manager.transition=SlideTransition(direction="left")
root.manager.current='anlz'
<TotScreen>:
title: _title
tots: _tots
top_title: _top_title
tops: _tops
grd: _grd
wk_btn: _wk_btn
mo_btn: _mo_btn
at_btn: _at_btn
BoxLayout:
orientation: 'vertical'
Label:
id: _title
text: 'Total Expenditures'
halign: 'center'
bold: True
font_size: '30dp'
size_hint_y: .5
Label:
id: _tots
halign: 'center'
Label:
id: _top_title
halign: 'center'
valign: 'bottom'
text: 'Top Items (All Time)'
size_hint: 1,.1
font_size: '20dp'
bold: True
Label:
id: _tops
halign: 'center'
valign: 'top'
GridLayout:
size_hint: 1,.3
id: _grd
cols: 3
Button:
id: _wk_btn
text: 'Week'
on_release: root.displayWKTops()
Button:
id: _mo_btn
text: 'Month'
on_release: root.displayMOTops()
Button:
id: _at_btn
text: 'All time'
on_release: root.displayATTops()
Button:
text: 'Analyze totals for item'
on_release: root.itemSum()
size_hint_y: .3
<QuickAddScreen>:
qab: _qab
sub_btn: _sub_btn
det_btn: _det_btn
back_btn: _back_btn
BoxLayout:
spacing: "30dp"
padding: "50dp"
orientation: 'vertical'
Label:
text: 'Add'
font_size: "30dp"
Label:
text: 'Quick Add'
QuickAddBox:
id: _qab
text: 'Type the name of a previous entry..'
multiline: False
Button:
id: _sub_btn
text: 'Submit'
on_release: root.qab.addQuick(root.qab.text)
Button:
id: _det_btn
text: 'Give details'
on_release:
root.manager.transition=SlideTransition(direction="right")
root.manager.current='add'
Button:
id: _back_btn
text: 'Back'
on_release:
root.manager.transition=SlideTransition(direction="left")
root.manager.current='main'