Fix bad-whitespace errors found by pylint
This commit is contained in:
parent
7af57c7fc4
commit
57204a215e
23 changed files with 66 additions and 66 deletions
|
@ -39,7 +39,7 @@ class Module(object):
|
||||||
self.id = self.name
|
self.id = self.name
|
||||||
|
|
||||||
self._configFile = None
|
self._configFile = None
|
||||||
for cfg in [ os.path.expanduser("~/.bumblebee-status.conf"), os.path.expanduser("~/.config/bumblebee-status.conf") ]:
|
for cfg in [os.path.expanduser("~/.bumblebee-status.conf"), os.path.expanduser("~/.config/bumblebee-status.conf")]:
|
||||||
if os.path.exists(cfg):
|
if os.path.exists(cfg):
|
||||||
self._configFile = RawConfigParser()
|
self._configFile = RawConfigParser()
|
||||||
self._configFile.read(cfg)
|
self._configFile.read(cfg)
|
||||||
|
@ -138,11 +138,11 @@ class Engine(object):
|
||||||
|
|
||||||
def _register_module_callbacks(self, module):
|
def _register_module_callbacks(self, module):
|
||||||
buttons = [
|
buttons = [
|
||||||
{ "name": "left-click", "id": bumblebee.input.LEFT_MOUSE },
|
{"name": "left-click", "id": bumblebee.input.LEFT_MOUSE},
|
||||||
{ "name": "middle-click", "id": bumblebee.input.MIDDLE_MOUSE },
|
{"name": "middle-click", "id": bumblebee.input.MIDDLE_MOUSE},
|
||||||
{ "name": "right-click", "id": bumblebee.input.RIGHT_MOUSE },
|
{"name": "right-click", "id": bumblebee.input.RIGHT_MOUSE},
|
||||||
{ "name": "wheel-up", "id": bumblebee.input.WHEEL_UP },
|
{"name": "wheel-up", "id": bumblebee.input.WHEEL_UP},
|
||||||
{ "name": "wheel-down", "id": bumblebee.input.WHEEL_DOWN },
|
{"name": "wheel-down", "id": bumblebee.input.WHEEL_DOWN},
|
||||||
]
|
]
|
||||||
for button in buttons:
|
for button in buttons:
|
||||||
if module.parameter(button["name"], None):
|
if module.parameter(button["name"], None):
|
||||||
|
|
|
@ -137,6 +137,6 @@ class I3BarInput(object):
|
||||||
except Exception:
|
except Exception:
|
||||||
# fall back to global default
|
# fall back to global default
|
||||||
if not "__fallback" in event:
|
if not "__fallback" in event:
|
||||||
return self.callback({ "name": None, "instance": None, "__fallback": True, "button": event["button"] })
|
return self.callback({"name": None, "instance": None, "__fallback": True, "button": event["button"]})
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
|
@ -38,5 +38,5 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
if self._muted:
|
if self._muted:
|
||||||
return [ "warning", "muted" ]
|
return ["warning", "muted"]
|
||||||
return [ "unmuted" ]
|
return ["unmuted"]
|
||||||
|
|
|
@ -30,9 +30,9 @@ class Module(bumblebee.engine.Module):
|
||||||
if self._batteries[0] == "auto":
|
if self._batteries[0] == "auto":
|
||||||
self._batteries = glob.glob("/sys/class/power_supply/BAT*")
|
self._batteries = glob.glob("/sys/class/power_supply/BAT*")
|
||||||
else:
|
else:
|
||||||
self._batteries = [ "/sys/class/power_supply/{}".format(b) for b in self._batteries ]
|
self._batteries = ["/sys/class/power_supply/{}".format(b) for b in self._batteries]
|
||||||
if len(self._batteries) == 0:
|
if len(self._batteries) == 0:
|
||||||
self._batteries = [ "/sys/class/power_supply/BAT0" ]
|
self._batteries = ["/sys/class/power_supply/BAT0"]
|
||||||
self.update(widgets)
|
self.update(widgets)
|
||||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||||
cmd="gnome-power-statistics")
|
cmd="gnome-power-statistics")
|
||||||
|
@ -108,7 +108,7 @@ class Module(bumblebee.engine.Module):
|
||||||
with open("{}/status".format(widget.name)) as f:
|
with open("{}/status".format(widget.name)) as f:
|
||||||
charge = f.read().strip()
|
charge = f.read().strip()
|
||||||
if charge == "Discharging":
|
if charge == "Discharging":
|
||||||
state.append("discharging-{}".format(min([10, 25, 50, 80, 100] , key=lambda i:abs(i-capacity))))
|
state.append("discharging-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity))))
|
||||||
else:
|
else:
|
||||||
if capacity > 95:
|
if capacity > 95:
|
||||||
state.append("charged")
|
state.append("charged")
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Module(bumblebee.engine.Module):
|
||||||
backlight = int(f.readline())
|
backlight = int(f.readline())
|
||||||
with open("{}/max_brightness".format(self._device_path)) as f:
|
with open("{}/max_brightness".format(self._device_path)) as f:
|
||||||
max_brightness = int(f.readline())
|
max_brightness = int(f.readline())
|
||||||
self._brightness=float(backlight*100/max_brightness)
|
self._brightness = float(backlight*100/max_brightness)
|
||||||
except:
|
except:
|
||||||
return "Error"
|
return "Error"
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Module(bumblebee.engine.Module):
|
||||||
return returns.get(widget.name, self._status)
|
return returns.get(widget.name, self._status)
|
||||||
|
|
||||||
def _eval_line(self, line):
|
def _eval_line(self, line):
|
||||||
name, key, value = (line.split(" ", 2) + [None, None])[:3]
|
name, key, value = (line.split(" ", 2) + [None, None])[:3]
|
||||||
|
|
||||||
if name == "status":
|
if name == "status":
|
||||||
self._status = key
|
self._status = key
|
||||||
|
|
|
@ -16,7 +16,7 @@ import datetime
|
||||||
import locale
|
import locale
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
|
|
||||||
ALIASES = [ "date", "time" ]
|
ALIASES = ["date", "time"]
|
||||||
|
|
||||||
def default_format(module):
|
def default_format(module):
|
||||||
default = "%x %X"
|
default = "%x %X"
|
||||||
|
|
|
@ -50,11 +50,11 @@ class Module(bumblebee.engine.Module):
|
||||||
spercent = self.has_parameter("showPercent")
|
spercent = self.has_parameter("showPercent")
|
||||||
|
|
||||||
if all(not param for param in (sused, ssize, spercent)):
|
if all(not param for param in (sused, ssize, spercent)):
|
||||||
return self._format.format(path = self._path,
|
return self._format.format(path=self._path,
|
||||||
used = used_str,
|
used=used_str,
|
||||||
left = left_str,
|
left=left_str,
|
||||||
size = size_str,
|
size=size_str,
|
||||||
percent = percent_str)
|
percent=percent_str)
|
||||||
else:
|
else:
|
||||||
rv = ""
|
rv = ""
|
||||||
sused = bumblebee.util.asbool(self.parameter("showUsed", True))
|
sused = bumblebee.util.asbool(self.parameter("showUsed", True))
|
||||||
|
|
|
@ -20,7 +20,7 @@ import bumblebee.input
|
||||||
import bumblebee.output
|
import bumblebee.output
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
def getfromkrak(coin,currency):
|
def getfromkrak(coin, currency):
|
||||||
abbrev = {
|
abbrev = {
|
||||||
"Btc": ["xbt", "XXBTZ"],
|
"Btc": ["xbt", "XXBTZ"],
|
||||||
"Eth": ["eth", "XETHZ"],
|
"Eth": ["eth", "XETHZ"],
|
||||||
|
@ -63,11 +63,11 @@ class Module(bumblebee.engine.Module):
|
||||||
currency = self._getcur
|
currency = self._getcur
|
||||||
btcprice, ethprice, ltcprice = "", "", ""
|
btcprice, ethprice, ltcprice = "", "", ""
|
||||||
if self._getbtc:
|
if self._getbtc:
|
||||||
btcprice= getfromkrak('Btc',currency)
|
btcprice = getfromkrak('Btc', currency)
|
||||||
if self._geteth:
|
if self._geteth:
|
||||||
ethprice=getfromkrak('Eth',currency)
|
ethprice = getfromkrak('Eth', currency)
|
||||||
if self._getltc:
|
if self._getltc:
|
||||||
ltcprice=getfromkrak('Ltc',currency)
|
ltcprice = getfromkrak('Ltc', currency)
|
||||||
self._curprice = btcprice+" "*(self._getbtc*self._geteth)+ethprice+" "*(self._getltc*max(self._getbtc, self._geteth))+ltcprice
|
self._curprice = btcprice+" "*(self._getbtc*self._geteth)+ethprice+" "*(self._getltc*max(self._getbtc, self._geteth))+ltcprice
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Module(bumblebee.engine.Module):
|
||||||
#@scrollable
|
#@scrollable
|
||||||
def description(self, widget):
|
def description(self, widget):
|
||||||
if self._running == 1:
|
if self._running == 1:
|
||||||
display = self._status + ": " + self._artist + " - " + self._title + " | " + self._position + "/" + self._duration
|
display = self._status + ": " + self._artist + " - " + self._title + " | " + self._position + "/" + self._duration
|
||||||
else:
|
else:
|
||||||
display = "Music On Console Player"
|
display = "Music On Console Player"
|
||||||
return display
|
return display
|
||||||
|
@ -53,7 +53,7 @@ class Module(bumblebee.engine.Module):
|
||||||
self._artist = line.split(": ", 2)[1]
|
self._artist = line.split(": ", 2)[1]
|
||||||
if line.startswith("Title:"):
|
if line.startswith("Title:"):
|
||||||
self._title = line.split(": ", 2)[1]
|
self._title = line.split(": ", 2)[1]
|
||||||
self._title = self._title.split("(by ",2)[0]
|
self._title = self._title.split("(by ", 2)[0]
|
||||||
if line.startswith("CurrentTime:"):
|
if line.startswith("CurrentTime:"):
|
||||||
self._position = line.split(": ", 2)[1]
|
self._position = line.split(": ", 2)[1]
|
||||||
if line.startswith("TotalTime:"):
|
if line.startswith("TotalTime:"):
|
||||||
|
|
|
@ -106,6 +106,6 @@ class Module(bumblebee.engine.Module):
|
||||||
self._shuffle = False
|
self._shuffle = False
|
||||||
if line.startswith("tag"):
|
if line.startswith("tag"):
|
||||||
key, value = line.split(" ", 2)[1:]
|
key, value = line.split(" ", 2)[1:]
|
||||||
self._tags.update({ key: value })
|
self._tags.update({key: value})
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Module(bumblebee.engine.Module):
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def _update_widgets(self, widgets):
|
def _update_widgets(self, widgets):
|
||||||
interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ]
|
interfaces = [i for i in netifaces.interfaces() if not i.startswith(self._exclude)]
|
||||||
|
|
||||||
for widget in widgets:
|
for widget in widgets:
|
||||||
widget.set("visited", False)
|
widget.set("visited", False)
|
||||||
|
|
|
@ -11,14 +11,14 @@ import bumblebee.output
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
|
|
||||||
class Module(bumblebee.engine.Module):
|
class Module(bumblebee.engine.Module):
|
||||||
def __init__(self,engine,config):
|
def __init__(self, engine, config):
|
||||||
super(Module,self).__init__(engine,config,bumblebee.output.Widget(full_text=self.utilization))
|
super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.utilization))
|
||||||
self._utilization = "Not found: 0 0/0"
|
self._utilization = "Not found: 0 0/0"
|
||||||
|
|
||||||
def utilization(self,widget):
|
def utilization(self, widget):
|
||||||
return self._utilization
|
return self._utilization
|
||||||
|
|
||||||
def update(self,widgets):
|
def update(self, widgets):
|
||||||
sp = subprocess.Popen(['nvidia-smi', '-q'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
sp = subprocess.Popen(['nvidia-smi', '-q'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
out_str = sp.communicate()
|
out_str = sp.communicate()
|
||||||
out_list = out_str[0].decode("utf-8").split('\n')
|
out_list = out_str[0].decode("utf-8").split('\n')
|
||||||
|
@ -43,4 +43,4 @@ class Module(bumblebee.engine.Module):
|
||||||
name = val
|
name = val
|
||||||
except:
|
except:
|
||||||
title = item.strip()
|
title = item.strip()
|
||||||
self._utilization = u"%s: %s°C %s/%s"%(name,temp,usedMem,totalMem)
|
self._utilization = u"%s: %s°C %s/%s"%(name, temp, usedMem, totalMem)
|
||||||
|
|
|
@ -47,12 +47,12 @@ class Module(bumblebee.engine.Module):
|
||||||
self._count = 0
|
self._count = 0
|
||||||
|
|
||||||
def updates(self, widget):
|
def updates(self, widget):
|
||||||
return '/'.join(map(lambda x: str(widget.get(x,0)), repos))
|
return '/'.join(map(lambda x: str(widget.get(x, 0)), repos))
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
path = os.path.dirname(os.path.abspath(__file__))
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
if self._count == 0:
|
if self._count == 0:
|
||||||
thread = threading.Thread(target=get_pacman_info, args=(widgets[0],path))
|
thread = threading.Thread(target=get_pacman_info, args=(widgets[0], path))
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
# TODO: improve this waiting mechanism a bit
|
# TODO: improve this waiting mechanism a bit
|
||||||
|
@ -60,7 +60,7 @@ class Module(bumblebee.engine.Module):
|
||||||
self._count = 0 if self._count > 300 else self._count
|
self._count = 0 if self._count > 300 else self._count
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
weightedCount = sum(map(lambda x: (len(repos)-x[0]) * widget.get(x[1],0), enumerate(repos)))
|
weightedCount = sum(map(lambda x: (len(repos)-x[0]) * widget.get(x[1], 0), enumerate(repos)))
|
||||||
|
|
||||||
if weightedCount < 10:
|
if weightedCount < 10:
|
||||||
return "good"
|
return "good"
|
||||||
|
|
|
@ -30,10 +30,10 @@ def get_rtt(module, widget):
|
||||||
))
|
))
|
||||||
|
|
||||||
for line in res.split("\n"):
|
for line in res.split("\n"):
|
||||||
if line.startswith( "{} packets transmitted".format( widget.get( "rtt-probes" ) ) ):
|
if line.startswith("{} packets transmitted".format(widget.get("rtt-probes"))):
|
||||||
m = re.search( r'(\d+)% packet loss', line )
|
m = re.search(r'(\d+)% packet loss', line)
|
||||||
|
|
||||||
widget.set( 'packet-loss', m.group(1) )
|
widget.set('packet-loss', m.group(1))
|
||||||
|
|
||||||
if not line.startswith("rtt"): continue
|
if not line.startswith("rtt"): continue
|
||||||
m = re.search(r'([0-9\.]+)/([0-9\.]+)/([0-9\.]+)/([0-9\.]+)\s+(\S+)', line)
|
m = re.search(r'([0-9\.]+)/([0-9\.]+)/([0-9\.]+)/([0-9\.]+)\s+(\S+)', line)
|
||||||
|
@ -67,7 +67,7 @@ class Module(bumblebee.engine.Module):
|
||||||
widget.get("address"),
|
widget.get("address"),
|
||||||
widget.get("rtt-avg"),
|
widget.get("rtt-avg"),
|
||||||
widget.get("rtt-unit"),
|
widget.get("rtt-unit"),
|
||||||
widget.get( 'packet-loss' )
|
widget.get('packet-loss')
|
||||||
)
|
)
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
|
@ -77,7 +77,7 @@ class Module(bumblebee.engine.Module):
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
if int(time.time()) < self._next_check:
|
if int(time.time()) < self._next_check:
|
||||||
return
|
return
|
||||||
thread = threading.Thread(target=get_rtt, args=(self,widgets[0],))
|
thread = threading.Thread(target=get_rtt, args=(self, widgets[0],))
|
||||||
thread.start()
|
thread.start()
|
||||||
self._next_check = int(time.time()) + int(widgets[0].get("interval"))
|
self._next_check = int(time.time()) + int(widgets[0].get("interval"))
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import bumblebee.input
|
||||||
import bumblebee.output
|
import bumblebee.output
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
|
|
||||||
ALIASES = [ "pasink", "pasource" ]
|
ALIASES = ["pasink", "pasource"]
|
||||||
|
|
||||||
class Module(bumblebee.engine.Module):
|
class Module(bumblebee.engine.Module):
|
||||||
def __init__(self, engine, config):
|
def __init__(self, engine, config):
|
||||||
|
@ -38,17 +38,17 @@ class Module(bumblebee.engine.Module):
|
||||||
channel = "sink" if self.name == "pasink" else "source"
|
channel = "sink" if self.name == "pasink" else "source"
|
||||||
|
|
||||||
self._patterns = [
|
self._patterns = [
|
||||||
{ "expr": "name:", "callback": (lambda line: False) },
|
{"expr": "name:", "callback": (lambda line: False)},
|
||||||
{ "expr": "muted:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True)) },
|
{"expr": "muted:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True))},
|
||||||
{ "expr": "volume:", "callback": self.getvolume },
|
{"expr": "volume:", "callback": self.getvolume},
|
||||||
]
|
]
|
||||||
|
|
||||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol")
|
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol")
|
||||||
|
|
||||||
events = [
|
events = [
|
||||||
{ "type": "mute", "action": "toggle", "button": bumblebee.input.LEFT_MOUSE },
|
{"type": "mute", "action": "toggle", "button": bumblebee.input.LEFT_MOUSE},
|
||||||
{ "type": "volume", "action": "+2%", "button": bumblebee.input.WHEEL_UP },
|
{"type": "volume", "action": "+2%", "button": bumblebee.input.WHEEL_UP},
|
||||||
{ "type": "volume", "action": "-2%", "button": bumblebee.input.WHEEL_DOWN },
|
{"type": "volume", "action": "-2%", "button": bumblebee.input.WHEEL_DOWN},
|
||||||
]
|
]
|
||||||
|
|
||||||
for event in events:
|
for event in events:
|
||||||
|
@ -120,7 +120,7 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
if self._mute:
|
if self._mute:
|
||||||
return [ "warning", "muted" ]
|
return ["warning", "muted"]
|
||||||
return [ "unmuted" ]
|
return ["unmuted"]
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
|
@ -46,14 +46,14 @@ class Module(bumblebee.engine.Module):
|
||||||
log.debug("retrieved temperature from 'sensors -u'")
|
log.debug("retrieved temperature from 'sensors -u'")
|
||||||
return temperature
|
return temperature
|
||||||
|
|
||||||
def get_mhz( self ):
|
def get_mhz(self):
|
||||||
try:
|
try:
|
||||||
output = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq").read()
|
output = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq").read()
|
||||||
mhz = int(float(output)/1000.0)
|
mhz = int(float(output)/1000.0)
|
||||||
except:
|
except:
|
||||||
output = open("/proc/cpuinfo").read()
|
output = open("/proc/cpuinfo").read()
|
||||||
m = re.search(r"cpu MHz\s+:\s+(\d+)", output)
|
m = re.search(r"cpu MHz\s+:\s+(\d+)", output)
|
||||||
mhz = int(m.group(1))
|
mhz = int(m.group(1))
|
||||||
|
|
||||||
if mhz < 1000:
|
if mhz < 1000:
|
||||||
return "{} MHz".format(mhz)
|
return "{} MHz".format(mhz)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Module(bumblebee.engine.Module):
|
||||||
self._song = ""
|
self._song = ""
|
||||||
self._format = self.parameter("format", "{artist} - {title}")
|
self._format = self.parameter("format", "{artist} - {title}")
|
||||||
|
|
||||||
cmd="dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify \
|
cmd = "dbus-send --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify \
|
||||||
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player."
|
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player."
|
||||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||||
cmd=cmd + "Previous")
|
cmd=cmd + "Previous")
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
|
|
||||||
ALIASES = [ "test-alias" ]
|
ALIASES = ["test-alias"]
|
||||||
|
|
||||||
class Module(bumblebee.engine.Module):
|
class Module(bumblebee.engine.Module):
|
||||||
def __init__(self, engine, config):
|
def __init__(self, engine, config):
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
|
|
||||||
def state(self, widgets):
|
def state(self, widgets):
|
||||||
if self._todos == 0 :
|
if self._todos == 0:
|
||||||
return "empty"
|
return "empty"
|
||||||
return "items"
|
return "items"
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ class Module(bumblebee.engine.Module):
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
def _update_widgets(self, widgets):
|
def _update_widgets(self, widgets):
|
||||||
interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ]
|
interfaces = [i for i in netifaces.interfaces() if not i.startswith(self._exclude)]
|
||||||
|
|
||||||
del widgets[:]
|
del widgets[:]
|
||||||
|
|
||||||
|
|
|
@ -60,22 +60,22 @@ class Module(bumblebee.engine.Module):
|
||||||
return u"?"
|
return u"?"
|
||||||
return self.city() + self.temperature()
|
return self.city() + self.temperature()
|
||||||
|
|
||||||
def state( self, widget ):
|
def state(self, widget):
|
||||||
if self._valid:
|
if self._valid:
|
||||||
if "thunderstorm" in self._weather:
|
if "thunderstorm" in self._weather:
|
||||||
return [ 'thunder' ]
|
return ['thunder']
|
||||||
elif "drizzle" in self._weather:
|
elif "drizzle" in self._weather:
|
||||||
return [ 'rain' ]
|
return ['rain']
|
||||||
elif "rain" in self._weather:
|
elif "rain" in self._weather:
|
||||||
return [ 'rain' ]
|
return ['rain']
|
||||||
elif "snow" in self._weather:
|
elif "snow" in self._weather:
|
||||||
return [ 'snow' ]
|
return ['snow']
|
||||||
elif "sleet" in self._weather:
|
elif "sleet" in self._weather:
|
||||||
return [ 'sleet' ]
|
return ['sleet']
|
||||||
elif "clear" in self._weather:
|
elif "clear" in self._weather:
|
||||||
return [ 'clear' ]
|
return ['clear']
|
||||||
elif "cloud" in self._weather:
|
elif "cloud" in self._weather:
|
||||||
return [ 'clouds' ]
|
return ['clouds']
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ def execute(cmd, wait=True):
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def bytefmt(num):
|
def bytefmt(num):
|
||||||
for unit in [ "", "Ki", "Mi", "Gi" ]:
|
for unit in ["", "Ki", "Mi", "Gi"]:
|
||||||
if num < 1024.0:
|
if num < 1024.0:
|
||||||
return "{:.2f}{}B".format(num, unit)
|
return "{:.2f}{}B".format(num, unit)
|
||||||
num /= 1024.0
|
num /= 1024.0
|
||||||
|
|
Loading…
Reference in a new issue