Bugfixes
- don't crash on mouse events - load the correct project when a task is multihomed
This commit is contained in:
2
main.py
2
main.py
@@ -84,7 +84,7 @@ class CmdAsana(object):
|
|||||||
def exit_handler(self, key):
|
def exit_handler(self, key):
|
||||||
if key in ('q', 'Q', 'esc'):
|
if key in ('q', 'Q', 'esc'):
|
||||||
raise urwid.ExitMainLoop()
|
raise urwid.ExitMainLoop()
|
||||||
if key in ('backspace'):
|
if key == 'backspace':
|
||||||
self.ui.go_back()
|
self.ui.go_back()
|
||||||
|
|
||||||
def get_asana_service(self):
|
def get_asana_service(self):
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ class TaskDetails(object):
|
|||||||
|
|
||||||
class Memberships(object):
|
class Memberships(object):
|
||||||
def __init__(self, task, on_subtask_click, on_project_click):
|
def __init__(self, task, on_subtask_click, on_project_click):
|
||||||
components = [urwid.Button(
|
self.on_project_click = on_project_click
|
||||||
('project', p.name()),
|
|
||||||
on_press = lambda x: on_project_click(p.id())
|
components = [self.membership(p.name(), p.id()) for p in task.projects()]
|
||||||
) for p in task.projects()]
|
|
||||||
if task.parent():
|
if task.parent():
|
||||||
components.append(urwid.Button(
|
components.append(urwid.Button(
|
||||||
('task', 'Subtask of: %s' % task.parent().name()),
|
('task', 'Subtask of: %s' % task.parent().name()),
|
||||||
@@ -50,6 +50,11 @@ class Memberships(object):
|
|||||||
|
|
||||||
self.memberships = urwid.Pile(components)
|
self.memberships = urwid.Pile(components)
|
||||||
|
|
||||||
|
def membership(self, name, id):
|
||||||
|
return urwid.Button(('project', name),
|
||||||
|
on_press = lambda x: self.on_project_click(id)
|
||||||
|
)
|
||||||
|
|
||||||
def component(self):
|
def component(self):
|
||||||
return self.memberships
|
return self.memberships
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user