From 48d29b4d0cfb970b4051f4600c0c301dba6a9015 Mon Sep 17 00:00:00 2001 From: jpt Date: Wed, 16 Apr 2025 11:12:50 -0500 Subject: [PATCH] UI --- src/tt/tui/editor.py | 6 +++++- src/tt/tui/modals.py | 13 ++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/tt/tui/editor.py b/src/tt/tui/editor.py index f88abc1..96be209 100644 --- a/src/tt/tui/editor.py +++ b/src/tt/tui/editor.py @@ -211,7 +211,11 @@ class TableEditor(App): self.table.move_cursor(row=0, column=1) def action_delete_item(self): - self.push_screen(ConfirmModal(f"delete ?"), self._delete_item_callback) + if self.table.cursor_column == 0: + current_value = self.table.get_cell_at( + (self.table.cursor_row, 1) # assumes col 1 is name + ) + self.push_screen(ConfirmModal(f"delete [green]{current_value}[/]?"), self._delete_item_callback) def _delete_item_callback(self, confirm): if confirm and self.table.cursor_column == 0: diff --git a/src/tt/tui/modals.py b/src/tt/tui/modals.py index f75d199..fe6e278 100644 --- a/src/tt/tui/modals.py +++ b/src/tt/tui/modals.py @@ -16,11 +16,6 @@ class ConfirmModal(ModalScreen): } ConfirmModal Vertical { border: double teal; - height: 10; - width: 30; - } - ConfirmModal Label.hints { - border: solid grey; height: 4; } """ @@ -35,9 +30,9 @@ class ConfirmModal(ModalScreen): super().__init__() def compose(self): - yield Label(self.message) - yield Label("(y)es") - yield Label("(n)o") + with Vertical(): + yield Label(self.message) + yield Label("[b](y)[/]es [b](n)[/]o") def action_confirm(self): self.dismiss(True) @@ -55,7 +50,7 @@ class ChoiceModal(ModalScreen): ChoiceModal Vertical { border: double teal; height: 10; - width: 30; + width: 38; } ChoiceModal Label.hints { border: solid grey;