-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmileage.kv
More file actions
163 lines (138 loc) · 5.2 KB
/
mileage.kv
File metadata and controls
163 lines (138 loc) · 5.2 KB
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
# mileage.kv
<MileageLayout>:
orientation: 'vertical'
padding: 20
spacing: 10
BoxLayout:
orientation: 'vertical'
size_hint_y: None
height: '60dp'
spacing: 10
# Przycisk wybierający miesiąc
Button:
text: "Wybrany miesiąc"
font_size: '20sp'
background_color: (1, 1, 0, 1) # kolor żółty
on_press: root.show_month_selector()
# Wyświetla aktualnie wybrany miesiąc (np. "Maj 2025")
Label:
text: root.selected_month_display
font_size: '16sp'
color: (1, 1, 0, 1) # kolor żółty
# Informacja określająca początek trasy
Label:
text: "Początek trasy"
font_size: '16sp'
size_hint_y: None
height: self.texture_size[1] + 10
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: '30dp'
spacing: 10
# Pole do wpisania przebiegu początkowego
TextInput:
id: start_input
text: root.start
input_filter: 'int'
input_type: 'number'
hint_text: "Przebieg auta przy rozpoczęciu trasy"
hint_text_color: 1, 1, 1, 1 # kolor biały
background_color: (0, 1, 0, 1) if self.focus else (0, 0, 1, 1) # kolor zielony jako aktywny i niebieski jako nieaktywny
disabled: root.start_locked
on_text: root.update_start(self.text)
# Przycisk blokujący/odblokujący pole do wpisania przebiegu początkowego
Button:
id: start_button
text: "Zmień" if root.start_locked else "Zapisz"
width: '50dp'
on_press: root.unlock_start() if root.start_locked else root.lock_start()
# Informacja określająca koniec trasy
Label:
text: "Koniec trasy"
font_size: '16sp'
size_hint_y: None
height: self.texture_size[1] + 10
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: '30dp'
spacing: 10
# Pole do wpisania przebiegu końcowego
TextInput:
id: end_input
text: root.end
input_filter: 'int'
input_type: 'number'
hint_text: "Przebieg auta po zakończeniu trasy"
hint_text_color: 1, 1, 1, 1 # kolor biały
background_color: (1, 0, 0, 1) if self.focus else (0, 0, 1, 1) # kolor czerwony jako aktywny i niebieski jako nieaktywny
disabled: root.end_locked
on_text: root.update_end(self.text)
# Przycisk blokujący/odblokujący pole do wpisania przebiegu końcowego
Button:
id: end_button
text: "Zmień" if root.end_locked else "Zapisz"
width: '50dp'
on_press: root.unlock_end() if root.end_locked else root.lock_end()
# Pole wyświetlające ostrzeżenie w przypadku, gdy wartość końcowa jest mniejsza niż początkowa
Label:
bold: True
text: root.warning_text
color: (1, 0, 0, 1) # ostrzeżenie w kolorze czerwonym
font_size: '14sp'
size_hint_y: None
height: '30dp'
# Informacja określająca ilość delegacji
Label:
text: "Ilość delegacji"
font_size: '16sp'
size_hint_y: None
height: self.texture_size[1] + 10
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: '30dp'
spacing: 10
# Pole do wpisania ilości delegacji
TextInput:
id: deleg_input
text: "" if root.deleg == 0 else str(root.deleg)
input_filter: 'int'
input_type: 'number'
hint_text: "Ilość delegacji"
hint_text_color: 1, 1, 1, 1 # kolor biały
background_color: (1, 0.5, 0, 1) if self.focus else (0, 0, 1, 1) # kolor pomarańczowy jako aktywny i niebieski jako nieaktywny
disabled: root.deleg_locked
on_text: root.update_deleg(self.text)
# Przycisk blokujący/odblokujący pole do wpisania ilości delegacji
Button:
id: deleg_button
text: "Zmień" if root.deleg_locked else "Zapisz"
width: '50dp'
on_press: root.unlock_deleg() if root.deleg_locked else root.lock_deleg()
BoxLayout:
orientation: 'vertical'
padding: '12dp'
spacing: '8dp'
# Pole opisujące przebieg wprowadzanej trasy
Label:
text: "Obecna trasa: " + str(root.total_daily) + " km - Delegacji: " + str(root.deleg)
size_hint_y: None
font_size: '18sp'
# Pole opisujące przebieg sumaryczny dla całego miesiąca
Label:
text: "Razem: " + str(root.total) + " km - Delegacji: " + str(root.d_counter)
size_hint_y: None
font_size: '18sp'
# Przycisk zapisujący dane do bazy oraz zamykający aplikację po pięciu sekundach
Button:
id: confirm_button
size_hint_y: None
text: "Zapisz i wyjdź"
height: '56dp'
on_press: root.save()
# Elastyczny margines, który unosi przycisk
Widget:
size_hint_y: None
height: '50dp'