提交 3c5975c5 编写于 作者: N Nicolas Hennion

Clean column and line var from plugins

上级 73bd3444
......@@ -432,12 +432,12 @@ class GlancesCurses(object):
screen_y = self.screen.getmaxyx()[0]
# Set the upper/left position of the message
if plugin_stats['column'] < 0:
if plugin_stats['align'] == 'right':
# Right align (last column)
display_x = screen_x - self.get_stats_display_width(plugin_stats)
else:
display_x = self.column
if plugin_stats['line'] < 0:
if plugin_stats['align'] == 'bottom':
# Bottom (last line)
display_y = screen_y - self.get_stats_display_height(plugin_stats)
else:
......
......@@ -40,12 +40,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 1
# Enter -1 to diplay bottom
self.line_curse = -1
# Init the stats
self.reset()
......
......@@ -47,12 +47,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 1
# Init stats
self.first_call = True
......
......@@ -39,12 +39,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 3
# Init the stats
self.reset()
......
......@@ -64,12 +64,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 4
# Init the stats
self.reset()
......
......@@ -41,12 +41,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 0
def update(self):
"""No stats. It is just a plugin to display the help."""
......
......@@ -48,12 +48,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 1
# Enter -1 to diplay bottom
self.line_curse = 1
# Init stats
self.reset()
......
......@@ -58,12 +58,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 2
# Enter -1 to diplay bottom
self.line_curse = 1
# Init the stats
self.reset()
......
......@@ -47,12 +47,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 3
# Enter -1 to diplay bottom
self.line_curse = 1
# Init the stats
self.reset()
......
......@@ -34,12 +34,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 1
# Enter -1 to diplay bottom
self.line_curse = 3
# Init stats
self.glances_monitors = None
......
......@@ -47,12 +47,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 2
# Init the stats
self.reset()
......
......@@ -37,12 +37,9 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = -1
self.set_align('bottom')
def update(self):
"""Update current date/time."""
......
......@@ -39,12 +39,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 1
# Init stats
self.reset()
......
......@@ -42,6 +42,9 @@ class GlancesPlugin(object):
# Init the args
self.args = args
# Init the default alignement (for curses)
self.set_align('left')
# Init the input method
self.input_method = 'local'
self.short_system_name = None
......@@ -279,30 +282,23 @@ class GlancesPlugin(object):
----------------------------
display | Display the stat (True or False)
msgdict | Message to display (list of dict [{ 'msg': msg, 'decoration': decoration } ... ])
column | column number
line | Line number
align | Message position
"""
display_curse = False
column_curse = -1
line_curse = -1
if hasattr(self, 'display_curse'):
display_curse = self.display_curse
if hasattr(self, 'column_curse'):
column_curse = self.column_curse
if hasattr(self, 'line_curse'):
line_curse = self.line_curse
if hasattr(self, 'align'):
align_curse = self.align
if max_width is not None:
ret = {'display': display_curse,
'msgdict': self.msg_curse(args, max_width=max_width),
'column': column_curse,
'line': line_curse}
'align': align_curse}
else:
ret = {'display': display_curse,
'msgdict': self.msg_curse(args),
'column': column_curse,
'line': line_curse}
'align': align_curse}
return ret
......@@ -336,17 +332,16 @@ class GlancesPlugin(object):
"""Go to a new line."""
return self.curse_add_line('\n')
def set_curse_column(self, column):
"""Set the Curse column
Enter -1 to right align
"""
self.column_curse = column
def set_align(self, align='left'):
"""Set the Curse align"""
if align in ('left', 'right', 'bottom'):
self.align = align
else:
self.align = 'left'
def set_curse_line(self, line):
"""Set the Curse line
Enter -1 to right align
"""
self.line_curse = line
def get_align(self):
"""Get the Curse align"""
return self.align
def auto_unit(self, number, low_precision=False):
"""Make a nice human-readable string out of number.
......
......@@ -37,12 +37,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 1
# Enter -1 to diplay bottom
self.line_curse = 2
# Note: 'glances_processes' is already init in the glances_processes.py script
......
......@@ -41,12 +41,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 1
# Enter -1 to diplay bottom
self.line_curse = 4
# Note: 'glances_processes' is already init in the glances_processes.py script
......
......@@ -57,12 +57,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 5
# Init the stats
self.reset()
......
......@@ -56,12 +56,6 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = 0
# Enter -1 to diplay bottom
self.line_curse = 0
# Init the stats
self.reset()
......
......@@ -45,12 +45,10 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Set the message position
# It is NOT the curse position but the Glances column/line
# Enter -1 to right align
self.column_curse = -1
# Enter -1 to diplay bottom
self.line_curse = 0
self.set_align('right')
# Init the stats
self.reset()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册