From ce1fccbccb4605ec67dfdb957a505a8429a67d23 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Sat, 16 May 2015 17:57:25 -0700 Subject: [PATCH] Fix refresh on project and change lists Make the help text more accurate for the refresh command on both the project and change lists. When the change list is for a specific project, cause the refresh command to sync only that project. Change-Id: If1ba361b948e2e54d4ffc7f348525b5c9a9770b6 --- gertty/view/change_list.py | 14 +++++++++++--- gertty/view/project_list.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gertty/view/change_list.py b/gertty/view/change_list.py index d2fa671..8475207 100644 --- a/gertty/view/change_list.py +++ b/gertty/view/change_list.py @@ -154,6 +154,10 @@ class ChangeListHeader(urwid.WidgetWrap): class ChangeListView(urwid.WidgetWrap): def help(self): key = self.app.config.keymap.formatKeys + if self.project_key: + refresh_help = "Sync current project" + else: + refresh_help = "Sync subscribed projects" return [ (key(keymap.TOGGLE_HELD), "Toggle the held flag for the currently selected change"), @@ -168,7 +172,7 @@ class ChangeListView(urwid.WidgetWrap): (key(keymap.TOGGLE_STARRED), "Toggle the starred flag for the currently selected change"), (key(keymap.REFRESH), - "Sync all projects"), + refresh_help), (key(keymap.SORT_BY_NUMBER), "Sort changes by number"), (key(keymap.SORT_BY_UPDATED), @@ -455,8 +459,12 @@ class ChangeListView(urwid.WidgetWrap): row.update(change, self.categories) return None if keymap.REFRESH in commands: - self.app.sync.submitTask( - sync.SyncSubscribedProjectsTask(sync.HIGH_PRIORITY)) + if self.project_key: + self.app.sync.submitTask( + sync.SyncProjectTask(self.project_key, sync.HIGH_PRIORITY)) + else: + self.app.sync.submitTask( + sync.SyncSubscribedProjectsTask(sync.HIGH_PRIORITY)) self.app.status.update() return None if keymap.SORT_BY_NUMBER in commands: diff --git a/gertty/view/project_list.py b/gertty/view/project_list.py index 97ef5e2..49d788a 100644 --- a/gertty/view/project_list.py +++ b/gertty/view/project_list.py @@ -79,7 +79,7 @@ class ProjectListView(urwid.WidgetWrap): (key(keymap.TOGGLE_SUBSCRIBED), "Toggle the subscription flag for the currently selected project"), (key(keymap.REFRESH), - "Sync all projects") + "Sync subscribed projects") ] def __init__(self, app):