diff --git a/py3status/core.py b/py3status/core.py index f5761c8481..8421205a6f 100644 --- a/py3status/core.py +++ b/py3status/core.py @@ -904,18 +904,18 @@ def create_output_modules(self): for name in self.modules: if name not in output_modules: output_modules[name] = {} - output_modules[name]["position"] = positions.get(name, []) - output_modules[name]["module"] = self.modules[name] - output_modules[name]["type"] = "py3status" - output_modules[name]["color"] = self.mappings_color.get(name) + output_modules[name]['position'] = positions.get(name, []) + output_modules[name]['module'] = self.modules[name] + output_modules[name]['type'] = 'py3status' + output_modules[name]['color'] = self.mappings_color.get(name) # i3status modules for name in i3modules: if name not in output_modules: output_modules[name] = {} - output_modules[name]["position"] = positions.get(name, []) - output_modules[name]["module"] = i3modules[name] - output_modules[name]["type"] = "i3status" - output_modules[name]["color"] = self.mappings_color.get(name) + output_modules[name]['position'] = positions.get(name, []) + output_modules[name]['module'] = i3modules[name] + output_modules[name]['type'] = 'i3status' + output_modules[name]['color'] = self.mappings_color.get(name) self.output_modules = output_modules @@ -932,6 +932,7 @@ def create_mappings(self, config): if hasattr(color, "none_setting"): color = None mappings[name] = color + # Store mappings for later use. self.mappings_color = mappings @@ -940,13 +941,15 @@ def process_module_output(self, module): Process the output for a module and return a json string representing it. Color processing occurs here. """ - outputs = module["module"].get_latest() - color = module["color"] - if color: - for output in outputs: + outputs = module['module'].get_latest() + color = module['color'] + + for output in outputs: + if color: # Color: substitute the config defined color if "color" not in output: output["color"] = color + # Create the json string output. return ",".join([dumps(x) for x in outputs]) diff --git a/py3status/module.py b/py3status/module.py index 74a869a9e8..96d321037f 100644 --- a/py3status/module.py +++ b/py3status/module.py @@ -190,10 +190,11 @@ def error_output(self, message, method_affected=None): color = None error = { - "full_text": message, - "color": color, - "instance": self.module_inst, - "name": self.module_name, + 'full_text': message, + 'short_text': message, + 'color': color, + 'instance': self.module_inst, + 'name': self.module_name, } for method in self.methods.values(): if method_affected and method["method"] != method_affected: @@ -279,7 +280,7 @@ def set_updated(self): output.extend(data) else: # if the output is not 'valid' then don't add it. - if data.get("full_text") or "separator" in data: + if data.get('full_text') or data.get('short_text') or 'separator' in data: if self.testing: data["cached_until"] = method.get("cached_until") output.append(data) @@ -650,8 +651,7 @@ def deprecation_log(item): if not hasattr(self.module_class, "py3"): setattr(self.module_class, "py3", Py3(self)) - # allow_urgent - # get the value form the config or use the module default if + # get the value from the config or use the module default if # supplied. fn = self._py3_wrapper.get_config_attribute param = fn(self.module_full_name, "allow_urgent") @@ -659,6 +659,12 @@ def deprecation_log(item): param = True self.allow_urgent = param + # max_size + param = fn(self.module_full_name, 'max_size') + if hasattr(param, 'none_setting'): + param = True + self.max_size = param + # get the available methods for execution for method in sorted(dir(class_inst)): if method.startswith("_"): @@ -677,12 +683,16 @@ def deprecation_log(item): # the method_obj stores infos about each method # of this module. method_obj = { - "cached_until": time(), - "call_type": params_type, - "instance": None, - "last_output": {"name": method, "full_text": ""}, - "method": method, - "name": None, + 'cached_until': time(), + 'call_type': params_type, + 'instance': None, + 'last_output': { + 'name': method, + 'full_text': '', + 'short_text': '' + }, + 'method': method, + 'name': None } self.methods[method] = method_obj diff --git a/py3status/modules/wwan.py b/py3status/modules/wwan.py index 022bfc3147..6802b87ae6 100644 --- a/py3status/modules/wwan.py +++ b/py3status/modules/wwan.py @@ -563,7 +563,8 @@ def wwan(self): response = { 'cached_until': self.py3.time_in(self.cache_timeout), - 'full_text': self.py3.safe_format(self.format, wwan_data) + 'full_text': self.py3.safe_format(self.format, wwan_data), + 'short_text': self.py3.safe_format(self.short_format, wwan_data) } if urgent: response['urgent'] = True