MCPcopy Index your code
hub / github.com/flet-dev/flet / edit_task

Function edit_task

sdk/python/examples/community/mind_queue/main.py:331–375  ·  view source on GitHub ↗
(header: str, index: int)

Source from the content-addressed store, hash-verified

329 print("delete_task error:", ex)
330
331 def edit_task(header: str, index: int):
332 if header not in system_data:
333 return
334 if index < 0 or index >= len(system_data[header]):
335 return
336
337 try:
338 title_val, label_val, done_val = system_data[header][index]
339 except Exception as ex:
340 print("edit_task load error:", ex)
341 return
342
343 title_field = ft.TextField(label="Title", value=title_val)
344 label_field = ft.TextField(label="Task", value=label_val)
345
346 def on_save(ev):
347 tl = title_field.value.strip()
348 lb = label_field.value.strip()
349 if not tl or not lb:
350 return
351
352 if header not in system_data:
353 return
354 if index < 0 or index >= len(system_data[header]):
355 return
356
357 try:
358 system_data[header][index][0] = tl
359 system_data[header][index][1] = lb
360 save_data(data)
361 close_current_dialog()
362 show_system(system_name)
363 except Exception as ex:
364 print("edit_task save error:", ex)
365
366 dlg = ft.AlertDialog(
367 modal=True,
368 title=ft.Text("Edit task"),
369 content=ft.Column([title_field, label_field], tight=True),
370 actions=[
371 ft.TextButton("Cancel", on_click=close_current_dialog),
372 ft.TextButton("Save", on_click=on_save),
373 ],
374 )
375 open_dialog(dlg)
376
377 def move_task(header: str, index: int, direction: int):
378 """Move a task up or down within its header (no UI calls here)."""

Callers 2

do_editFunction · 0.85
show_systemFunction · 0.85

Calls 1

open_dialogFunction · 0.70

Tested by

no test coverage detected