From d98a998c2a32076abcda7c61b1b3a98214adb51b Mon Sep 17 00:00:00 2001 From: Robert Sacks Date: Tue, 30 May 2017 04:33:53 -0400 Subject: [PATCH 1/3] Added publicip module --- bumblebee/modules/publicip.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 bumblebee/modules/publicip.py diff --git a/bumblebee/modules/publicip.py b/bumblebee/modules/publicip.py new file mode 100644 index 0000000..d792662 --- /dev/null +++ b/bumblebee/modules/publicip.py @@ -0,0 +1,33 @@ +"""Displays public IP address + +Parameter: + * Test + * Test +""" + +try: + from urllib2 import urlopen +except ImportError: + pass + +import bumblebee.output +import bumblebee.engine + +class Module(bumblebee.engine.Module): + def __init__(self, engine, config): + super(Module, self).__init__(engine, config, + bumblebee.output.Widget(full_text=self.public_ip) + ) + + self._ip = "" + + + def public_ip(self, widget): + return self._ip + + def update(self, widgets): + try: + self._ip = urlopen("http://ip.42.pl/raw").read() + except Exception: + self._ip = "Not Connected" + From 892f78e42bb6e112dc57c28f6956e8e61b5de1ad Mon Sep 17 00:00:00 2001 From: Robert Sacks Date: Tue, 30 May 2017 04:34:28 -0400 Subject: [PATCH 2/3] Added prefix icon to publicip --- themes/icons/awesome-fonts.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index d65a72e..907b3f6 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -99,5 +99,8 @@ }, "spotify": { "prefix": "  " + }, + "publicip": { + "prefix": "  " } } From c57ddc48fe5c46e2d42d6bab79eb82dfbdd4fb83 Mon Sep 17 00:00:00 2001 From: Robert Sacks Date: Tue, 30 May 2017 04:49:58 -0400 Subject: [PATCH 3/3] Removed unwanted comments in publicip module --- bumblebee/modules/publicip.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bumblebee/modules/publicip.py b/bumblebee/modules/publicip.py index d792662..bb2f4ab 100644 --- a/bumblebee/modules/publicip.py +++ b/bumblebee/modules/publicip.py @@ -1,8 +1,5 @@ """Displays public IP address -Parameter: - * Test - * Test """ try: