예제 #1
0
    def load_tweaks(self, main_window):
        tweak_files = [
                os.path.splitext(os.path.split(f)[-1])[0]
                    for f in glob.glob(os.path.join(self._tweak_dir, "tweak_group_*.py"))]

        if not gtweak.ENABLE_TEST:
            try:
                tweak_files.remove("tweak_group_test")
            except ValueError:
                pass

        groups = []
        tweaks = []

        mods = __import__("gtweak.tweaks", globals(), locals(), tweak_files, 0)
        for mod in [getattr(mods, file_name) for file_name in tweak_files]:
            groups.extend( getattr(mod, "TWEAK_GROUPS", []))

        schemas = SchemaList()

        for g in groups:
            g.main_window = main_window
            if g.tweaks:
                self.add_tweak_group(g)
                for i in g.tweaks:
                    i.main_window = main_window
                    try:
                        schemas.insert(i.key_name, i.schema_name)
                    except:
                        pass
예제 #2
0
    def load_tweaks(self, main_window):
        tweak_files = [
            os.path.splitext(os.path.split(f)[-1])[0]
            for f in glob.glob(os.path.join(self._tweak_dir, "tweak_group_*.py"))
        ]

        if not gtweak.ENABLE_TEST:
            try:
                tweak_files.remove("tweak_group_test")
            except ValueError:
                pass

        groups = []
        tweaks = []

        mods = __import__("gtweak.tweaks", globals(), locals(), tweak_files, 0)
        for mod in [getattr(mods, file_name) for file_name in tweak_files]:
            groups.extend(getattr(mod, "TWEAK_GROUPS", []))

        schemas = SchemaList()

        for g in groups:
            g.main_window = main_window
            if g.tweaks:
                self.add_tweak_group(g)
                for i in g.tweaks:
                    i.main_window = main_window
                    try:
                        schemas.insert(i.key_name, i.schema_name)
                    except:
                        pass