From 77ac5a5cd22d9406f4b9dcace4bee75dead0eb82 Mon Sep 17 00:00:00 2001 From: jpt Date: Thu, 10 Apr 2025 22:47:36 -0500 Subject: [PATCH] moving forward on toml fields --- src/tt/tui/editor.py | 34 +++++++++++++++------------------- src/tt/tui/recurring.py | 2 +- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/tt/tui/editor.py b/src/tt/tui/editor.py index fe315c8..57b23fc 100644 --- a/src/tt/tui/editor.py +++ b/src/tt/tui/editor.py @@ -245,11 +245,7 @@ class TableEditor(App): continue val = self.filters.get(fc.field, fc.default) if val is not None: - # enums use comma separated filters - if fc.enum: - prepopulated[fc.field] = val.split(",")[0] - else: - prepopulated[fc.field] = val + prepopulated[fc.field] = val new_item = self.add_item_callback(**prepopulated) self.refresh_data(restore_cursor=False) @@ -263,21 +259,21 @@ class TableEditor(App): def _active_item_id(self): return int(self.table.get_cell_at((self.table.cursor_row, 0))) - def action_toggle_cell(self): - cur_row = self.table.cursor_row - cur_col = self.table.cursor_column - cconf = self._active_column_config() + # def action_toggle_cell(self): + # cur_row = self.table.cursor_row + # cur_col = self.table.cursor_column + # cconf = self._active_column_config() - if cconf.enum: - item_id = self._active_item_id() - current_val = self.table.get_cell_at((cur_row, cur_col)) - next_val = advance_enum_val(cconf.enum, current_val) - self.table.update_cell_at((cur_row, cur_col), next_val) - # trigger item_id to be saved on the next cursor move - # this avoids filtered columns disappearing right away - # and tons of DB writes - update = {cconf.field: next_val} - self._register_save_on_move(item_id, **update) + # if cconf.enum: + # item_id = self._active_item_id() + # current_val = self.table.get_cell_at((cur_row, cur_col)) + # next_val = advance_enum_val(cconf.enum, current_val) + # self.table.update_cell_at((cur_row, cur_col), next_val) + # # trigger item_id to be saved on the next cursor move + # # this avoids filtered columns disappearing right away + # # and tons of DB writes + # update = {cconf.field: next_val} + # self._register_save_on_move(item_id, **update) def _register_save_on_move(self, item_id, **kwargs): if self.save_on_move and self.save_on_move["item_id"] != item_id: diff --git a/src/tt/tui/recurring.py b/src/tt/tui/recurring.py index 539764b..8723ef1 100644 --- a/src/tt/tui/recurring.py +++ b/src/tt/tui/recurring.py @@ -26,7 +26,7 @@ class TaskGenEditor(TableEditor): enum=GeneratorType, ), TableColumnConfig("val", "Value", default="1"), - TableColumnConfig("next_at", "Next @", default="", read_only=True), + TableColumnConfig("next_at", "Next @", read_only=True), ) def __init__(self):