Move files to prepare for setup tools and add ability to delete tasks

feature/make_board_screen
Alex Selimov 1 year ago
parent 34b5ae35c7
commit 7571a949cb

@ -120,3 +120,6 @@ class Board:
"""Add a task to icol""" """Add a task to icol"""
self.tasks[icol].append(task) self.tasks[icol].append(task)
def del_task(self, icol, itask):
del self.tasks[icol][itask]

@ -37,12 +37,13 @@ EditColScreen {
content-align: center top; content-align: center top;
color: #ebdbb9; color: #ebdbb9;
text-style: underline; text-style: underline;
padding: 1;
} }
.header-focused { .header-focused {
content-align: center top; content-align: center top;
color: #458588; color: #458588;
text-style: underline; text-style: underline;
padding: 1;
} }
ListItem{ ListItem{

@ -130,13 +130,14 @@ class EditColScreen(Screen):
class KanbanForm(App): class KanbanForm(App):
CSS_PATH = 'layout.tcss' CSS_PATH = 'layout.tcss'
BINDINGS = [ BINDINGS = [
Binding("l", "fnext", "Focus Next", show=False, ),
Binding("a", "new_task", "Add New Task", 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("h", "fprev", "Focus Prev", show=False, ),
Binding("L", "move_up", "Focus Next", show=False), Binding("L", "move_up", "Focus Next", show=False),
Binding("H", "move_down", "Focus Prev", show=False), Binding("H", "move_down", "Focus Prev", show=False),
Binding("e", "edit_task", "Edit Task", show=False,), Binding("e", "edit_task", "Edit Task", show=False,),
Binding("r", "edit_column", "Edit Column Name", show=False,), Binding("r", "edit_column", "Edit Column Name", show=False,),
Binding("d", "delete_task", "Delete Task", show=False,),
Binding('q', 'exit', "Exit") Binding('q', 'exit', "Exit")
] ]
@ -229,6 +230,11 @@ class KanbanForm(App):
text = self.board.get_columns()[icol] text = self.board.get_columns()[icol]
self.push_screen(EditColScreen(text), self.update_col) 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): def update_col(self, text):
""" Update the column """ Update the column
""" """
@ -283,7 +289,7 @@ class KanbanForm(App):
icol,_ = self.get_col_task() icol,_ = self.get_col_task()
self.focused.mount(ListItem(Label(task.summary))) self.focused.mount(ListItem(Label(task.summary)))
self.board.add_task(icol, task) self.board.add_task(icol, task)
self.focused.highlighted_child self.focused.action_cursor_down()
# def on_key(self): # def on_key(self):
# with open('log','a') as f: # with open('log','a') as f: