mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-27 03:04:16 +03:00
Use the one_line method
This commit is contained in:
parent
37c2d75772
commit
84a40237db
@ -130,6 +130,14 @@ class GlancesAmp(object):
|
|||||||
"""Return refresh time in seconds for the current application monitoring process."""
|
"""Return refresh time in seconds for the current application monitoring process."""
|
||||||
return self.get('refresh')
|
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):
|
def time_until_refresh(self):
|
||||||
"""Return time in seconds until refresh."""
|
"""Return time in seconds until refresh."""
|
||||||
return self.timer.get()
|
return self.timer.get()
|
||||||
|
@ -81,7 +81,7 @@ class Amp(GlancesAmp):
|
|||||||
req = requests.get(self.get('status_url'))
|
req = requests.get(self.get('status_url'))
|
||||||
if req.ok:
|
if req.ok:
|
||||||
# u'Active connections: 1 \nserver accepts handled requests\n 1 1 1 \nReading: 0 Writing: 1 Waiting: 0 \n'
|
# 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', ''))
|
self.set_result(req.text.replace('\n', ''))
|
||||||
else:
|
else:
|
||||||
self.set_result(req.text)
|
self.set_result(req.text)
|
||||||
|
Loading…
Reference in New Issue
Block a user