Skip to content

Commit 60af2bf

Browse files
committed
demo dialogs
1 parent 4ddaeae commit 60af2bf

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

app/Tuttle.py

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,32 @@ def add_demo_data(self, event):
102102
def build(self):
103103
self.main_column = Column(
104104
[
105-
ElevatedButton(
106-
"Install demo data",
107-
icon=icons.TOYS,
108-
on_click=self.add_demo_data,
105+
Text("Demo", style="titleMedium"),
106+
Row(
107+
[
108+
views.make_card(
109+
[
110+
Text(
111+
dedent(
112+
"""
113+
Welcome to the Tuttle demo.
114+
115+
1. Getting started: Press the button below to install some demo data and start exploring some of the functions of the app:
116+
"""
117+
)
118+
)
119+
]
120+
)
121+
]
122+
),
123+
Row(
124+
[
125+
ElevatedButton(
126+
"Install demo data",
127+
icon=icons.TOYS,
128+
on_click=self.add_demo_data,
129+
),
130+
]
109131
),
110132
],
111133
)
@@ -232,12 +254,16 @@ def on_click_generate_invoices(self, event):
232254
timetracking_method="file_calendar",
233255
calendar_file_path=self.calendar_file_path,
234256
)
257+
self.app.snackbar_message(
258+
f"created invoice and timesheet for {self.project_select.value} - open the invoice folder to see the result"
259+
)
235260

236261
def on_pick_calendar_file(self, event: FilePickerResultEvent):
237262
"""Handle the result of the calendar file picker."""
238263
if event.files:
239264
logger.info(f"Calendar file picked: {event.files[0].path}")
240265
self.calendar_file_path = Path(event.files[0].path)
266+
self.app.snackbar_message(f"Calendar file picked: {event.files[0].path}")
241267
else:
242268
logger.info("Cancelled!")
243269

@@ -247,6 +273,15 @@ def on_click_open_invoice_folder(self, event):
247273
# os.system(f"open {invoice_dir}")
248274
webbrowser.open(f"file:///{invoice_dir}")
249275

276+
def on_click_load_demo_calendar(self, event):
277+
"""Load the demo calendar file."""
278+
self.calendar_file_path = Path(__file__).parent.parent / Path(
279+
"tuttle_tests/data/TuttleDemo-TimeTracking.ics"
280+
)
281+
self.app.snackbar_message(
282+
f"Loaded demo calendar file: {self.calendar_file_path}"
283+
)
284+
250285
def update_content(self):
251286
super().update_content()
252287

@@ -282,8 +317,8 @@ def update_content(self):
282317
Text(
283318
dedent(
284319
"""
285-
1. select a time tracking data source
286-
"""
320+
1. load the demo timetracking data, or select a time tracking calendar file
321+
"""
287322
)
288323
)
289324
]
@@ -292,6 +327,11 @@ def update_content(self):
292327
),
293328
Row(
294329
[
330+
ElevatedButton(
331+
"Load demo calendar",
332+
icon=icons.DATE_RANGE,
333+
on_click=self.on_click_load_demo_calendar,
334+
),
295335
ElevatedButton(
296336
"Pick Calendar File",
297337
icon=icons.UPLOAD_FILE,

0 commit comments

Comments
 (0)