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.
Picture

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/netusage.sh")

        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"
        else:
            val = round(val, 1)
            val = str(val) + " KB"

        return val

MyIndicator(1.5)

Skeleton:

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"

MyIndicator(1)

Project details


Download files

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

Source Distribution

panel-indicator-0.0.1.dev1.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

panel_indicator-0.0.1.dev1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file panel-indicator-0.0.1.dev1.tar.gz.

File metadata

  • Download URL: panel-indicator-0.0.1.dev1.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for panel-indicator-0.0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 3f0e20850c1cf53b6f0bf6ebe8d86bae7f4e3160acf0806c04ae624d344d82a1
MD5 e64a7b71f3d8a3bff776e39ee860600f
BLAKE2b-256 87370f09e6424748e55f22ce2dc10c3ac88a5656e6e93c7097573c0bfaa64f48

See more details on using hashes here.

File details

Details for the file panel_indicator-0.0.1.dev1-py3-none-any.whl.

File metadata

  • Download URL: panel_indicator-0.0.1.dev1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for panel_indicator-0.0.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 970e4d9f748b165356209f297b510b9820e0ffca279c7d70ba41ce34aff8c96b
MD5 e53180f1f25feb5ee3bc5c27380554ab
BLAKE2b-256 4776b62c25246f7085384e33d8ecae71ebd450b6b1a447a72cd58115d718d26e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page