Commit 1f742805 authored by Jacek Sowiński's avatar Jacek Sowiński

Remove the highlighted todo by pressing 'd'

parent f2b7bd43
......@@ -122,6 +122,8 @@ class TodoListWidget(urwid.LineBox):
self._complete_selected_item()
elif p_key == 'p':
self.keystate = 'p'
elif p_key == 'd':
self._remove_selected_item()
elif p_key == 'j':
self.listbox.keypress(p_size, 'down')
elif p_key == 'k':
......@@ -168,3 +170,17 @@ class TodoListWidget(urwid.LineBox):
except AttributeError:
# No todo item selected
pass
def _remove_selected_item(self):
"""
Removes the highlighted todo item.
"""
try:
todo = self.listbox.focus.todo
self.view.todolist.number(todo)
urwid.emit_signal(self, 'execute_command', "del {}".format(
str(self.view.todolist.number(todo))))
except AttributeError:
# No todo item selected
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment