mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 02:02:32 +03:00
Update sparkline with current %
This commit is contained in:
parent
a5b46a9db1
commit
f68da86493
@ -13,11 +13,12 @@ If the per CPU mode is on (by clicking the ``1`` key):
|
||||
.. image:: ../_static/quicklook-percpu.png
|
||||
|
||||
In the Curses/terminal interface, it is also possible to switch from bar to
|
||||
sparkline using 'S' hot key or --sparkline command line option. Please be
|
||||
aware that sparklines use the Glances history and will not be available
|
||||
if the history is disabled from the command line.
|
||||
sparkline using 'S' hot key or --sparkline command line option (nned the
|
||||
sparklines Python lib on your system). Please be aware that sparklines use
|
||||
the Glances history and will not be available if the history is disabled from
|
||||
the command line.
|
||||
|
||||
.. image:: ../_static/sparkline.png
|
||||
.. image:: ../_static/sparkline.png
|
||||
|
||||
.. note::
|
||||
Limit values can be overwritten in the configuration file under
|
||||
|
@ -27,13 +27,13 @@ sparklines_module = True
|
||||
try:
|
||||
from sparklines import sparklines
|
||||
except ImportError as e:
|
||||
logger.debug("Sparklines module not found ({})".format(e))
|
||||
logger.warning("Sparklines module not found ({})".format(e))
|
||||
sparklines_module = False
|
||||
|
||||
try:
|
||||
'\xe2\x96\x81'.decode('utf-8')
|
||||
except ImportError as e:
|
||||
logger.debug("UTF-8 for sparklines module not available".format(e))
|
||||
logger.warning("UTF-8 is mandatory for sparklines ({})".format(e))
|
||||
sparklines_module = False
|
||||
|
||||
|
||||
@ -88,4 +88,9 @@ class Sparkline(object):
|
||||
|
||||
def __str__(self):
|
||||
"""Return the sparkline."""
|
||||
return self.get()
|
||||
ret = self.get()
|
||||
if self.__with_text:
|
||||
percents_without_none = [x for x in self.percents if x is not None]
|
||||
if len(percents_without_none) > 0:
|
||||
ret = '{}{:5.1f}%'.format(ret, percents_without_none[-1])
|
||||
return ret
|
||||
|
@ -21,6 +21,7 @@ pystache
|
||||
pyzmq
|
||||
requests
|
||||
scandir; python_version < "3.5"
|
||||
sparklines
|
||||
statsd
|
||||
wifi
|
||||
zeroconf==0.19.1; python_version < "3.0"
|
||||
|
Loading…
Reference in New Issue
Block a user