Exemplo n.º 1
0
    def load(self, path, file = 'conf.py'):
#         curpath = os.path.curdir
        with util.indir(path):
#             try:
            d = {}
            execfile(file, {}, d)
            d = self.filter_all(d)
#             finally:
#                 os.chdir(curpath)
            for k in self.options:
                if k not in d:
                    raise Exception('Could not find a value for required option: %s' % k)
        return d
Exemplo n.º 2
0
    def on_switch_in(self):
        if self.game:
            self.prioritary_plugins.remove(self.game)
            self.game.integrated = False
            self.game.enabled = True
            self.game = None

    def add_plugin(self, (name, module_name, enabled, integrated, prioritary), reload=False):
        module = util.resolve(module_name, reload=reload)
        loc = os.path.join(self.loc, name)
        try:
            os.makedirs(loc)
        except (IOError, OSError):
            pass
        cls = module.__fluostart__
        with util.indir(loc):
            inst = cls(self, name, loc)
        inst.integrated = integrated
        inst.enabled = enabled
        if prioritary:
            self.prioritary_plugins.append(inst)
        else:
            self.normal_plugins.append(inst)
        self.plugins_map[name] = (module_name, enabled, integrated, prioritary, inst)

    def remove_plugin(self, plugin):
        try:
            module, enabled, integrated, prioritary, inst = self.plugins_map[plugin]
        except KeyError:
            return False
        del self.plugins_map[plugin]