def load_notifiers(self): """Loads all notifiers""" notifiers = self.config.get("general", "notifiers") if not notifiers: notifiers = ["x11", "tmux"] else: notifiers = [i.strip() for i in notifiers.split(",")] for id in notifiers: cls = recent.notifier.get_class(id) if not cls: continue config = {} for key in cls.config_keys: config[key] = self.config.get("general", id + "_" + key, "") deps = self.get_new_deps(cls.deps) if deps == None: continue for dep, dep_cls in deps.items(): self.deps[dep] = dep_cls(self) self.notifiers.append(cls(self, config))
def load_providers(self): """Loads and activates all configured providers""" for id in self.config.index(): type = self.config.get(id, "type") cls = recent.providers.get_class(type) if not cls: continue config = {} for key in cls.config_keys: config[key] = self.config.get(id, key, "") deps = self.get_new_deps(cls.deps) if deps == None: continue for dep, dep_cls in deps.items(): self.deps[dep] = dep_cls(self) self.providers[id] = cls(id, self, config) interval = self.config.get(id, "interval") if interval: if interval.isnumeric(): self.providers[id].interval = int(interval) elif interval in INTERVAL: self.providers[id].interval = INTERVAL[interval] self.active.append(self.providers[id]) self.providers[id]._activate()