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: else:
output_format = self.format output_format = self.format
self.data = fdict
self.output = { self.output = {
"full_text": output_format.format(**self.fdict), "full_text": output_format.format(**self.fdict),
"color": self.color_muted if muted else self.color, "color": self.color_muted if muted else self.color,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -55,6 +55,7 @@ class CpuUsageBar(CpuUsage, ColorRangeModule):
# for backward compatibility # for backward compatibility
cpu_usage['usage_bar'] = cpu_usage['usage_bar_cpu'] cpu_usage['usage_bar'] = cpu_usage['usage_bar_cpu']
self.data = cpu_usage
self.output = { self.output = {
"full_text": self.format.format_map(cpu_usage), "full_text": self.format.format_map(cpu_usage),
'color': self.get_gradient(cpu_usage[self.cpu], self.colors, 100) '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}) format_options.update({'cpu_graph': graph})
color = self.get_gradient(core_reading, self.colors) color = self.get_gradient(core_reading, self.colors)
self.data = format_options
self.output = { self.output = {
"full_text": self.format.format_map(format_options), "full_text": self.format.format_map(format_options),
'color': color 'color': color

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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