|
|
|
@ -48,6 +48,7 @@ class EditTaskScreen(Screen):
|
|
|
|
|
"""
|
|
|
|
|
BINDINGS = [
|
|
|
|
|
Binding('ctrl+s', 'save', 'Save Changes', priority=True),
|
|
|
|
|
Binding('escape', 'exit', 'Exit Without Changes', priority=True),
|
|
|
|
|
]
|
|
|
|
|
def __init__(self,text):
|
|
|
|
|
"""
|
|
|
|
@ -82,6 +83,9 @@ class EditTaskScreen(Screen):
|
|
|
|
|
self.text.description = query.nodes[0].text
|
|
|
|
|
self.dismiss(self.text)
|
|
|
|
|
|
|
|
|
|
def action_exit(self):
|
|
|
|
|
self.dismiss(None)
|
|
|
|
|
|
|
|
|
|
class EditColScreen(Screen):
|
|
|
|
|
"""
|
|
|
|
|
This is a screen used to edit the name of a task
|
|
|
|
@ -154,14 +158,26 @@ class KanbanForm(App):
|
|
|
|
|
else:
|
|
|
|
|
col_class = 'last-column'
|
|
|
|
|
with Vertical(classes=col_class):
|
|
|
|
|
yield Static(col, classes='header')
|
|
|
|
|
if i == 0:
|
|
|
|
|
yield Static(col, classes='header-focused')
|
|
|
|
|
else:
|
|
|
|
|
yield Static(col, classes='header')
|
|
|
|
|
yield TaskList(
|
|
|
|
|
*[ListItem(Label(task.summary)) for task in self.board.get_tasks()[i]])
|
|
|
|
|
|
|
|
|
|
# Now make all TaskLists except the first have no highlights
|
|
|
|
|
def action_fnext(self):
|
|
|
|
|
""" Focus next column"""
|
|
|
|
|
query = self.query(selector=Static)
|
|
|
|
|
query = [node for node in query.nodes if str(node) == 'Static()']
|
|
|
|
|
icol, _ = self.get_col_task()
|
|
|
|
|
query[icol].classes="header"
|
|
|
|
|
self.children[0].focus_next()
|
|
|
|
|
try:
|
|
|
|
|
query[icol+1].classes="header-focused"
|
|
|
|
|
except IndexError:
|
|
|
|
|
query[0].classes="header-focused"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def action_move_up(self):
|
|
|
|
|
icol, itask = self.get_col_task()
|
|
|
|
@ -178,7 +194,15 @@ class KanbanForm(App):
|
|
|
|
|
|
|
|
|
|
def action_fprev(self):
|
|
|
|
|
""" Focus previous column """
|
|
|
|
|
query = self.query(selector=Static)
|
|
|
|
|
query = [node for node in query.nodes if str(node) == 'Static()']
|
|
|
|
|
icol, _ = self.get_col_task()
|
|
|
|
|
query[icol].classes="header"
|
|
|
|
|
self.children[0].focus_previous()
|
|
|
|
|
try:
|
|
|
|
|
query[icol-1].classes="header-focused"
|
|
|
|
|
except IndexError:
|
|
|
|
|
query[-1].classes="header-focused"
|
|
|
|
|
|
|
|
|
|
def action_move_down(self):
|
|
|
|
|
icol, itask = self.get_col_task()
|
|
|
|
@ -217,7 +241,7 @@ class KanbanForm(App):
|
|
|
|
|
|
|
|
|
|
def action_exit(self):
|
|
|
|
|
""" Exit the application """
|
|
|
|
|
self.board.write_md()
|
|
|
|
|
self.board.write_yaml(file='.board.yaml')
|
|
|
|
|
self.exit()
|
|
|
|
|
|
|
|
|
|
def get_col_task(self):
|
|
|
|
@ -233,8 +257,9 @@ class KanbanForm(App):
|
|
|
|
|
if focused_col == child:
|
|
|
|
|
col_index = i
|
|
|
|
|
|
|
|
|
|
# Now get the indext of the item in the list
|
|
|
|
|
# Now get the index of the item in the list
|
|
|
|
|
to_move = focused_col.highlighted_child
|
|
|
|
|
task_index = None
|
|
|
|
|
for i, child in enumerate(focused_col.children):
|
|
|
|
|
if to_move == child:
|
|
|
|
|
task_index = i
|
|
|
|
@ -246,17 +271,19 @@ class KanbanForm(App):
|
|
|
|
|
task and the board class
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
icol, itask = self.get_col_task()
|
|
|
|
|
self.focused.highlighted_child.children[0].update(task.summary)
|
|
|
|
|
self.board.update_task(icol, itask, task)
|
|
|
|
|
if task:
|
|
|
|
|
icol, itask = self.get_col_task()
|
|
|
|
|
self.focused.highlighted_child.children[0].update(task.summary)
|
|
|
|
|
self.board.update_task(icol, itask, task)
|
|
|
|
|
|
|
|
|
|
def new_task(self, task):
|
|
|
|
|
""" This function adds a new task to our board
|
|
|
|
|
"""
|
|
|
|
|
icol,_ = self.get_col_task()
|
|
|
|
|
self.focused.mount(ListItem(Label(task.summary)))
|
|
|
|
|
self.board.add_task(icol, task)
|
|
|
|
|
self.focused.highlighted_child
|
|
|
|
|
if task:
|
|
|
|
|
icol,_ = self.get_col_task()
|
|
|
|
|
self.focused.mount(ListItem(Label(task.summary)))
|
|
|
|
|
self.board.add_task(icol, task)
|
|
|
|
|
self.focused.highlighted_child
|
|
|
|
|
|
|
|
|
|
# def on_key(self):
|
|
|
|
|
# with open('log','a') as f:
|
|
|
|
|