Commit ea5c6204 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add ability to remove a column with 'D'.

parent 45d71dcb
...@@ -43,8 +43,7 @@ class UIApplication(CLIApplicationBase): ...@@ -43,8 +43,7 @@ class UIApplication(CLIApplicationBase):
# console widget # console widget
self.console = ConsoleWidget() self.console = ConsoleWidget()
urwid.connect_signal(self.commandline, 'blur', urwid.connect_signal(self.commandline, 'blur', self._blur_commandline)
self._blur_commandline)
urwid.connect_signal(self.commandline, 'execute_command', urwid.connect_signal(self.commandline, 'execute_command',
self._execute_handler) self._execute_handler)
...@@ -107,12 +106,12 @@ class UIApplication(CLIApplicationBase): ...@@ -107,12 +106,12 @@ class UIApplication(CLIApplicationBase):
for column, _ in self.columns.contents: for column, _ in self.columns.contents:
column.update() column.update()
def _focus_commandline(self):
self.mainwindow.focus_item = 1
def _blur_commandline(self): def _blur_commandline(self):
self.mainwindow.focus_item = 0 self.mainwindow.focus_item = 0
def _focus_commandline(self):
self.mainwindow.focus_item = 1
def _focus_first_column(self): def _focus_first_column(self):
self.columns.focus_position = 0 self.columns.focus_position = 0
...@@ -133,6 +132,22 @@ class UIApplication(CLIApplicationBase): ...@@ -133,6 +132,22 @@ class UIApplication(CLIApplicationBase):
self.viewwidget.reset() self.viewwidget.reset()
self._viewwidget_visible = True self._viewwidget_visible = True
def _edit_view(self):
pass
def _delete_view(self):
try:
focus = self.columns.focus_position
del self.columns.contents[focus]
if self.columns.contents:
self.columns.focus_position = focus
else:
self._focus_commandline()
except IndexError:
# no columns
pass
def _handle_input(self, p_input): def _handle_input(self, p_input):
dispatch = { dispatch = {
':': self._focus_commandline, ':': self._focus_commandline,
...@@ -143,6 +158,8 @@ class UIApplication(CLIApplicationBase): ...@@ -143,6 +158,8 @@ class UIApplication(CLIApplicationBase):
'right': self._focus_next_column, 'right': self._focus_next_column,
'l': self._focus_next_column, 'l': self._focus_next_column,
'C': self._new_view, 'C': self._new_view,
'E': self._edit_view,
'D': self._delete_view,
} }
try: try:
...@@ -170,6 +187,7 @@ class UIApplication(CLIApplicationBase): ...@@ -170,6 +187,7 @@ class UIApplication(CLIApplicationBase):
item = (todolist, options) item = (todolist, options)
self.columns.contents.append(item) self.columns.contents.append(item)
self.columns.focus_position = len(self.columns.contents) - 1 self.columns.focus_position = len(self.columns.contents) - 1
self._blur_commandline()
@property @property
def _console_visible(self): def _console_visible(self):
......
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