diff --git a/src/tt/controller/things.py b/src/tt/controller/things.py index 18526f5..66ec9b7 100644 --- a/src/tt/controller/things.py +++ b/src/tt/controller/things.py @@ -23,12 +23,18 @@ def add_thing( def update_thing( item_id: int, + deleted: bool | None = None, + type: str | None = None, **kwargs, ) -> Thing: with db.atomic(): thing = Thing.get_by_id(item_id) - new_data = thing.data | kwargs - query = Thing.update(data=new_data).where(Thing.id == item_id) + updates = {"data": thing.data | kwargs} + if deleted is not None: + updates["deleted"] = deleted + if type is not None: + updates["type"] = type + query = Thing.update(**updates).where(Thing.id == item_id) query.execute() thing = Thing.get_by_id(item_id) return thing diff --git a/src/tt/tui/editor.py b/src/tt/tui/editor.py index 24a2f86..c41c095 100644 --- a/src/tt/tui/editor.py +++ b/src/tt/tui/editor.py @@ -37,7 +37,7 @@ class TableEditor(App): width: 10; content-align: left middle; } - + #input_widget { width: 100%; margin: 0; @@ -230,6 +230,8 @@ class TableEditor(App): ConfirmModal(f"delete [green]{current_value}[/]?"), self._delete_item_callback, ) + else: + raise Exception("FIXME") def _delete_item_callback(self, confirm): if confirm and self.table.cursor_column == 0: @@ -239,6 +241,8 @@ class TableEditor(App): self.update_item_callback(item_id, deleted=True) self._save_cursor() self.refresh_data() + else: + raise Exception(f"{confirm=} {self.table.cursor_column=}") def action_add_item(self): # the new item should use the selected value if filtered