diff options
Diffstat (limited to 'src/gui/tasks/table/widget.py')
-rw-r--r-- | src/gui/tasks/table/widget.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/tasks/table/widget.py b/src/gui/tasks/table/widget.py index 14806fa..aacae2f 100644 --- a/src/gui/tasks/table/widget.py +++ b/src/gui/tasks/table/widget.py @@ -192,10 +192,18 @@ class Widget(QtWidgets.QTableWidget): def delete_rows(self, rows: List[int]): task_ids = [task.id for i, task in enumerate(self._tasks) if i in rows] service.tasks.delete(database.cursor(), task_ids) - self._tasks = [t for t in self._tasks if t.id not in task_ids] - self._task_tags = [tt for tt in self._task_tags if tt.task_id in [t.id for t in self._tasks]] + self.remove_rows_from_table(rows, task_ids) + + def update_status(self, rows: List[int], status: Status): + task_ids = [task.id for i, task in enumerate(self._tasks) if i in rows] + service.tasks.update_status(database.cursor(), task_ids, status) + self.remove_rows_from_table(rows, task_ids) + + def remove_rows_from_table(self, rows: List[int], task_ids: List[int]): for row in sorted(rows, reverse=True): self.removeRow(row) + self._tasks = [t for t in self._tasks if t.id not in task_ids] + self._task_tags = [tt for tt in self._task_tags if tt.task_id in [t.id for t in self._tasks]] self.setRowCount(len(self._tasks)) def get_selected_rows(self): |