1
- from typing import Optional , Callable
1
+ from typing import Callable , Optional
2
2
3
3
import webbrowser
4
+ from dataclasses import dataclass
5
+
4
6
from flet import (
5
- PopupMenuButton ,
6
- PopupMenuItem ,
7
7
Column ,
8
8
Container ,
9
+ ElevatedButton ,
10
+ Icon ,
9
11
IconButton ,
10
12
NavigationRail ,
11
13
NavigationRailDestination ,
14
+ PopupMenuButton ,
15
+ PopupMenuItem ,
16
+ ResponsiveRow ,
12
17
Row ,
13
18
Text ,
14
19
UserControl ,
15
20
alignment ,
16
- icons ,
17
- margin ,
18
- padding ,
19
- ResponsiveRow ,
20
- Icon ,
21
21
border ,
22
22
icons ,
23
- Container ,
24
- Text ,
23
+ margin ,
25
24
padding ,
26
- Row ,
27
- icons ,
28
- alignment ,
29
- ElevatedButton ,
30
25
)
31
26
32
-
33
- from core .views import get_body_txt , get_headline_with_subtitle
27
+ from clients .view import ClientsListView
28
+ from contacts .view import ContactEditorPopUp , ContactsListView
29
+ from contracts .view import ContractsListView
34
30
from core .abstractions import DialogHandler , TuttleView , TuttleViewParams
35
31
from core .utils import (
32
+ ALWAYS_SCROLL ,
33
+ CENTER_ALIGNMENT ,
36
34
COMPACT_RAIL_WIDTH ,
37
35
SPACE_BETWEEN_ALIGNMENT ,
38
36
START_ALIGNMENT ,
39
- TXT_ALIGN_START ,
40
- ALWAYS_SCROLL ,
41
37
STRETCH_ALIGNMENT ,
38
+ TXT_ALIGN_START ,
39
+ )
40
+ from core .views import (
41
+ get_app_logo ,
42
+ get_body_txt ,
43
+ get_headline_with_subtitle ,
44
+ get_std_txt_field ,
45
+ )
46
+ from invoicing .view import InvoicingView
47
+ from projects .view import ProjectsListView
48
+ from res .colors import (
49
+ BLACK_COLOR ,
50
+ GRAY_COLOR ,
51
+ GRAY_DARK_COLOR ,
52
+ PRIMARY_COLOR ,
53
+ WHITE_COLOR ,
42
54
)
43
- from res .colors import GRAY_DARK_COLOR , GRAY_COLOR , BLACK_COLOR
44
55
from res .dimens import (
45
- MIN_WINDOW_WIDTH ,
56
+ FOOTER_HEIGHT ,
46
57
MIN_WINDOW_HEIGHT ,
58
+ MIN_WINDOW_WIDTH ,
59
+ SPACE_LG ,
47
60
SPACE_MD ,
48
61
SPACE_SM ,
49
62
SPACE_STD ,
50
63
SPACE_XL ,
51
64
SPACE_XS ,
52
- SPACE_LG ,
53
- FOOTER_HEIGHT ,
65
+ TOOLBAR_HEIGHT ,
54
66
)
55
67
from res .fonts import (
68
+ BODY_2_SIZE ,
56
69
HEADLINE_4_SIZE ,
57
70
HEADLINE_FONT ,
58
- BODY_2_SIZE ,
59
- SUBTITLE_2_SIZE ,
60
71
SUBTITLE_1_SIZE ,
72
+ SUBTITLE_2_SIZE ,
61
73
)
62
-
63
74
from res .res_utils import (
64
75
ADD_CLIENT_INTENT ,
65
76
ADD_CONTACT_INTENT ,
77
+ CONTRACT_CREATOR_SCREEN_ROUTE ,
78
+ NEW_TIME_TRACK_INTENT ,
66
79
PREFERENCES_SCREEN_ROUTE ,
67
80
PROFILE_SCREEN_ROUTE ,
68
- )
69
- from contacts .view import ContactEditorPopUp
70
-
71
- from flet import (
72
- Container ,
73
- Text ,
74
- padding ,
75
- IconButton ,
76
- Row ,
77
- icons ,
78
- alignment ,
79
- ElevatedButton ,
80
- )
81
-
82
- from core .utils import SPACE_BETWEEN_ALIGNMENT , CENTER_ALIGNMENT
83
- from core .views import get_app_logo , get_std_txt_field
84
- from res .colors import BLACK_COLOR , WHITE_COLOR , PRIMARY_COLOR
85
- from res .dimens import SPACE_MD , TOOLBAR_HEIGHT
86
-
87
- from res .fonts import HEADLINE_4_SIZE , HEADLINE_FONT
88
- from dataclasses import dataclass
89
-
90
-
91
- from res .res_utils import (
92
81
PROJECT_CREATOR_SCREEN_ROUTE ,
93
- ADD_CLIENT_INTENT ,
94
- ADD_CONTACT_INTENT ,
95
- CONTRACT_CREATOR_SCREEN_ROUTE ,
96
- NEW_TIME_TRACK_INTENT ,
97
82
)
98
- from core .abstractions import TuttleView
99
- from typing import Optional
100
- from clients .view import ClientsListView
101
- from contacts .view import ContactsListView
102
- from contracts .view import ContractsListView
103
- from projects .view import ProjectsListView
104
83
from timetracking .view import TimeTrackingView
105
- from invoicing .view import InvoicingView
106
84
107
85
MIN_SIDE_BAR_WIDTH = int (MIN_WINDOW_WIDTH * 0.3 )
108
86
MIN_FOOTER_WIDTH = int (MIN_WINDOW_WIDTH * 0.7 )
@@ -251,46 +229,46 @@ def __init__(self, params: TuttleViewParams):
251
229
self .contracts_view = ContractsListView (params )
252
230
self .items = [
253
231
MenuItem (
254
- 0 ,
232
+ index = 0 ,
255
233
label = "Dashboard" ,
256
234
icon = icons .SPEED ,
257
235
selected_icon = icons .SPEED_ROUNDED ,
258
236
destination = Container (),
259
237
on_new_screen_route = "/404" ,
260
238
),
261
239
MenuItem (
262
- 1 ,
263
- "Projects" ,
264
- icons .WORK_OUTLINE ,
265
- icons .WORK_ROUNDED ,
266
- self .projects_view ,
240
+ index = 1 ,
241
+ label = "Projects" ,
242
+ icon = icons .WORK_OUTLINE ,
243
+ selected_icon = icons .WORK_ROUNDED ,
244
+ destination = self .projects_view ,
267
245
on_new_screen_route = PROJECT_CREATOR_SCREEN_ROUTE ,
268
246
on_new_intent = None ,
269
247
),
270
248
MenuItem (
271
- 2 ,
272
- "Contacts" ,
273
- icons .CONTACT_MAIL_OUTLINED ,
274
- icons .CONTACT_MAIL_ROUNDED ,
275
- self .contacts_view ,
249
+ index = 2 ,
250
+ label = "Contacts" ,
251
+ icon = icons .CONTACT_MAIL_OUTLINED ,
252
+ selected_icon = icons .CONTACT_MAIL_ROUNDED ,
253
+ destination = self .contacts_view ,
276
254
on_new_screen_route = None ,
277
255
on_new_intent = ADD_CONTACT_INTENT ,
278
256
),
279
257
MenuItem (
280
- 3 ,
281
- "Clients" ,
282
- icons .CONTACTS_OUTLINED ,
283
- icons .CONTACTS_ROUNDED ,
284
- self .clients_view ,
258
+ index = 3 ,
259
+ label = "Clients" ,
260
+ icon = icons .CONTACTS_OUTLINED ,
261
+ selected_icon = icons .CONTACTS_ROUNDED ,
262
+ destination = self .clients_view ,
285
263
on_new_screen_route = None ,
286
264
on_new_intent = ADD_CLIENT_INTENT ,
287
265
),
288
266
MenuItem (
289
- 4 ,
290
- "Contracts" ,
291
- icons .HANDSHAKE_OUTLINED ,
292
- icons .HANDSHAKE_ROUNDED ,
293
- self .contracts_view ,
267
+ index = 4 ,
268
+ label = "Contracts" ,
269
+ icon = icons .HANDSHAKE_OUTLINED ,
270
+ selected_icon = icons .HANDSHAKE_ROUNDED ,
271
+ destination = self .contracts_view ,
294
272
on_new_screen_route = CONTRACT_CREATOR_SCREEN_ROUTE ,
295
273
on_new_intent = None ,
296
274
),
@@ -309,29 +287,29 @@ def __init__(self, params: TuttleViewParams):
309
287
310
288
self .items = [
311
289
MenuItem (
312
- 0 ,
313
- "Time Tracking" ,
314
- icons .TIMER_OUTLINED ,
315
- icons .TIMER_ROUNDED ,
316
- self .timetrack_view ,
290
+ index = 0 ,
291
+ label = "Time Tracking" ,
292
+ icon = icons .TIMER_OUTLINED ,
293
+ selected_icon = icons .TIMER_ROUNDED ,
294
+ destination = self .timetrack_view ,
317
295
on_new_screen_route = None ,
318
296
on_new_intent = NEW_TIME_TRACK_INTENT ,
319
297
),
320
298
MenuItem (
321
- 0 ,
322
- "Invoicing" ,
323
- icons .ATTACH_MONEY_SHARP ,
324
- icons .ATTACH_MONEY_ROUNDED ,
325
- Container () ,
326
- "/404" ,
299
+ index = 1 ,
300
+ label = "Invoicing" ,
301
+ icon = icons .ATTACH_MONEY_SHARP ,
302
+ selected_icon = icons .ATTACH_MONEY_ROUNDED ,
303
+ destination = self . invoicing_view ,
304
+ on_new_screen_route = "/404" ,
327
305
),
328
306
MenuItem (
329
- 0 ,
330
- "Datatable" ,
331
- icons .TABLE_CHART ,
332
- icons .TABLE_CHART_ROUNDED ,
333
- Container (),
334
- "/404" ,
307
+ index = 2 ,
308
+ label = "Datatable" ,
309
+ icon = icons .TABLE_CHART ,
310
+ selected_icon = icons .TABLE_CHART_ROUNDED ,
311
+ destination = Container (),
312
+ on_new_screen_route = "/404" ,
335
313
),
336
314
]
337
315
0 commit comments