Update modules to a7583a9

Not updated for various reasons:
clock,
dpms,
gpu_temp,
load,
mail,
mem_bar,
modsde,
net_speed,
pianobar,
pulseaudio,
regex [no named formatters],
runwatch,
shell,
solaar,
temp,
text,
updates,
weather,
whosonlocation,
xkblayout,
zabbix


This might break something: I can't test all these modules. If it does,
file a bug / open a PR / send me a note.
This commit is contained in:
enkore 2016-01-27 19:53:33 +01:00
parent a7583a9786
commit 612b8b07eb
33 changed files with 43 additions and 10 deletions

View File

@ -92,6 +92,7 @@ class ALSA(IntervalModule):
else:
output_format = self.format
self.data = fdict
self.output = {
"full_text": output_format.format(**self.fdict),
"color": self.color_muted if muted else self.color,

View File

@ -313,6 +313,7 @@ class BatteryChecker(IntervalModule):
fdict["status"] = self.status[fdict["status"]]
self.data = fdict
self.output = {
"full_text": formatp(self.format, **fdict),
"instance": self.battery_ident,

View File

@ -120,6 +120,7 @@ class Bitcoin(IntervalModule):
else:
fdict["last_tx_type"] = "sent"
self.data = fdict
self.output = {
"full_text": self.format.format(**fdict),
"color": color,

View File

@ -95,10 +95,12 @@ class Cmus(IntervalModule):
filename = os.path.basename(fdict['file'])
filebase, _ = os.path.splitext(filename)
fdict['artist'], fdict['title'] = _extract_artist_title(filebase)
self.data = fdict
self.output = {"full_text": formatp(self.format, **fdict),
"color": self.color}
else:
if hasattr(self, "data"): del self.data
self.output = {"full_text": self.format_not_running,
"color": self.color_not_running}

View File

@ -112,7 +112,7 @@ class KeyConstraintDict(collections.UserDict):
def __delitem__(self, key):
self.seen_keys.remove(key)
del self.data[key]
if hasattr(self, "data"): del self.data[key]
def __iter__(self):
"""Iteration will raise a MissingKeys exception unless all required keys are set

View File

@ -43,6 +43,7 @@ class CpuFreq(IntervalModule):
def run(self):
cdict = self.createvaluesdict()
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": self.color,

View File

@ -118,6 +118,7 @@ class CpuUsage(IntervalModule):
# for backward compatibility
usage['usage'] = usage['usage_cpu']
self.data = usage
self.output = {
"full_text": self.format.format_map(usage),
"color": self.color

View File

@ -55,6 +55,7 @@ class CpuUsageBar(CpuUsage, ColorRangeModule):
# for backward compatibility
cpu_usage['usage_bar'] = cpu_usage['usage_bar_cpu']
self.data = cpu_usage
self.output = {
"full_text": self.format.format_map(cpu_usage),
'color': self.get_gradient(cpu_usage[self.cpu], self.colors, 100)

View File

@ -50,6 +50,7 @@ class CpuUsageGraph(CpuUsage, ColorRangeModule):
format_options.update({'cpu_graph': graph})
color = self.get_gradient(core_reading, self.colors)
self.data = format_options
self.output = {
"full_text": self.format.format_map(format_options),
'color': color

View File

@ -77,6 +77,7 @@ class Disk(IntervalModule):
}
round_dict(cdict, self.round_size)
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": self.critical_color if critical else self.color,

View File

@ -104,6 +104,7 @@ class Dota2wins(IntervalModule):
"win_percent": win_percent,
}
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": color

View File

@ -45,6 +45,7 @@ class File(IntervalModule):
for key, transform in self.transforms.items():
cdict[key] = transform(cdict)
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": self.color

View File

@ -57,6 +57,7 @@ class Github(IntervalModule):
format_values['unread_count'] = unread
format_values['unread'] = self.unread_marker
self.data = format_values
self.output = {
'full_text': self.format.format(**format_values),
'color': self.color

View File

@ -62,6 +62,7 @@ class GPUMemory(IntervalModule):
if value is not None:
cdict[key] = round(value, self.round_size)
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": color

View File

@ -76,6 +76,7 @@ class IINet(IntervalModule, ColorRangeModule):
usage['percent_used'] = '{0:.2f}%'.format(percent_used)
usage['percent_available'] = '{0:.2f}%'.format(percent_avaliable)
self.data = usage
self.output = {
"full_text": self.format.format(**usage),
"color": color

View File

@ -35,7 +35,7 @@ class Keyboard_locks(IntervalModule):
scroll_on = "SCR"
scroll_off = "___"
color = "#FFFFFF"
fdict = {}
data = {}
def get_status(self):
xset = str(subprocess.check_output(["xset", "q"]))
@ -46,13 +46,13 @@ class Keyboard_locks(IntervalModule):
def run(self):
(cap, num, scr) = self.get_status()
self.fdict["caps"] = self.caps_on if cap else self.caps_off
self.fdict["num"] = self.num_on if num else self.num_off
self.fdict["scroll"] = self.scroll_on if scr else self.scroll_off
self.data["caps"] = self.caps_on if cap else self.caps_off
self.data["num"] = self.num_on if num else self.num_off
self.data["scroll"] = self.scroll_on if scr else self.scroll_off
output_format = self.format
self.output = {
"full_text": output_format.format(**self.fdict),
"full_text": output_format.format(**self.data),
"color": self.color,
}

View File

@ -38,6 +38,7 @@ class MakeWatch(IntervalModule):
"status": status
}
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": color

View File

@ -61,6 +61,7 @@ class Mem(IntervalModule):
}
round_dict(cdict, self.round_size)
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": color

View File

@ -105,6 +105,7 @@ class MoonPhase(IntervalModule):
"status": self.status[self.current_phase()],
"illum": self.illum(),
}
self.data = fdict
self.output = {
"full_text": formatp(self.format, **fdict),
"color": self.color[self.current_phase()],

View File

@ -91,7 +91,8 @@ class MPD(IntervalModule):
self.output = {
"full_text": ""
}
return
if hasattr(self, "data"): del self.data
return
fdict = {
"pos": int(status.get("song", 0)) + 1,
@ -118,6 +119,7 @@ class MPD(IntervalModule):
if len(fdict[key]) > self.max_field_len:
fdict[key] = fdict[key][:self.max_field_len - 1] + ""
self.data = fdict
full_text = formatp(self.format, **fdict).strip()
full_text_len = len(full_text)
if full_text_len > self.max_len and self.max_len > 0:
@ -128,7 +130,6 @@ class MPD(IntervalModule):
fdict[key] = fdict[key][:shrink] + ""
full_text = formatp(self.format, **fdict).strip()
self.output = {
"full_text": full_text,
"color": self.color,

View File

@ -393,6 +393,7 @@ class Network(IntervalModule, ColorRangeModule):
format_values.update(network_info)
format_values['interface'] = self.interface
self.data = format_values
self.output = {
"full_text": format_str.format(**format_values),
'color': color,

View File

@ -113,6 +113,7 @@ class NowPlaying(IntervalModule):
fdict["filename"] = '.'.join(
basename((currentsong.get("xesam:url") or "")).split('.')[:-1])
self.data = fdict
self.output = {
"full_text": formatp(self.format, **fdict).strip(),
"color": self.color,
@ -126,6 +127,7 @@ class NowPlaying(IntervalModule):
"full_text": self.format_no_player,
"color": self.color_no_player,
}
if hasattr(self, "data"): del self.data
return
except dbus.exceptions.DBusException as e:
@ -136,6 +138,7 @@ class NowPlaying(IntervalModule):
"full_text": "DBus error: " + e.get_dbus_message(),
"color": "#ff0000",
}
if hasattr(self, "data"): del self.data
return
def playpause(self):

View File

@ -60,6 +60,7 @@ class Openstack_vms(IntervalModule):
"nonactive_servers": nonactive_servers,
}
self.data = cdict
self.output = {
"full_text": self.format.format(**cdict),
"color": display_color

View File

@ -55,6 +55,7 @@ class OpenVPN(IntervalModule):
vpn_name = self.vpn_name
label = self.label
self.data = locals()
self.output = {
"full_text": self.format.format(**locals()),
'color': color,

View File

@ -162,6 +162,7 @@ class ParcelTracker(IntervalModule):
}
fdict.update(self.instance.status())
self.data = fdict
self.output = {
"full_text": self.format.format(**fdict).strip(),
"instance": self.name,

View File

@ -50,6 +50,7 @@ class Plexstatus(IntervalModule):
except AttributeError:
pass
self.data = cdict
if not cdict['title'] or not cdict['platform']:
self.output = {} if not self.format_no_streams else {
"full_text": self.format_no_stream,

View File

@ -85,7 +85,7 @@ class Pomodoro(IntervalModule):
'current_pomodoro': self.breaks,
'total_pomodoro': self.short_break_count + 1,
}
self.data = sdict
self.output = {
'full_text': self.format.format(**sdict),
'color': color

View File

@ -81,6 +81,7 @@ class pyLoad(IntervalModule):
"free_space": self._rpc_call("freeSpace") / (1024 ** 3),
}
self.data = fdict
self.output = {
"full_text": self.format.format(**fdict).strip(),
"instance": self.address,

View File

@ -97,6 +97,7 @@ class Reddit(IntervalModule):
else:
color = self.color
self.data = fdict
full_text = self.format.format(**fdict)
self.output = {
"full_text": full_text,

View File

@ -49,6 +49,7 @@ class SGETracker(IntervalModule):
"running": jobs['r']
}
self.data = fdict
self.output = {
"full_text": self.format.format(**fdict).strip(),
"color": self.color

View File

@ -87,6 +87,7 @@ class Spotify(IntervalModule):
'artist': response.get('artist', ''),
'length': response.get('length', 0),
}
self.data = fdict
self.output = {"full_text": formatp(self.format, **fdict),
"color": self.color}
@ -94,6 +95,7 @@ class Spotify(IntervalModule):
except:
self.output = {"full_text": self.format_not_running,
"color": self.color_not_running}
if hasattr(self, "data"): del self.data
def playpause(self):
"""Pauses and plays spotify"""

View File

@ -30,6 +30,7 @@ class Uname(Module):
"version": uname_result.version,
"machine": uname_result.machine,
}
self.data = fdict
self.output = {
"full_text": self.format.format(**fdict),
}

View File

@ -54,7 +54,7 @@ class Uptime(IntervalModule):
"secs": seconds,
"uptime": "{}:{}".format(hours, minutes),
}
self.data = fdict
if self.alert:
if seconds > self.seconds_alert:
self.color = self.color_alert