Add a command to return to the change list
When viewing a change, map the key 'u' to return to the most recent list of changes. Normally this is the same as ESC, however, if the user has followed a series of dependent changes, this will pop the stack all the way back to the the list of changes to review. Change-Id: I49f4f41f4b476e25f1bb83e92601597024c8c659
This commit is contained in:
parent
492a857764
commit
e6102553ea
@ -152,16 +152,25 @@ class App(object):
|
||||
self.screens.append(self.loop.widget)
|
||||
self.loop.widget = widget
|
||||
|
||||
def backScreen(self, widget=None):
|
||||
def backScreen(self, target_widget=None):
|
||||
if not self.screens:
|
||||
return
|
||||
widget = self.screens.pop()
|
||||
while self.screens:
|
||||
widget = self.screens.pop()
|
||||
if (not target_widget) or (widget is target_widget):
|
||||
break
|
||||
self.log.debug("Popping screen to %s" % (widget,))
|
||||
if hasattr(widget, 'title'):
|
||||
self.status.update(title=widget.title)
|
||||
self.loop.widget = widget
|
||||
self.refresh()
|
||||
|
||||
def findChangeList(self):
|
||||
for widget in reversed(self.screens):
|
||||
if isinstance(widget, view_change_list.ChangeListView):
|
||||
return widget
|
||||
return None
|
||||
|
||||
def clearHistory(self):
|
||||
self.log.debug("Clearing screen history")
|
||||
while self.screens:
|
||||
|
@ -17,10 +17,10 @@ import urwid
|
||||
GLOBAL_HELP = """\
|
||||
Global Keys
|
||||
===========
|
||||
<F1> or <?> Help
|
||||
<ESC> Back to previous screen
|
||||
<CTRL-Q> Quit Gertty
|
||||
<CTRL-O> Search for changes
|
||||
<F1> or <?> Display help.
|
||||
<ESC> Back to previous screen.
|
||||
<CTRL-Q> Quit Gertty.
|
||||
<CTRL-O> Search for changes.
|
||||
"""
|
||||
|
||||
class TextButton(urwid.Button):
|
||||
|
@ -275,6 +275,7 @@ class ChangeView(urwid.WidgetWrap):
|
||||
<d> Show the diff of the mont recent revision.
|
||||
<k> Toggle the hidden flag for the current change.
|
||||
<r> Leave a review for the most recent revision.
|
||||
<u> Back to the list of changes.
|
||||
<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.
|
||||
@ -566,6 +567,10 @@ class ChangeView(urwid.WidgetWrap):
|
||||
row = self.revision_rows[self.last_revision_key]
|
||||
row.cherryPick(None)
|
||||
return None
|
||||
if r == 'u':
|
||||
widget = self.app.findChangeList()
|
||||
self.app.backScreen(widget)
|
||||
return None
|
||||
if r == 'ctrl r':
|
||||
self.app.sync.submitTask(
|
||||
sync.SyncChangeTask(self.change_rest_id, priority=sync.HIGH_PRIORITY))
|
||||
|
Loading…
x
Reference in New Issue
Block a user