diff options
author | nicolargo <nicolas@nicolargo.com> | 2021-06-12 08:53:24 +0200 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2021-06-12 08:53:24 +0200 |
commit | 5d918cd7944453d45f6ae4b7d92439200dfb7e97 (patch) | |
tree | 3ddbecaaeeff5ba2bb6bd3fb6cf559a5ac89f088 | |
parent | 1f90393a030609d979e1a51405e238df6b3fbc67 (diff) |
# Quit from help should return to main screen, not exit #1874
-rw-r--r-- | glances/outputs/glances_curses.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index b781c1e9..e968c420 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -1083,25 +1083,32 @@ class _GlancesCurses(object): duration = 0.1 # Wait duration (in s) time - exitkey = False + isexitkey = False countdown = Timer(duration) # Set the default timeout (in ms) between two getch self.term_window.timeout(100) - while not countdown.finished() and not exitkey: + while not countdown.finished() and not isexitkey: # Getkey pressedkey = self.__catch_key(return_to_browser=return_to_browser) - # Is it an exit key ? - exitkey = (pressedkey == ord('\x1b') or pressedkey == ord('q')) + isexitkey = (pressedkey == ord('\x1b') or pressedkey == ord('q')) + if pressedkey == curses.KEY_F5: - # were asked to refresh - return exitkey - if not exitkey and pressedkey > -1: + # Were asked to refresh + return isexitkey + + if isexitkey and self.args.help_tag: + # Quit from help should return to main screen, not exit #1874 + self.args.help_tag = not self.args.help_tag + isexitkey = False + return isexitkey + + if not isexitkey and pressedkey > -1: # Redraw display self.flush(stats, cs_status=cs_status) # Overwrite the timeout with the countdown self.wait(delay=int(countdown.get() * 1000)) - return exitkey + return isexitkey def wait(self, delay=100): """Wait delay in ms""" |