diff --git a/docs/aoa/quicklook.rst b/docs/aoa/quicklook.rst index 3b2d0fa0..2dbd84ce 100644 --- a/docs/aoa/quicklook.rst +++ b/docs/aoa/quicklook.rst @@ -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 diff --git a/glances/outputs/glances_sparklines.py b/glances/outputs/glances_sparklines.py index 5bab8efd..2f925e55 100644 --- a/glances/outputs/glances_sparklines.py +++ b/glances/outputs/glances_sparklines.py @@ -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 diff --git a/optional-requirements.txt b/optional-requirements.txt index 97f0180a..00c7cf24 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -21,6 +21,7 @@ pystache pyzmq requests scandir; python_version < "3.5" +sparklines statsd wifi zeroconf==0.19.1; python_version < "3.0" diff --git a/setup.py b/setup.py index a6423655..0632627e 100755 --- a/setup.py +++ b/setup.py @@ -67,6 +67,7 @@ def get_install_extras_require(): 'raid': ['pymdstat'], 'smart': ['pySMART.smartx'], 'snmp': ['pysnmp'], + 'sparklines': ['sparklines'], 'web': ['bottle', 'requests'], 'wifi': ['wifi'] }