Reset focus when changing workspaces, style changes
This commit is contained in:
@@ -73,6 +73,7 @@ class CmdAsana:
|
|||||||
if old_widget != None:
|
if old_widget != None:
|
||||||
self.clearSignals(old_widget)
|
self.clearSignals(old_widget)
|
||||||
self.frame.contents.append((widget, self.frame.options()))
|
self.frame.contents.append((widget, self.frame.options()))
|
||||||
|
self.frame.focus_position = 0
|
||||||
|
|
||||||
def showWorkspace(self, workspace_id):
|
def showWorkspace(self, workspace_id):
|
||||||
task_list = ui.TaskList(self.allMyTasks(workspace_id))
|
task_list = ui.TaskList(self.allMyTasks(workspace_id))
|
||||||
@@ -133,9 +134,9 @@ class CmdAsana:
|
|||||||
urwid.connect_signal(workspace_menu, 'click', self.showWorkspace)
|
urwid.connect_signal(workspace_menu, 'click', self.showWorkspace)
|
||||||
|
|
||||||
self.frame = urwid.Pile([
|
self.frame = urwid.Pile([
|
||||||
('pack', workspace_menu),
|
('pack', urwid.AttrMap(workspace_menu, 'workspace')),
|
||||||
('pack', urwid.AttrMap(urwid.Divider(), 'header divider')),
|
None
|
||||||
None])
|
])
|
||||||
self.showWorkspace(self.myWorkspaces()[0]['id'])
|
self.showWorkspace(self.myWorkspaces()[0]['id'])
|
||||||
|
|
||||||
loop = urwid.MainLoop(self.frame,
|
loop = urwid.MainLoop(self.frame,
|
||||||
|
|||||||
9
ui.py
9
ui.py
@@ -8,10 +8,9 @@ LIST = 'list'
|
|||||||
palette = [
|
palette = [
|
||||||
('selected', 'standout', ''),
|
('selected', 'standout', ''),
|
||||||
('selected workspace', 'standout,bold', ''),
|
('selected workspace', 'standout,bold', ''),
|
||||||
('header divider', '', 'dark blue'),
|
('header', 'bold,light green', ''),
|
||||||
('header', 'bold,dark cyan', ''),
|
('task', 'light green', ''),
|
||||||
('task', 'dark cyan', 'black'),
|
('workspace', 'white', 'dark blue')
|
||||||
('workspace', 'yellow', '')
|
|
||||||
]
|
]
|
||||||
|
|
||||||
class WorkspaceMenu(urwid.Columns):
|
class WorkspaceMenu(urwid.Columns):
|
||||||
@@ -21,7 +20,7 @@ class WorkspaceMenu(urwid.Columns):
|
|||||||
for workspace in workspaces:
|
for workspace in workspaces:
|
||||||
button = WorkspaceButton(workspace, self.loadWorkspace)
|
button = WorkspaceButton(workspace, self.loadWorkspace)
|
||||||
self.contents.append((urwid.AttrMap(button,
|
self.contents.append((urwid.AttrMap(button,
|
||||||
'workspace',
|
None,
|
||||||
focus_map='selected workspace'),
|
focus_map='selected workspace'),
|
||||||
self.options('given', 24)))
|
self.options('given', 24)))
|
||||||
def keypress(self, size, key):
|
def keypress(self, size, key):
|
||||||
|
|||||||
Reference in New Issue
Block a user