Enable navigation from task details to project
This commit is contained in:
@@ -112,7 +112,7 @@ class CmdAsana:
|
||||
|
||||
def addComment(self, task_id, comment):
|
||||
self.client.stories.create_on_task(task_id, {"text": comment})
|
||||
self.loadDetails(task_id)
|
||||
self.showDetails(task_id)
|
||||
|
||||
def replaceBody(self, widget):
|
||||
old_widget,_ = self.frame.contents.pop()
|
||||
@@ -155,6 +155,7 @@ class CmdAsana:
|
||||
stories = self.client.stories.find_by_task(task_id)
|
||||
task_details = ui.TaskDetails(task, stories)
|
||||
urwid.connect_signal(task_details, 'comment', self.addComment)
|
||||
urwid.connect_signal(task_details, 'loadproject', self.showProject)
|
||||
self.replaceBody(task_details)
|
||||
|
||||
def refreshTaskList(self):
|
||||
@@ -174,7 +175,7 @@ class CmdAsana:
|
||||
'details'
|
||||
])
|
||||
|
||||
urwid.register_signal(ui.TaskDetails, ['comment'])
|
||||
urwid.register_signal(ui.TaskDetails, ['comment', 'loadproject'])
|
||||
urwid.register_signal(ui.CommentEdit, ['comment'])
|
||||
|
||||
urwid.register_signal(ui.WorkspaceMenu, 'click')
|
||||
|
||||
9
ui.py
9
ui.py
@@ -190,14 +190,16 @@ class TaskDetails(urwid.Pile):
|
||||
comment_edit = CommentEdit(task)
|
||||
urwid.connect_signal(comment_edit, 'comment', self.comment)
|
||||
|
||||
projects = [('pack', ProjectIcon(project, self.loadProject))
|
||||
for project in task['projects']]
|
||||
|
||||
if task['assignee']:
|
||||
assignee = urwid.Text('Assigned to: ' + task['assignee']['name'])
|
||||
else:
|
||||
assignee = urwid.Text('(not assigned)')
|
||||
|
||||
|
||||
body = [('pack', urwid.Text(project['name']))
|
||||
for project in task['projects']] + \
|
||||
body = projects + \
|
||||
[
|
||||
('pack', urwid.Divider('=')),
|
||||
('pack', urwid.Text(('header', task['name']))),
|
||||
@@ -215,3 +217,6 @@ class TaskDetails(urwid.Pile):
|
||||
|
||||
def comment(self, task_id, comment):
|
||||
urwid.emit_signal(self, 'comment', task_id, comment)
|
||||
|
||||
def loadProject(self, project_id):
|
||||
urwid.emit_signal(self, 'loadproject', project_id)
|
||||
|
||||
Reference in New Issue
Block a user