Move a task up or down within its header (no UI calls here).
(header: str, index: int, direction: int)
| 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).""" |
| 379 | if header not in system_data: |
| 380 | return |
| 381 | tasks = system_data[header] |
| 382 | new_index = index + direction |
| 383 | if new_index < 0 or new_index >= len(tasks): |
| 384 | return |
| 385 | try: |
| 386 | tasks[index], tasks[new_index] = tasks[new_index], tasks[index] |
| 387 | save_data(data) |
| 388 | except Exception as ex: |
| 389 | print("move_task error:", ex) |
| 390 | |
| 391 | def open_task_actions(header: str, index: int): |
| 392 | """Long-press menu: Move up / Move down / Edit / Delete.""" |
no test coverage detected