Add a key to return to the project list

To facilitate escaping from a deep stack of screens, add a key
to clear the history and return to the main project list.  Bind
this to meta-home by default.

Change-Id: Ic98e47d7a3a17271bf21230ec4bac184f691ced3
This commit is contained in:
James E. Blair 2015-04-07 08:44:39 -07:00
parent dbe0f37b04
commit cdd6bd2399
3 changed files with 7 additions and 0 deletions

View File

@ -500,6 +500,9 @@ class App(object):
commands = self.config.keymap.getCommands(key)
if keymap.PREV_SCREEN in commands:
self.backScreen()
elif keymap.TOP_SCREEN in commands:
self.clearHistory()
self.refresh(force=True)
elif keymap.HELP in commands:
self.help()
elif keymap.QUIT in commands:

View File

@ -31,6 +31,7 @@ CURSOR_MAX_RIGHT = urwid.CURSOR_MAX_RIGHT
ACTIVATE = urwid.ACTIVATE
# Global gertty commands:
PREV_SCREEN = 'previous screen'
TOP_SCREEN = 'top screen'
HELP = 'help'
QUIT = 'quit'
CHANGE_SEARCH = 'change search'
@ -81,6 +82,7 @@ DEFAULT_KEYMAP = {
ACTIVATE: 'enter',
PREV_SCREEN: 'esc',
TOP_SCREEN: 'meta home',
HELP: ['f1', '?'],
QUIT: 'ctrl q',
CHANGE_SEARCH: 'ctrl o',

View File

@ -21,6 +21,8 @@ GLOBAL_HELP = (
"Display help"),
(keymap.PREV_SCREEN,
"Back to previous screen"),
(keymap.TOP_SCREEN,
"Back to project list"),
(keymap.QUIT,
"Quit Gertty"),
(keymap.CHANGE_SEARCH,