Reset focus when changing workspaces, style changes

This commit is contained in:
2015-07-20 23:14:00 -07:00
parent b021b94321
commit f34880b9ec
2 changed files with 8 additions and 8 deletions

View File

@@ -73,6 +73,7 @@ class CmdAsana:
if old_widget != None:
self.clearSignals(old_widget)
self.frame.contents.append((widget, self.frame.options()))
self.frame.focus_position = 0
def showWorkspace(self, workspace_id):
task_list = ui.TaskList(self.allMyTasks(workspace_id))
@@ -133,9 +134,9 @@ class CmdAsana:
urwid.connect_signal(workspace_menu, 'click', self.showWorkspace)
self.frame = urwid.Pile([
('pack', workspace_menu),
('pack', urwid.AttrMap(urwid.Divider(), 'header divider')),
None])
('pack', urwid.AttrMap(workspace_menu, 'workspace')),
None
])
self.showWorkspace(self.myWorkspaces()[0]['id'])
loop = urwid.MainLoop(self.frame,

9
ui.py
View File

@@ -8,10 +8,9 @@ LIST = 'list'
palette = [
('selected', 'standout', ''),
('selected workspace', 'standout,bold', ''),
('header divider', '', 'dark blue'),
('header', 'bold,dark cyan', ''),
('task', 'dark cyan', 'black'),
('workspace', 'yellow', '')
('header', 'bold,light green', ''),
('task', 'light green', ''),
('workspace', 'white', 'dark blue')
]
class WorkspaceMenu(urwid.Columns):
@@ -21,7 +20,7 @@ class WorkspaceMenu(urwid.Columns):
for workspace in workspaces:
button = WorkspaceButton(workspace, self.loadWorkspace)
self.contents.append((urwid.AttrMap(button,
'workspace',
None,
focus_map='selected workspace'),
self.options('given', 24)))
def keypress(self, size, key):