From 353c47d76ef138a48fdc3986e10d3ebc341a6eda Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sat, 5 Nov 2016 12:18:30 +0100 Subject: [PATCH] [general] Very minor refactoring --- bumblebee/config.py | 11 +---------- bumblebee/theme.py | 4 ++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/bumblebee/config.py b/bumblebee/config.py index 43a1e93..381fef9 100644 --- a/bumblebee/config.py +++ b/bumblebee/config.py @@ -26,7 +26,6 @@ class print_usage(argparse.Action): def print_modules(self): for m in bumblebee.module.modules(): - print("{}{}: ".format(self._indent, m.name())) print textwrap.fill("About : {}".format(m.description()), 80, initial_indent=self._indent*2, subsequent_indent=self._indent*4) @@ -48,31 +47,23 @@ class Config(object): self._args = self._parser.parse_args(args) - def getstore(self, name, default=None): + def parameter(self, name, default=None): if not name in self._store: self._store[name] = default return self._store.get(name, default) - def store(self, name, value): - self._store[name] = value - def increase(self, name, limit, default): self._store[name] += 1 if self._store[name] >= limit: self._store[name] = default return self._store[name] - def parameter(self, name, default): - # TODO - return default - def theme(self): return self._args.theme def modules(self): return self._args.modules - def _parser(self): parser = argparse.ArgumentParser(description="display system data in the i3bar") parser.add_argument("-m", "--modules", nargs="+", diff --git a/bumblebee/theme.py b/bumblebee/theme.py index 90aeba4..f4baadb 100644 --- a/bumblebee/theme.py +++ b/bumblebee/theme.py @@ -19,7 +19,7 @@ class Theme: self.begin() def begin(self): - self._config.store("theme.cycleidx", 0) + self._config.parameter("theme.cycleidx", 0) self._cycle = self._cycles[0] if len(self._cycles) > 0 else {} self._background = [ None, None ] @@ -80,7 +80,7 @@ class Theme: if type(value) is list: key = "{}{}".format(repr(widget), value) - idx = self._config.getstore(key, 0) + idx = self._config.parameter(key, 0) self._config.increase(key, len(value), 0) value = value[idx]