Added ability to switch workspaces

This commit is contained in:
Aaron Gutierrez
2015-07-19 21:20:05 -07:00
parent 45fb6c28f7
commit 73c474ab70
2 changed files with 62 additions and 30 deletions

20
ui.py
View File

@@ -7,8 +7,28 @@ LIST = 'list'
palette = [
('selected', 'standout', ''),
('selected workspace', 'white', 'dark red'),
]
class WorkspaceMenu(urwid.Columns):
def __init__(self, workspaces):
super(WorkspaceMenu, self).__init__([], dividechars=1)
for workspace in workspaces:
button = WorkspaceButton(workspace, self.loadWorkspace)
self.contents.append((urwid.AttrMap(button,
None,
focus_map='selected workspace'),
self.options('given', 24)))
def loadWorkspace(self, widget, workspace_id):
urwid.emit_signal(self, 'click', workspace_id)
class WorkspaceButton(urwid.Button):
def __init__(self, workspace, onClick):
super(WorkspaceButton, self).__init__(workspace['name'])
urwid.connect_signal(self, 'click', onClick, workspace['id'])
class TaskList(urwid.ListBox):
def __init__(self, tasks):
self.tasks = tasks