mirror of https://github.com/nicolargo/glances.git
Add a shortcut to delete process filter #699 / Correct some issue on encoding if monitoring list process return string with accent
This commit is contained in:
parent
94174078c8
commit
b4abf20b3b
3
NEWS
3
NEWS
|
|
@ -10,6 +10,9 @@ Enhancements and new features:
|
|||
* Add process summary min/max stats (issue #703)
|
||||
* Add timestamp to the CSV export module (issue #708)
|
||||
* [WebUI] add "pointer" cursor for sortable columns (issue #704 from @notFloran)
|
||||
* Add a shortcut 'E' to delete process filter (issue #699)
|
||||
|
||||
Bugs corrected:
|
||||
* Can't read sensors on a Thinkpad (issue #711)
|
||||
|
||||
Version 2.5.1
|
||||
|
|
|
|||
|
|
@ -244,6 +244,8 @@ The following commands (key pressed) are supported while in Glances:
|
|||
Show/hide disk I/O stats
|
||||
``e``
|
||||
Enable/disable top extended stats
|
||||
``E``
|
||||
Erase current process filter
|
||||
``f``
|
||||
Show/hide file system stats
|
||||
``F``
|
||||
|
|
|
|||
|
|
@ -142,7 +142,10 @@ class MonitorList(object):
|
|||
except Exception:
|
||||
self.__monitor_list[i]['result'] = 'Cannot execute command'
|
||||
# Only save the first line
|
||||
self.__monitor_list[i]['result'] = u(self.__monitor_list[i]['result']).split('\n')[0]
|
||||
try:
|
||||
self.__monitor_list[i]['result'] = u(self.__monitor_list[i]['result']).split('\n')[0]
|
||||
except:
|
||||
self.__monitor_list[i]['result'] = ''
|
||||
|
||||
if self.command(i) is None or self.__monitor_list[i]['result'] == '':
|
||||
# If there is no command specified in the conf file
|
||||
|
|
|
|||
|
|
@ -328,6 +328,10 @@ class _GlancesCurses(object):
|
|||
glances_processes.disable_extended()
|
||||
else:
|
||||
glances_processes.enable_extended()
|
||||
elif self.pressedkey == ord('E'):
|
||||
# 'E' > Erase the process filter
|
||||
logger.info("Erase process filter")
|
||||
glances_processes.process_filter = None
|
||||
elif self.pressedkey == ord('F'):
|
||||
# 'F' > Switch between FS available and free space
|
||||
self.args.fs_free_space = not self.args.fs_free_space
|
||||
|
|
@ -1240,16 +1244,16 @@ class GlancesCursesBrowser(_GlancesCurses):
|
|||
|
||||
return True
|
||||
|
||||
|
||||
if not is_windows:
|
||||
|
||||
class GlancesTextbox(Textbox):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(GlancesTextbox, self).__init__(*args, **kwargs)
|
||||
def __init__(*args, **kwargs):
|
||||
Textbox.__init__(*args, **kwargs)
|
||||
|
||||
def do_command(self, ch):
|
||||
if ch == 10: # Enter
|
||||
return 0
|
||||
if ch == 127: # Back
|
||||
return 8
|
||||
return super(GlancesTextbox, self).do_command(ch)
|
||||
return Textbox.do_command(self, ch)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,11 @@ class Plugin(GlancesPlugin):
|
|||
msg = '{0:13} '.format('RUNNING' if m['count'] >= 1 else 'NOT RUNNING')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# Decode to UTF-8 (for Python 2)
|
||||
msg = u(m['result']) if m['count'] >= 1 else ''
|
||||
try:
|
||||
msg = u(m['result']) if m['count'] >= 1 else ''
|
||||
except UnicodeEncodeError:
|
||||
# Hack if return message contain accent letter (non UTF-8 compliant)
|
||||
msg = ''
|
||||
ret.append(self.curse_add_line(msg, optional=True, splittable=True))
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class Plugin(GlancesPlugin):
|
|||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
msg = ' {0} '.format(glances_processes.process_filter)
|
||||
ret.append(self.curse_add_line(msg, "FILTER"))
|
||||
msg = '(press ENTER to edit)'
|
||||
msg = '(\'ENTER\' to edit, \'E\' to reset)'
|
||||
ret.append(self.curse_add_line(msg))
|
||||
ret.append(self.curse_new_line())
|
||||
|
||||
|
|
|
|||
|
|
@ -207,6 +207,9 @@ Show/hide disk I/O stats
|
|||
.B e
|
||||
Enable/disable top extended stats
|
||||
.TP
|
||||
.B E
|
||||
Erase current process filter
|
||||
.TP
|
||||
.B f
|
||||
Show/hide file system stats
|
||||
.TP
|
||||
|
|
|
|||
Loading…
Reference in New Issue