Skip to content

Commit c371d2d

Browse files
committed
snackbar message on edit buttons
1 parent f7f7efc commit c371d2d

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

app/Tuttle.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def build(self):
112112
"""
113113
Welcome to the Tuttle demo.
114114
115-
1. Getting started: Press the button below to install some demo data and start exploring some of the functions of the app:
115+
1. Getting started: Press the button below to install some demo data and start exploring some of the functions of the app.
116116
"""
117117
)
118118
)
@@ -152,7 +152,7 @@ def update_content(self):
152152

153153
for contact in contacts:
154154
self.main_column.controls.append(
155-
views.make_contact_view(contact),
155+
views.make_contact_view(contact, self),
156156
)
157157
self.update()
158158

@@ -176,7 +176,7 @@ def update_content(self):
176176
for contract in contracts:
177177
self.main_column.controls.append(
178178
# TODO: replace with view class
179-
views.make_contract_view(contract)
179+
views.make_contract_view(contract, self)
180180
)
181181
self.update()
182182

@@ -199,7 +199,7 @@ def update_content(self):
199199

200200
for client in clients:
201201
self.main_column.controls.append(
202-
views.make_client_view(client),
202+
views.make_client_view(client, self),
203203
)
204204
self.update()
205205

app/views.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ def get_address(self):
149149
return ""
150150

151151

152-
def make_contact_view(contact: Contact):
152+
def make_contact_view(
153+
contact: Contact,
154+
app_page,
155+
):
153156
return Card(
154157
content=Container(
155158
content=Column(
@@ -183,7 +186,10 @@ def make_contact_view(contact: Contact):
183186
)
184187

185188

186-
def make_contract_view(contract: Contract):
189+
def make_contract_view(
190+
contract: Contract,
191+
app_page,
192+
):
187193
return Card(
188194
content=Container(
189195
content=Column(
@@ -198,6 +204,9 @@ def make_contract_view(contract: Contract):
198204
PopupMenuItem(
199205
icon=icons.EDIT,
200206
text="Edit",
207+
on_click=lambda _: app_page.app.snackbar_message(
208+
"Sorry, editing data is not yet implemented"
209+
),
201210
),
202211
PopupMenuItem(
203212
icon=icons.DELETE,
@@ -300,6 +309,9 @@ def on_click_delete_project(event):
300309
PopupMenuItem(
301310
icon=icons.EDIT,
302311
text="Edit",
312+
on_click=lambda _: app_page.app.snackbar_message(
313+
"Sorry, editing data is not yet implemented"
314+
),
303315
),
304316
PopupMenuItem(
305317
icon=icons.DELETE,
@@ -325,7 +337,10 @@ def on_click_delete_project(event):
325337
)
326338

327339

328-
def make_client_view(client: Client):
340+
def make_client_view(
341+
client: Client,
342+
app_page,
343+
):
329344
return Card(
330345
content=Container(
331346
content=Column(
@@ -340,6 +355,9 @@ def make_client_view(client: Client):
340355
PopupMenuItem(
341356
icon=icons.EDIT,
342357
text="Edit",
358+
on_click=lambda _: app_page.app.snackbar_message(
359+
"Sorry, editing data is not yet implemented"
360+
),
343361
),
344362
PopupMenuItem(
345363
icon=icons.DELETE,

0 commit comments

Comments
 (0)