UI
This commit is contained in:
parent
99cbbfe5f0
commit
48d29b4d0c
@ -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:
|
||||
|
@ -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):
|
||||
with Vertical():
|
||||
yield Label(self.message)
|
||||
yield Label("(y)es")
|
||||
yield Label("(n)o")
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user