Merge pull request #191 from fredj/pylint
Fix various errors found by pylint
This commit is contained in:
commit
863f87a570
30 changed files with 77 additions and 95 deletions
|
@ -87,7 +87,7 @@ class Config(bumblebee.store.Store):
|
|||
def theme(self):
|
||||
"""Return the name of the selected theme"""
|
||||
return self._args.theme
|
||||
|
||||
|
||||
def debug(self):
|
||||
return self._args.debug
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""Core application engine"""
|
||||
|
||||
import os
|
||||
import time
|
||||
import pkgutil
|
||||
import logging
|
||||
import importlib
|
||||
|
@ -39,7 +38,7 @@ class Module(object):
|
|||
self.id = self.name
|
||||
|
||||
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):
|
||||
self._configFile = RawConfigParser()
|
||||
self._configFile.read(cfg)
|
||||
|
@ -138,11 +137,11 @@ class Engine(object):
|
|||
|
||||
def _register_module_callbacks(self, module):
|
||||
buttons = [
|
||||
{ "name": "left-click", "id": bumblebee.input.LEFT_MOUSE },
|
||||
{ "name": "middle-click", "id": bumblebee.input.MIDDLE_MOUSE },
|
||||
{ "name": "right-click", "id": bumblebee.input.RIGHT_MOUSE },
|
||||
{ "name": "wheel-up", "id": bumblebee.input.WHEEL_UP },
|
||||
{ "name": "wheel-down", "id": bumblebee.input.WHEEL_DOWN },
|
||||
{"name": "left-click", "id": bumblebee.input.LEFT_MOUSE},
|
||||
{"name": "middle-click", "id": bumblebee.input.MIDDLE_MOUSE},
|
||||
{"name": "right-click", "id": bumblebee.input.RIGHT_MOUSE},
|
||||
{"name": "wheel-up", "id": bumblebee.input.WHEEL_UP},
|
||||
{"name": "wheel-down", "id": bumblebee.input.WHEEL_DOWN},
|
||||
]
|
||||
for button in buttons:
|
||||
if module.parameter(button["name"], None):
|
||||
|
|
|
@ -137,6 +137,6 @@ class I3BarInput(object):
|
|||
except Exception:
|
||||
# fall back to global default
|
||||
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
|
||||
|
|
|
@ -38,5 +38,5 @@ class Module(bumblebee.engine.Module):
|
|||
|
||||
def state(self, widget):
|
||||
if self._muted:
|
||||
return [ "warning", "muted" ]
|
||||
return [ "unmuted" ]
|
||||
return ["warning", "muted"]
|
||||
return ["unmuted"]
|
||||
|
|
|
@ -30,9 +30,9 @@ class Module(bumblebee.engine.Module):
|
|||
if self._batteries[0] == "auto":
|
||||
self._batteries = glob.glob("/sys/class/power_supply/BAT*")
|
||||
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:
|
||||
self._batteries = [ "/sys/class/power_supply/BAT0" ]
|
||||
self._batteries = ["/sys/class/power_supply/BAT0"]
|
||||
self.update(widgets)
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd="gnome-power-statistics")
|
||||
|
@ -108,7 +108,7 @@ class Module(bumblebee.engine.Module):
|
|||
with open("{}/status".format(widget.name)) as f:
|
||||
charge = f.read().strip()
|
||||
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:
|
||||
if capacity > 95:
|
||||
state.append("charged")
|
||||
|
|
|
@ -39,7 +39,7 @@ class Module(bumblebee.engine.Module):
|
|||
backlight = int(f.readline())
|
||||
with open("{}/max_brightness".format(self._device_path)) as f:
|
||||
max_brightness = int(f.readline())
|
||||
self._brightness=float(backlight*100/max_brightness)
|
||||
self._brightness = float(backlight*100/max_brightness)
|
||||
except:
|
||||
return "Error"
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class Module(bumblebee.engine.Module):
|
|||
return returns.get(widget.name, self._status)
|
||||
|
||||
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":
|
||||
self._status = key
|
||||
|
|
|
@ -24,7 +24,6 @@ import json
|
|||
import time
|
||||
try:
|
||||
import requests
|
||||
from requests.exceptions import RequestException
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import datetime
|
|||
import locale
|
||||
import bumblebee.engine
|
||||
|
||||
ALIASES = [ "date", "time" ]
|
||||
ALIASES = ["date", "time"]
|
||||
|
||||
def default_format(module):
|
||||
default = "%x %X"
|
||||
|
|
|
@ -50,11 +50,11 @@ class Module(bumblebee.engine.Module):
|
|||
spercent = self.has_parameter("showPercent")
|
||||
|
||||
if all(not param for param in (sused, ssize, spercent)):
|
||||
return self._format.format(path = self._path,
|
||||
used = used_str,
|
||||
left = left_str,
|
||||
size = size_str,
|
||||
percent = percent_str)
|
||||
return self._format.format(path=self._path,
|
||||
used=used_str,
|
||||
left=left_str,
|
||||
size=size_str,
|
||||
percent=percent_str)
|
||||
else:
|
||||
rv = ""
|
||||
sused = bumblebee.util.asbool(self.parameter("showUsed", True))
|
||||
|
|
|
@ -20,7 +20,7 @@ import bumblebee.input
|
|||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
from requests.exceptions import RequestException
|
||||
def getfromkrak(coin,currency):
|
||||
def getfromkrak(coin, currency):
|
||||
abbrev = {
|
||||
"Btc": ["xbt", "XXBTZ"],
|
||||
"Eth": ["eth", "XETHZ"],
|
||||
|
@ -63,11 +63,11 @@ class Module(bumblebee.engine.Module):
|
|||
currency = self._getcur
|
||||
btcprice, ethprice, ltcprice = "", "", ""
|
||||
if self._getbtc:
|
||||
btcprice= getfromkrak('Btc',currency)
|
||||
btcprice = getfromkrak('Btc', currency)
|
||||
if self._geteth:
|
||||
ethprice=getfromkrak('Eth',currency)
|
||||
ethprice = getfromkrak('Eth', currency)
|
||||
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
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -6,8 +6,6 @@ Requires the following executable:
|
|||
* gpmdp-remote
|
||||
"""
|
||||
|
||||
import string
|
||||
|
||||
import bumblebee.util
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
|
|
|
@ -10,10 +10,6 @@ Parameters:
|
|||
* mocp.format: Format string for the song information. Tag values can be put in curly brackets (i.e. {artist})
|
||||
"""
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
import string
|
||||
|
||||
import bumblebee.util
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
|
@ -35,7 +31,7 @@ class Module(bumblebee.engine.Module):
|
|||
#@scrollable
|
||||
def description(self, widget):
|
||||
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:
|
||||
display = "Music On Console Player"
|
||||
return display
|
||||
|
@ -53,7 +49,7 @@ class Module(bumblebee.engine.Module):
|
|||
self._artist = line.split(": ", 2)[1]
|
||||
if line.startswith("Title:"):
|
||||
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:"):
|
||||
self._position = line.split(": ", 2)[1]
|
||||
if line.startswith("TotalTime:"):
|
||||
|
|
|
@ -106,6 +106,6 @@ class Module(bumblebee.engine.Module):
|
|||
self._shuffle = False
|
||||
if line.startswith("tag"):
|
||||
key, value = line.split(" ", 2)[1:]
|
||||
self._tags.update({ key: value })
|
||||
self._tags.update({key: value})
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -72,7 +72,7 @@ class Module(bumblebee.engine.Module):
|
|||
return retval
|
||||
|
||||
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:
|
||||
widget.set("visited", False)
|
||||
|
|
|
@ -11,14 +11,14 @@ 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.utilization))
|
||||
def __init__(self, engine, config):
|
||||
super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.utilization))
|
||||
self._utilization = "Not found: 0 0/0"
|
||||
|
||||
def utilization(self,widget):
|
||||
def utilization(self, widget):
|
||||
return self._utilization
|
||||
|
||||
def update(self,widgets):
|
||||
def update(self, widgets):
|
||||
sp = subprocess.Popen(['nvidia-smi', '-q'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out_str = sp.communicate()
|
||||
out_list = out_str[0].decode("utf-8").split('\n')
|
||||
|
@ -43,4 +43,4 @@ class Module(bumblebee.engine.Module):
|
|||
name = val
|
||||
except:
|
||||
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,20 +47,20 @@ class Module(bumblebee.engine.Module):
|
|||
self._count = 0
|
||||
|
||||
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):
|
||||
path = os.path.dirname(os.path.abspath(__file__))
|
||||
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()
|
||||
|
||||
|
||||
# TODO: improve this waiting mechanism a bit
|
||||
self._count += 1
|
||||
self._count = 0 if self._count > 300 else self._count
|
||||
|
||||
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:
|
||||
return "good"
|
||||
|
|
|
@ -30,10 +30,10 @@ def get_rtt(module, widget):
|
|||
))
|
||||
|
||||
for line in res.split("\n"):
|
||||
if line.startswith( "{} packets transmitted".format( widget.get( "rtt-probes" ) ) ):
|
||||
m = re.search( r'(\d+)% packet loss', line )
|
||||
if line.startswith("{} packets transmitted".format(widget.get("rtt-probes"))):
|
||||
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
|
||||
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("rtt-avg"),
|
||||
widget.get("rtt-unit"),
|
||||
widget.get( 'packet-loss' )
|
||||
widget.get('packet-loss')
|
||||
)
|
||||
|
||||
def state(self, widget):
|
||||
|
@ -77,7 +77,7 @@ class Module(bumblebee.engine.Module):
|
|||
def update(self, widgets):
|
||||
if int(time.time()) < self._next_check:
|
||||
return
|
||||
thread = threading.Thread(target=get_rtt, args=(self,widgets[0],))
|
||||
thread = threading.Thread(target=get_rtt, args=(self, widgets[0],))
|
||||
thread.start()
|
||||
self._next_check = int(time.time()) + int(widgets[0].get("interval"))
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Requires the following python packages:
|
|||
* requests
|
||||
|
||||
Parameters:
|
||||
* publicip.region: us-central (default), us-east, us-west, uk, de, pl, nl
|
||||
* publicip.region: us-central (default), us-east, us-west, uk, de, pl, nl
|
||||
* publicip.service: web address that returns plaintext ip address (ex. "http://l2.io/ip")
|
||||
"""
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Module(bumblebee.engine.Module):
|
|||
super(Module, self).__init__(engine, config,
|
||||
bumblebee.output.Widget(full_text=self.public_ip)
|
||||
)
|
||||
self._avail_regions = {"us-east":"http://l2.io/ip",
|
||||
self._avail_regions = {"us-east":"http://l2.io/ip",
|
||||
"us-central":"http://whatismyip.akamai.com",
|
||||
"us-west":"http://ipv4bot.whatismyipaddress.com",
|
||||
"pl":"http://ip.42.pl/raw",
|
||||
|
@ -45,4 +45,3 @@ class Module(bumblebee.engine.Module):
|
|||
self._ip = get(self.address).text.rstrip()
|
||||
except Exception:
|
||||
self._ip = "No Connection"
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import bumblebee.input
|
|||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
||||
ALIASES = [ "pasink", "pasource" ]
|
||||
ALIASES = ["pasink", "pasource"]
|
||||
|
||||
class Module(bumblebee.engine.Module):
|
||||
def __init__(self, engine, config):
|
||||
|
@ -38,17 +38,17 @@ class Module(bumblebee.engine.Module):
|
|||
channel = "sink" if self.name == "pasink" else "source"
|
||||
|
||||
self._patterns = [
|
||||
{ "expr": "name:", "callback": (lambda line: False) },
|
||||
{ "expr": "muted:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True)) },
|
||||
{ "expr": "volume:", "callback": self.getvolume },
|
||||
{"expr": "name:", "callback": (lambda line: False)},
|
||||
{"expr": "muted:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True))},
|
||||
{"expr": "volume:", "callback": self.getvolume},
|
||||
]
|
||||
|
||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol")
|
||||
|
||||
events = [
|
||||
{ "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_DOWN },
|
||||
{"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_DOWN},
|
||||
]
|
||||
|
||||
for event in events:
|
||||
|
@ -120,7 +120,7 @@ class Module(bumblebee.engine.Module):
|
|||
|
||||
def state(self, widget):
|
||||
if self._mute:
|
||||
return [ "warning", "muted" ]
|
||||
return [ "unmuted" ]
|
||||
return ["warning", "muted"]
|
||||
return ["unmuted"]
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
|
@ -6,10 +6,6 @@ Requires the following executable:
|
|||
* xrandr
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import bumblebee.util
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
|
|
|
@ -46,14 +46,14 @@ class Module(bumblebee.engine.Module):
|
|||
log.debug("retrieved temperature from 'sensors -u'")
|
||||
return temperature
|
||||
|
||||
def get_mhz( self ):
|
||||
def get_mhz(self):
|
||||
try:
|
||||
output = open("/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq").read()
|
||||
mhz = int(float(output)/1000.0)
|
||||
except:
|
||||
output = open("/proc/cpuinfo").read()
|
||||
m = re.search(r"cpu MHz\s+:\s+(\d+)", output)
|
||||
mhz = int(m.group(1))
|
||||
m = re.search(r"cpu MHz\s+:\s+(\d+)", output)
|
||||
mhz = int(m.group(1))
|
||||
|
||||
if mhz < 1000:
|
||||
return "{} MHz".format(mhz)
|
||||
|
|
|
@ -28,7 +28,7 @@ class Module(bumblebee.engine.Module):
|
|||
self._song = ""
|
||||
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."
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd=cmd + "Previous")
|
||||
|
|
|
@ -18,7 +18,6 @@ import bumblebee.engine
|
|||
import bumblebee.util
|
||||
|
||||
import requests
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
class Module(bumblebee.engine.Module):
|
||||
def __init__(self, engine, config):
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import bumblebee.engine
|
||||
|
||||
ALIASES = [ "test-alias" ]
|
||||
ALIASES = ["test-alias"]
|
||||
|
||||
class Module(bumblebee.engine.Module):
|
||||
def __init__(self, engine, config):
|
||||
|
|
|
@ -6,8 +6,6 @@ Parameters:
|
|||
* todo.file: File to read TODOs from (defaults to ~/Documents/todo.txt)
|
||||
"""
|
||||
|
||||
import platform
|
||||
|
||||
import bumblebee.input
|
||||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
@ -15,24 +13,24 @@ 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.output)
|
||||
)
|
||||
self._todos = self.count_items()
|
||||
self._todos = self.count_items()
|
||||
|
||||
|
||||
def output(self, widget):
|
||||
self._todos = self.count_items()
|
||||
return str(self._todos)
|
||||
|
||||
|
||||
|
||||
def state(self, widgets):
|
||||
if self._todos == 0 :
|
||||
if self._todos == 0:
|
||||
return "empty"
|
||||
return "items"
|
||||
|
||||
|
||||
|
||||
def count_items(filename):
|
||||
try:
|
||||
|
@ -41,7 +39,7 @@ class Module(bumblebee.engine.Module):
|
|||
with open(doc) as f:
|
||||
for i, l in enumerate(f):
|
||||
pass
|
||||
return i+1
|
||||
return i+1
|
||||
except Exception:
|
||||
return 0
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ Parameters:
|
|||
* traffic.showname: If set to False, hide network interface name (defaults to True)
|
||||
"""
|
||||
|
||||
import re
|
||||
import psutil
|
||||
import netifaces
|
||||
|
||||
|
@ -67,7 +66,7 @@ class Module(bumblebee.engine.Module):
|
|||
return retval
|
||||
|
||||
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[:]
|
||||
|
||||
|
@ -87,7 +86,7 @@ class Module(bumblebee.engine.Module):
|
|||
}
|
||||
|
||||
name = "traffic-{}".format(interface)
|
||||
|
||||
|
||||
if self._showname:
|
||||
self.create_widget(widgets, name, interface)
|
||||
|
||||
|
|
|
@ -60,22 +60,22 @@ class Module(bumblebee.engine.Module):
|
|||
return u"?"
|
||||
return self.city() + self.temperature()
|
||||
|
||||
def state( self, widget ):
|
||||
def state(self, widget):
|
||||
if self._valid:
|
||||
if "thunderstorm" in self._weather:
|
||||
return [ 'thunder' ]
|
||||
return ['thunder']
|
||||
elif "drizzle" in self._weather:
|
||||
return [ 'rain' ]
|
||||
return ['rain']
|
||||
elif "rain" in self._weather:
|
||||
return [ 'rain' ]
|
||||
return ['rain']
|
||||
elif "snow" in self._weather:
|
||||
return [ 'snow' ]
|
||||
return ['snow']
|
||||
elif "sleet" in self._weather:
|
||||
return [ 'sleet' ]
|
||||
return ['sleet']
|
||||
elif "clear" in self._weather:
|
||||
return [ 'clear' ]
|
||||
return ['clear']
|
||||
elif "cloud" in self._weather:
|
||||
return [ 'clouds' ]
|
||||
return ['clouds']
|
||||
else:
|
||||
return []
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class Module(bumblebee.engine.Module):
|
|||
last_neighbor = next((widget for widget in reversed(self.widgets()) if widget.get("state") == "on"), None)
|
||||
|
||||
neighbor = first_neighbor if event["button"] == bumblebee.input.LEFT_MOUSE else last_neighbor
|
||||
|
||||
|
||||
if neighbor == None:
|
||||
bumblebee.util.execute("{} --output {} --auto".format(toggle_cmd, widget.name))
|
||||
else:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import shlex
|
||||
import datetime
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
|
@ -40,7 +39,7 @@ def execute(cmd, wait=True):
|
|||
return rv
|
||||
|
||||
def bytefmt(num):
|
||||
for unit in [ "", "Ki", "Mi", "Gi" ]:
|
||||
for unit in ["", "Ki", "Mi", "Gi"]:
|
||||
if num < 1024.0:
|
||||
return "{:.2f}{}B".format(num, unit)
|
||||
num /= 1024.0
|
||||
|
|
Loading…
Reference in a new issue