mirror of
https://github.com/nicolargo/glances.git
synced 2024-09-21 17:48:47 +03:00
Selected process is now undelined
This commit is contained in:
parent
591ae02f8e
commit
f7abdea9d8
@ -307,6 +307,7 @@ class _GlancesCurses(object):
|
|||||||
'FILTER': self.filter_color,
|
'FILTER': self.filter_color,
|
||||||
'TITLE': self.title_color,
|
'TITLE': self.title_color,
|
||||||
'PROCESS': self.default_color2,
|
'PROCESS': self.default_color2,
|
||||||
|
'PROCESS_SELECTED': self.default_color2 | curses.A_UNDERLINE,
|
||||||
'STATUS': self.default_color2,
|
'STATUS': self.default_color2,
|
||||||
'NICE': self.nice_color,
|
'NICE': self.nice_color,
|
||||||
'CPU_TIME': self.cpu_time_color,
|
'CPU_TIME': self.cpu_time_color,
|
||||||
|
@ -75,8 +75,8 @@ class Plugin(GlancesPlugin):
|
|||||||
|
|
||||||
# Define the stat layout of the processes list columns
|
# Define the stat layout of the processes list columns
|
||||||
layout_stat = {
|
layout_stat = {
|
||||||
'cpu': '{:<6.1f} ',
|
'cpu': '{:<6.1f}',
|
||||||
'cpu_no_digit': '{:<6.0f} ',
|
'cpu_no_digit': '{:<6.0f}',
|
||||||
'mem': '{:<5.1f} ',
|
'mem': '{:<5.1f} ',
|
||||||
'virt': '{:<5} ',
|
'virt': '{:<5} ',
|
||||||
'res': '{:<5} ',
|
'res': '{:<5} ',
|
||||||
@ -180,7 +180,9 @@ class Plugin(GlancesPlugin):
|
|||||||
- selected is a tag=True if the selected process
|
- selected is a tag=True if the selected process
|
||||||
"""
|
"""
|
||||||
ret = [self.curse_new_line()]
|
ret = [self.curse_new_line()]
|
||||||
# Selected or not selected, that the question...
|
# When a process is selected:
|
||||||
|
# * display a special caracter at the beginning of the line
|
||||||
|
# * underline the command name
|
||||||
ret.append(self.curse_add_line('>' if selected else ' ', 'SELECTED'))
|
ret.append(self.curse_add_line('>' if selected else ' ', 'SELECTED'))
|
||||||
# CPU
|
# CPU
|
||||||
if 'cpu_percent' in p and p['cpu_percent'] is not None and p['cpu_percent'] != '':
|
if 'cpu_percent' in p and p['cpu_percent'] is not None and p['cpu_percent'] != '':
|
||||||
@ -326,21 +328,24 @@ class Plugin(GlancesPlugin):
|
|||||||
else:
|
else:
|
||||||
cmdline = '?'
|
cmdline = '?'
|
||||||
try:
|
try:
|
||||||
|
process_decoration = 'PROCESS_SELECTED' if selected else 'PROCESS'
|
||||||
if cmdline:
|
if cmdline:
|
||||||
path, cmd, arguments = split_cmdline(cmdline)
|
path, cmd, arguments = split_cmdline(cmdline)
|
||||||
if os.path.isdir(path) and not args.process_short_name:
|
if os.path.isdir(path) and not args.process_short_name:
|
||||||
msg = self.layout_stat['command'].format(path) + os.sep
|
msg = self.layout_stat['command'].format(path) + os.sep
|
||||||
ret.append(self.curse_add_line(msg, splittable=True))
|
ret.append(self.curse_add_line(msg, splittable=True))
|
||||||
ret.append(self.curse_add_line(cmd, decoration='PROCESS', splittable=True))
|
ret.append(self.curse_add_line(
|
||||||
|
cmd, decoration=process_decoration, splittable=True))
|
||||||
else:
|
else:
|
||||||
msg = self.layout_stat['command'].format(cmd)
|
msg = self.layout_stat['command'].format(cmd)
|
||||||
ret.append(self.curse_add_line(msg, decoration='PROCESS', splittable=True))
|
ret.append(self.curse_add_line(
|
||||||
|
msg, decoration=process_decoration, splittable=True))
|
||||||
if arguments:
|
if arguments:
|
||||||
msg = ' ' + self.layout_stat['command'].format(arguments)
|
msg = ' ' + self.layout_stat['command'].format(arguments)
|
||||||
ret.append(self.curse_add_line(msg, splittable=True))
|
ret.append(self.curse_add_line(msg, splittable=True))
|
||||||
else:
|
else:
|
||||||
msg = self.layout_stat['name'].format(p['name'])
|
msg = self.layout_stat['name'].format(p['name'])
|
||||||
ret.append(self.curse_add_line(msg, splittable=True))
|
ret.append(self.curse_add_line(msg, decoration=process_decoration, splittable=True))
|
||||||
except (TypeError, UnicodeEncodeError) as e:
|
except (TypeError, UnicodeEncodeError) as e:
|
||||||
# Avoid crach after running fine for several hours #1335
|
# Avoid crach after running fine for several hours #1335
|
||||||
logger.debug("Can not decode command line '{}' ({})".format(cmdline, e))
|
logger.debug("Can not decode command line '{}' ({})".format(cmdline, e))
|
||||||
|
Loading…
Reference in New Issue
Block a user