[modules] Refactor module initialization

Modules now get an output and a complete config object. This should make
customization much easier in the future.
This commit is contained in:
Tobias Witek 2016-11-05 08:11:08 +01:00
parent c2adf38b92
commit 7f91b8298f
5 changed files with 46 additions and 31 deletions

View file

@ -12,10 +12,10 @@ def themes():
class Theme:
_cycle_index = 0
_cycle = None
def __init__(self, args):
def __init__(self, config):
self._data = None
path = os.path.dirname(os.path.realpath(__file__))
with open("{}/{}.json".format(getpath(), args.theme)) as f:
with open("{}/{}.json".format(getpath(), config.theme())) as f:
self._data = json.load(f)
self._defaults = self._data.get("defaults", {})
self._cycle = self._defaults.get("cycle", [])