Add refresh command
Let ctrl-r run a sync all projects task in list views, and sync the current change in the change view. Change-Id: I65cfb755bd387b68fe2dbd1562f149adb4421ea1
This commit is contained in:
parent
cff0b0cc9a
commit
42419904a8
@ -277,6 +277,7 @@ class ChangeView(urwid.WidgetWrap):
|
||||
<r> Leave a review for the most recent revision.
|
||||
<v> Toggle the reviewed flag for the current change.
|
||||
<x> Cherry-pick the most recent revision onto the local repo.
|
||||
<ctrl-r> Refresh this change.
|
||||
"""
|
||||
|
||||
def help(self):
|
||||
@ -384,6 +385,7 @@ class ChangeView(urwid.WidgetWrap):
|
||||
self.title = 'Change %s%s%s' % (change.number, reviewed, hidden)
|
||||
self.app.status.update(title=self.title)
|
||||
self.project_key = change.project.key
|
||||
self.change_rest_id = change.id
|
||||
|
||||
self.change_id_label.set_text(('change-data', change.change_id))
|
||||
self.owner_label.set_text(('change-data', change.owner))
|
||||
@ -564,6 +566,11 @@ class ChangeView(urwid.WidgetWrap):
|
||||
row = self.revision_rows[self.last_revision_key]
|
||||
row.cherryPick(None)
|
||||
return None
|
||||
if r == 'ctrl r':
|
||||
self.app.sync.submitTask(
|
||||
sync.SyncChangeTask(self.change_rest_id, priority=sync.HIGH_PRIORITY))
|
||||
self.app.status.update()
|
||||
return None
|
||||
if r in self.app.config.reviewkeys:
|
||||
self.reviewKey(self.app.config.reviewkeys[r])
|
||||
return None
|
||||
|
@ -16,6 +16,7 @@
|
||||
import urwid
|
||||
|
||||
from gertty import mywid
|
||||
from gertty import sync
|
||||
from gertty.view import change as view_change
|
||||
import gertty.view
|
||||
|
||||
@ -68,9 +69,10 @@ class ChangeListHeader(urwid.WidgetWrap):
|
||||
|
||||
class ChangeListView(urwid.WidgetWrap):
|
||||
_help = """
|
||||
<k> Toggle the hidden flag for the currently selected change.
|
||||
<l> Toggle whether only unreviewed or all changes are displayed.
|
||||
<v> Toggle the reviewed flag for the currently selected change.
|
||||
<k> Toggle the hidden flag for the currently selected change.
|
||||
<l> Toggle whether only unreviewed or all changes are displayed.
|
||||
<v> Toggle the reviewed flag for the currently selected change.
|
||||
<ctrl-r> Sync all projects.
|
||||
"""
|
||||
|
||||
def help(self):
|
||||
@ -152,6 +154,11 @@ class ChangeListView(urwid.WidgetWrap):
|
||||
hidden = self.toggleHidden(self.listbox.body[pos].change_key)
|
||||
self.refresh()
|
||||
return None
|
||||
if key == 'ctrl r':
|
||||
self.app.sync.submitTask(
|
||||
sync.SyncSubscribedProjectsTask(sync.HIGH_PRIORITY))
|
||||
self.app.status.update()
|
||||
return None
|
||||
return super(ChangeListView, self).keypress(size, key)
|
||||
|
||||
def onSelect(self, button, change_key):
|
||||
|
@ -67,8 +67,9 @@ class ProjectListHeader(urwid.WidgetWrap):
|
||||
|
||||
class ProjectListView(urwid.WidgetWrap):
|
||||
_help = """
|
||||
<l> Toggle whether only subscribed projects or all projects are listed.
|
||||
<s> Toggle the subscription flag for the currently selected project.
|
||||
<l> Toggle whether only subscribed projects or all projects are listed.
|
||||
<s> Toggle the subscription flag for the currently selected project.
|
||||
<ctrl-r> Sync all projects.
|
||||
"""
|
||||
|
||||
def help(self):
|
||||
@ -146,6 +147,11 @@ class ProjectListView(urwid.WidgetWrap):
|
||||
if subscribed:
|
||||
self.app.sync.submitTask(sync.SyncProjectTask(project_key))
|
||||
return None
|
||||
if key == 'ctrl r':
|
||||
self.app.sync.submitTask(
|
||||
sync.SyncSubscribedProjectsTask(sync.HIGH_PRIORITY))
|
||||
self.app.status.update()
|
||||
return None
|
||||
return super(ProjectListView, self).keypress(size, key)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user