From cdd6bd23999befaf2b7aa9c3ab675397f6f22ae5 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 7 Apr 2015 08:44:39 -0700 Subject: [PATCH] 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 --- gertty/app.py | 3 +++ gertty/keymap.py | 2 ++ gertty/mywid.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/gertty/app.py b/gertty/app.py index 8b2e89b..af2a7ba 100644 --- a/gertty/app.py +++ b/gertty/app.py @@ -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: diff --git a/gertty/keymap.py b/gertty/keymap.py index b30241a..a1bd006 100644 --- a/gertty/keymap.py +++ b/gertty/keymap.py @@ -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', diff --git a/gertty/mywid.py b/gertty/mywid.py index 945f9b7..364ea1f 100644 --- a/gertty/mywid.py +++ b/gertty/mywid.py @@ -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,