mirror of
https://github.com/nicolargo/glances.git
synced 2025-01-03 07:03:40 +03:00
Merge branch 'issue1075' into develop
This commit is contained in:
commit
130cd2961a
4
NEWS
4
NEWS
@ -5,6 +5,10 @@ Glances Version 2
|
||||
Version 2.9.2
|
||||
=============
|
||||
|
||||
Enhancements and new features:
|
||||
|
||||
* Use -> and <- arrows keys to switch between processing sort (issue #1075)
|
||||
|
||||
Bugs corrected:
|
||||
|
||||
* StatsD export prefix option is ignored (issue #1074)
|
||||
|
@ -82,9 +82,11 @@ class _GlancesCurses(object):
|
||||
'm': {'auto_sort': False, 'sort_key': 'memory_percent'},
|
||||
'p': {'auto_sort': False, 'sort_key': 'name'},
|
||||
't': {'auto_sort': False, 'sort_key': 'cpu_times'},
|
||||
'u': {'auto_sort': False, 'sort_key': 'username'}
|
||||
'u': {'auto_sort': False, 'sort_key': 'username'},
|
||||
}
|
||||
|
||||
_sort_loop = ['cpu_percent', 'memory_percent', 'username', 'cpu_times', 'io_counters', 'name']
|
||||
|
||||
def __init__(self, config=None, args=None):
|
||||
# Init
|
||||
self.config = config
|
||||
@ -130,7 +132,7 @@ class _GlancesCurses(object):
|
||||
self.args.reset_minmax_tag = False
|
||||
|
||||
# Catch key pressed with non blocking mode
|
||||
self.no_flash_cursor()
|
||||
self.term_window.keypad(1)
|
||||
self.term_window.nodelay(1)
|
||||
self.pressedkey = -1
|
||||
|
||||
@ -284,12 +286,6 @@ class _GlancesCurses(object):
|
||||
'PASSWORD': curses.A_PROTECT
|
||||
}
|
||||
|
||||
def flash_cursor(self):
|
||||
self.term_window.keypad(1)
|
||||
|
||||
def no_flash_cursor(self):
|
||||
self.term_window.keypad(0)
|
||||
|
||||
def set_cursor(self, value):
|
||||
"""Configure the curse cursor apparence.
|
||||
|
||||
@ -395,10 +391,27 @@ class _GlancesCurses(object):
|
||||
glances_processes.disable()
|
||||
else:
|
||||
glances_processes.enable()
|
||||
elif self.pressedkey == curses.KEY_LEFT:
|
||||
# "<" (left arrow) navigation through process sort
|
||||
setattr(glances_processes, 'auto_sort', False)
|
||||
next_sort = (self.loop_position() - 1) % len(self._sort_loop)
|
||||
glances_processes.sort_key = self._sort_loop[next_sort]
|
||||
elif self.pressedkey == curses.KEY_RIGHT:
|
||||
# ">" (right arrow) navigation through process sort
|
||||
setattr(glances_processes, 'auto_sort', False)
|
||||
next_sort = (self.loop_position() + 1) % len(self._sort_loop)
|
||||
glances_processes.sort_key = self._sort_loop[next_sort]
|
||||
|
||||
# Return the key code
|
||||
return self.pressedkey
|
||||
|
||||
def loop_position(self):
|
||||
"""Return the current sort in the loop"""
|
||||
for i, v in enumerate(self._sort_loop):
|
||||
if v == glances_processes.sort_key:
|
||||
return i
|
||||
return 0
|
||||
|
||||
def disable_top(self):
|
||||
"""Disable the top panel"""
|
||||
for p in ['quicklook', 'cpu', 'gpu', 'mem', 'memswap', 'load']:
|
||||
@ -816,11 +829,11 @@ class _GlancesCurses(object):
|
||||
subpop.refresh()
|
||||
# Create the textbox inside the subwindows
|
||||
self.set_cursor(2)
|
||||
self.flash_cursor()
|
||||
self.term_window.keypad(1)
|
||||
textbox = GlancesTextbox(subpop, insert_mode=False)
|
||||
textbox.edit()
|
||||
self.set_cursor(0)
|
||||
self.no_flash_cursor()
|
||||
self.term_window.keypad(0)
|
||||
if textbox.gather() != '':
|
||||
logger.debug(
|
||||
"User enters the following string: %s" % textbox.gather())
|
||||
|
Loading…
Reference in New Issue
Block a user