Skip to main content

A library to display any text in ubuntu unity panel

Project description

Ubuntu Panel Indicator

This library can be used to print the output of any script in the ubuntu unity panel.

An example of internet donwload speed unity panel indicator built using this package.

from panel_indicator import PanelIndicator
import subprocess

class MyIndicator(PanelIndicator):
    """ abstract function(set_new_value) returns a string """
    """ update_interval in seconds """
    def __init__(self, update_interval):
        self.current_val = 0
        PanelIndicator.__init__(self, update_interval)

    def set_new_value(self):
        out, err = self.bash_script_runner("/home/ketankr9/bin/")

        old_val = self.current_val
        self.current_val = int(out.strip().decode('utf-8'))

        # convert bytes to megabytes
        val = (self.current_val*1.0 - old_val)/10**3
        val /= self.update_interval

        if val/10**3 >= 1.0:
            # convert megabytes to gigabytes
            val /= 10**3
            val = round(val, 1)
            val = str(val) + " MB"
            val = round(val, 1)
            val = str(val) + " KB"

        return val



from panel_indicator import PanelIndicator

class MyIndicator(PanelIndicator):
    def __init__(self, update_interval):
        PanelIndicator.__init__(self, update_interval)

    # runs after every 1 seconds
    def set_new_value(self):
        return "yayy"


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for panel-indicator, version 0.0.1.dev1
Filename, size File type Python version Upload date Hashes
Filename, size panel_indicator-0.0.1.dev1-py3-none-any.whl (3.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size panel-indicator-0.0.1.dev1.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page