Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrinux committed Oct 2, 2018
1 parent 8083a35 commit ac81ced
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 23 deletions.
38 changes: 21 additions & 17 deletions py3status/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,18 +904,20 @@ 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)
output_modules[name]['short_format'] = self.mappings_short_format.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)
output_modules[name]['short_format'] = self.mappings_short_format.get(name)

self.output_modules = output_modules

Expand All @@ -933,25 +935,27 @@ def create_mappings(self, config):
color = None
mappings[name] = color

max_size = self.get_config_attribute(name, 'max_size')
if hasattr(max_size, 'none_setting'):
max_size = None
mappings[name] = max_size
short_format = self.get_config_attribute(name, 'short_format')
if hasattr(short_format, 'none_setting'):
short_format = None
mappings[name] = short_format

# Store mappings for later use.
self.mappings_max_size = mappings
self.mappings_color = mappings
self.mappings_short_format = mappings

def process_module_output(self, module):
"""
Process the output for a module and return a json string representing it.
Color processing occurs here.
Shortened text 'short_text' 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']
short_format = module['short_format']

for output in outputs:
if color:
# Color: substitute the config defined color
if "color" not in output:
output["color"] = color
Expand Down
6 changes: 1 addition & 5 deletions py3status/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,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")
Expand All @@ -660,9 +659,6 @@ def deprecation_log(item):
self.allow_urgent = param

# max_size
# get the value form the config or use the module default if
# supplied.
fn = self._py3_wrapper.get_config_attribute
param = fn(self.module_full_name, 'max_size')
if hasattr(param, 'none_setting'):
param = True
Expand Down
3 changes: 2 additions & 1 deletion py3status/modules/wwan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ skip_missing_interpreters = True
[testenv]
skip_install = True
deps =
coverage
pytest
pytest-flake8
commands =
pytest --flake8
coverage erase
coverage run --omit=**/__init__.py --source=modules -m py.test
coverage report

[testenv:py36]
skip_install = True
Expand Down

0 comments on commit ac81ced

Please sign in to comment.