コード例 #1
0
ファイル: command.py プロジェクト: hychen/lazyscripts
 def _ask_user_selectpool(self):
     conf = env.resource('config')
     lang = env.get_local()
     pools = conf.get_support_pools(distro.Distribution().name, distro.Distribution().version, lang)
     if len(pools) == 1:
         poolname = pools[0][0]
     else:
         poolname = gui.select_defaultpool(pools)
     self.conf.set_default(pool=poolname)
     self.conf.save()
     return poolname
コード例 #2
0
ファイル: console.py プロジェクト: hychen/lazyscripts
    def _build_scripts_index(self):
        root = env.resource_name('pools')
        contents = []
        for poolname in os.listdir(root):
            poolpath = os.path.join(root, poolname)
            pool = lzspool.ScriptsPool(poolpath)
            for cat, scripts in pool.scripts(None, env.get_local()).items():
                if not scripts: continue
                for script in scripts:
                    contents.append("%s/%s/%s - %s " % (poolname, cat, script.id, script.name))

        index_path = os.path.join(env.resource_name('caches'), 'SCRIPTS_INDEX')
        with open(index_path, 'w') as f:
            f.write("\n".join(contents+['']))
コード例 #3
0
ファイル: gtklib.py プロジェクト: hychen/lazyscripts
    def load_tree(self, list_store):
        self.download_scripts()
        lzs_loc = env.get_local()
        for category in self.pool.categories():
            tool_page = ToolPage()
            tool_page.title = self.pool.get_i18n('category', category, lzs_loc)
            tool_page.img = self.pool.get_iconpath(category)

            for script in self.pool.scripts(category, lzs_loc):
                tool = Tool (script, self.pool.recommand_script(category, script.id))
                tool_page.tools.append(tool)

            tool_page.get_widget()
            list_store.append( (tool_page.img, tool_page.title, tool_page) )
            self.all_tools.append(tool_page)
コード例 #4
0
ファイル: console.py プロジェクト: pombredanne/lazyscripts
    def _build_scripts_index(self):
        root = env.resource_name('pools')
        contents = []
        for poolname in os.listdir(root):
            poolpath = os.path.join(root, poolname)
            pool = lzspool.ScriptsPool(poolpath)
            for cat, scripts in pool.scripts(None, env.get_local()).items():
                if not scripts: continue
                for script in scripts:
                    contents.append("%s/%s/%s - %s " %
                                    (poolname, cat, script.id, script.name))

        index_path = os.path.join(env.resource_name('caches'), 'SCRIPTS_INDEX')
        with open(index_path, 'w') as f:
            f.write("\n".join(contents + ['']))
コード例 #5
0
ファイル: gtklib.py プロジェクト: pombredanne/lazyscripts
    def load_tree(self, list_store):
        self.download_scripts()
        lzs_loc = env.get_local()
        for category in self.pool.categories():
            tool_page = ToolPage()
            tool_page.title = self.pool.get_i18n('category', category, lzs_loc)
            tool_page.img = self.pool.get_iconpath(category)

            for script in self.pool.scripts(category, lzs_loc):
                tool = Tool(script,
                            self.pool.recommand_script(category, script.id))
                tool_page.tools.append(tool)

            tool_page.get_widget()
            list_store.append((tool_page.img, tool_page.title, tool_page))
            self.all_tools.append(tool_page)
コード例 #6
0
ファイル: gtklib.py プロジェクト: aminzai/lazyscripts
    def load_tree(self, list_store):
        self.download_scripts()
        lzs_loc = env.get_local()
        use_recommand = query_yes_no(_('gui.gtklib.toolpage.query_recommand'))
        for category in self.pool.categories():
            tool_page = ToolPage()
            tool_page.title = self.pool.get_i18n('category', category, lzs_loc)
            tool_page.img = self.pool.get_iconpath(category)


            for script in self.pool.scripts(category, lzs_loc):
                if use_recommand:
                    tool = Tool (script, category, self.pool.recommand_script(category, script.id))
                else:
                    tool = Tool (script, category, False)
                tool_page.tools.append(tool)

            tool_page.get_widget()
            list_store.append( (tool_page.img, tool_page.title, tool_page) )
            self.all_tools.append(tool_page)