summaryrefslogtreecommitdiffstats
path: root/glances
diff options
context:
space:
mode:
authorNicolas Hennion <nicolas.hennion@thalesaleniaspace.com>2021-05-28 17:35:05 +0200
committerNicolas Hennion <nicolas.hennion@thalesaleniaspace.com>2021-05-28 17:35:05 +0200
commitb85c1aba82b7981f1811a22ab069a3288954bafd (patch)
treeab56d9eaabc9614f78257b2d64600c2cf5feb05a /glances
parent8f6830a2bba162e034505ef6284b1f73d1ffc68a (diff)
Improve curses loop. Avoid checking keypressed if it return -1.
Diffstat (limited to 'glances')
-rw-r--r--glances/outputs/glances_curses.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py
index ee635d4a..b781c1e9 100644
--- a/glances/outputs/glances_curses.py
+++ b/glances/outputs/glances_curses.py
@@ -339,14 +339,16 @@ class _GlancesCurses(object):
def get_key(self, window):
# @TODO: Check issue #163
ret = window.getch()
- logger.debug("Keypressed (code: %s)" % ret)
return ret
def __catch_key(self, return_to_browser=False):
# Catch the pressed key
self.pressedkey = self.get_key(self.term_window)
+ if self.pressedkey == -1:
+ return -1
# Actions (available in the global hotkey dict)...
+ logger.debug("Keypressed (code: {})".format(self.pressedkey))
for hotkey in self._hotkeys:
if self.pressedkey == ord(hotkey) and 'switch' in self._hotkeys[hotkey]:
if self._hotkeys[hotkey]['switch'].startswith('enable_') or \