提交 84a40237 编写于 作者: N Nicolargo

Use the one_line method

上级 37c2d757
......@@ -130,6 +130,14 @@ class GlancesAmp(object):
"""Return refresh time in seconds for the current application monitoring process."""
return self.get('refresh')
def one_line(self):
"""Return True|False if the AMP shoukd be displayed in oneline (one_lineline=true|false)."""
ret = self.get('one_line')
if ret is None:
return False
else:
return ret.lower().startswith('true')
def time_until_refresh(self):
"""Return time in seconds until refresh."""
return self.timer.get()
......
......@@ -81,7 +81,7 @@ class Amp(GlancesAmp):
req = requests.get(self.get('status_url'))
if req.ok:
# u'Active connections: 1 \nserver accepts handled requests\n 1 1 1 \nReading: 0 Writing: 1 Waiting: 0 \n'
if self.get('one_line') is not None and self.get('one_line').lower() == 'true':
if self.one_line():
self.set_result(req.text.replace('\n', ''))
else:
self.set_result(req.text)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册