Add escape as a keybinding to exit screens without saving

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

@ -48,6 +48,7 @@ class EditTaskScreen(Screen):
""" """
BINDINGS = [ BINDINGS = [
Binding('ctrl+s', 'save', 'Save Changes', priority=True), Binding('ctrl+s', 'save', 'Save Changes', priority=True),
Binding('escape', 'exit', 'Exit Without Changes', priority=True),
] ]
def __init__(self,text): def __init__(self,text):
""" """
@ -82,6 +83,9 @@ class EditTaskScreen(Screen):
self.text.description = query.nodes[0].text self.text.description = query.nodes[0].text
self.dismiss(self.text) self.dismiss(self.text)
def action_exit(self):
self.dismiss(None)
class EditColScreen(Screen): class EditColScreen(Screen):
""" """
This is a screen used to edit the name of a task This is a screen used to edit the name of a task
@ -267,17 +271,19 @@ class KanbanForm(App):
task and the board class task and the board class
""" """
icol, itask = self.get_col_task() if task:
self.focused.highlighted_child.children[0].update(task.summary) icol, itask = self.get_col_task()
self.board.update_task(icol, itask, task) self.focused.highlighted_child.children[0].update(task.summary)
self.board.update_task(icol, itask, task)
def new_task(self, task): def new_task(self, task):
""" This function adds a new task to our board """ This function adds a new task to our board
""" """
icol,_ = self.get_col_task() if task:
self.focused.mount(ListItem(Label(task.summary))) icol,_ = self.get_col_task()
self.board.add_task(icol, task) self.focused.mount(ListItem(Label(task.summary)))
self.focused.highlighted_child self.board.add_task(icol, task)
self.focused.highlighted_child
# def on_key(self): # def on_key(self):
# with open('log','a') as f: # with open('log','a') as f: