mirror of https://github.com/nicolargo/glances
Add new arg to display splitted line inside plugins
parent
12798942ea
commit
0f5a60b44d
|
@ -383,7 +383,9 @@ class glancesCurses:
|
|||
x = display_x
|
||||
continue
|
||||
# Do not display outside the screen
|
||||
if ((x < 0) or (x + len(m['msg']) > screen_x)):
|
||||
if (x < 0):
|
||||
continue
|
||||
if ((not m['splittable']) and (x + len(m['msg']) > screen_x)):
|
||||
continue
|
||||
if ((y < 0) or (y + 1 > screen_y) or (y > max_y)):
|
||||
break
|
||||
|
|
|
@ -210,7 +210,7 @@ class GlancesPlugin(object):
|
|||
'column': column_curse,
|
||||
'line': line_curse}
|
||||
|
||||
def curse_add_line(self, msg, decoration="DEFAULT", optional=False):
|
||||
def curse_add_line(self, msg, decoration="DEFAULT", optional=False, splittable=False):
|
||||
"""
|
||||
Return a dict with: { 'msg': msg, 'decoration': decoration, 'optional': False }
|
||||
with:
|
||||
|
@ -229,9 +229,10 @@ class GlancesPlugin(object):
|
|||
CRITICAL: Value is CRITICAL and non logged
|
||||
CRITICAL_LOG: Value is CRITICAL and logged
|
||||
optional: True if the stat is optional (display only if space is available)
|
||||
spittable: Line can be splitted to fit on the screen (default is not)
|
||||
"""
|
||||
|
||||
return {'msg': msg, 'decoration': decoration, 'optional': optional}
|
||||
return {'msg': msg, 'decoration': decoration, 'optional': optional, 'splittable': splittable}
|
||||
|
||||
def curse_new_line(self):
|
||||
"""
|
||||
|
|
|
@ -179,7 +179,7 @@ class Plugin(GlancesPlugin):
|
|||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
# Command line
|
||||
msg = " {0}".format(p['cmdline'])
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
ret.append(self.curse_add_line(msg, optional=True, splittable=True))
|
||||
|
||||
# Return the message with decoration
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue