From 7571a949cbde58e2295345eca5e3293bb2681c28 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Sun, 3 Dec 2023 15:13:19 -0500 Subject: [PATCH] Move files to prepare for setup tools and add ability to delete tasks --- src/{ => pykanban}/board.py | 3 +++ src/{ => pykanban}/layout.tcss | 3 ++- src/{ => pykanban}/tui.py | 10 ++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) rename src/{ => pykanban}/board.py (98%) rename src/{ => pykanban}/layout.tcss (96%) rename src/{ => pykanban}/tui.py (97%) diff --git a/src/board.py b/src/pykanban/board.py similarity index 98% rename from src/board.py rename to src/pykanban/board.py index 43b3771..6607f93 100644 --- a/src/board.py +++ b/src/pykanban/board.py @@ -120,3 +120,6 @@ class Board: """Add a task to icol""" self.tasks[icol].append(task) + def del_task(self, icol, itask): + del self.tasks[icol][itask] + diff --git a/src/layout.tcss b/src/pykanban/layout.tcss similarity index 96% rename from src/layout.tcss rename to src/pykanban/layout.tcss index 35f5cd2..8346e01 100644 --- a/src/layout.tcss +++ b/src/pykanban/layout.tcss @@ -37,12 +37,13 @@ EditColScreen { content-align: center top; color: #ebdbb9; text-style: underline; + padding: 1; } .header-focused { content-align: center top; color: #458588; text-style: underline; - + padding: 1; } ListItem{ diff --git a/src/tui.py b/src/pykanban/tui.py similarity index 97% rename from src/tui.py rename to src/pykanban/tui.py index d91c896..f0b9bf8 100644 --- a/src/tui.py +++ b/src/pykanban/tui.py @@ -130,13 +130,14 @@ class EditColScreen(Screen): class KanbanForm(App): CSS_PATH = 'layout.tcss' BINDINGS = [ - Binding("l", "fnext", "Focus Next", show=False, ), Binding("a", "new_task", "Add New Task", show=False, ), + Binding("l", "fnext", "Focus Next", show=False, ), Binding("h", "fprev", "Focus Prev", show=False, ), Binding("L", "move_up", "Focus Next", show=False), Binding("H", "move_down", "Focus Prev", show=False), Binding("e", "edit_task", "Edit Task", show=False,), Binding("r", "edit_column", "Edit Column Name", show=False,), + Binding("d", "delete_task", "Delete Task", show=False,), Binding('q', 'exit', "Exit") ] @@ -229,6 +230,11 @@ class KanbanForm(App): text = self.board.get_columns()[icol] self.push_screen(EditColScreen(text), self.update_col) + def action_delete_task(self): + icol, itask = self.get_col_task() + self.focused.highlighted_child.remove() + self.board.del_task(icol,itask) + def update_col(self, text): """ Update the column """ @@ -283,7 +289,7 @@ class KanbanForm(App): icol,_ = self.get_col_task() self.focused.mount(ListItem(Label(task.summary))) self.board.add_task(icol, task) - self.focused.highlighted_child + self.focused.action_cursor_down() # def on_key(self): # with open('log','a') as f: