Add 'PROCESS' and 'STATUS' decorations

It's now possible to define specific colors for both process name and
process status.
This commit is contained in:
Alessio Sergi 2014-05-06 16:06:49 +02:00
parent 15ea33461f
commit 29fdeec161
3 changed files with 9 additions and 7 deletions

View File

@ -131,6 +131,8 @@ class glancesCurses:
'SORT': A_BOLD,
'OK': self.default_color2,
'TITLE': self.title_color,
'PROCESS': self.default_color2,
'STATUS': self.default_color2,
'CAREFUL': self.ifCAREFUL_color2,
'WARNING': self.ifWARNING_color2,
'CRITICAL': self.ifCRITICAL_color2,

View File

@ -219,6 +219,8 @@ class GlancesPlugin(object):
UNDERLINE: underline
BOLD: bold
TITLE: for stat title
PROCESS: for process name
STATUS: for process status
OK: Value is OK and non logged
OK_LOG: Value is OK and logged
CAREFUL: Value is CAREFUL and non logged

View File

@ -141,7 +141,7 @@ class Plugin(GlancesPlugin):
status = p['status']
msg = " {0:>1}".format(status)
if status == 'R':
ret.append(self.curse_add_line(msg, decoration='OK', optional=True))
ret.append(self.curse_add_line(msg, decoration='STATUS', optional=True))
else:
ret.append(self.curse_add_line(msg, optional=True))
# TIME+
@ -195,14 +195,12 @@ class Plugin(GlancesPlugin):
if os.path.isdir(path):
msg = " {0}".format(path) + os.sep
ret.append(self.curse_add_line(msg, optional=True, splittable=True))
ret.append(self.curse_add_line(basename, decoration='OK', optional=True, splittable=True))
msg = " {0}".format(args)
ret.append(self.curse_add_line(msg, optional=True, splittable=True))
ret.append(self.curse_add_line(basename, decoration='PROCESS', optional=True, splittable=True))
else:
msg = " {0}".format(basename)
ret.append(self.curse_add_line(msg, decoration='OK', optional=True, splittable=True))
msg = " {0}".format(args)
ret.append(self.curse_add_line(msg, optional=True, splittable=True))
ret.append(self.curse_add_line(msg, decoration='PROCESS', optional=True, splittable=True))
msg = " {0}".format(args)
ret.append(self.curse_add_line(msg, optional=True, splittable=True))
except UnicodeEncodeError:
ret.append(self.curse_add_line("", optional=True, splittable=True))