當前位置: 首頁>>代碼示例>>Python>>正文


Python Tools.updateMenuLibs方法代碼示例

本文整理匯總了Python中libs.Tools.updateMenuLibs方法的典型用法代碼示例。如果您正苦於以下問題:Python Tools.updateMenuLibs方法的具體用法?Python Tools.updateMenuLibs怎麽用?Python Tools.updateMenuLibs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libs.Tools的用法示例。


在下文中一共展示了Tools.updateMenuLibs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: removeLibrary

# 需要導入模塊: from libs import Tools [as 別名]
# 或者: from libs.Tools import updateMenuLibs [as 別名]
    def removeLibrary(self, selected):
        """
        Run a CLI command with the ID of the library to uninstall,
        also remove the reference of the ID in the preferences file.

        Arguments:
            selected {int}
                position of the option selected in the quick panel.
        """
        list = self.getLibrary('quick_list.json')
        lib_id = list[selected][2]
        lib_name = list[selected][0]

        self.message_queue.startPrint()
        self.message_queue.put('[ Deviot {0} ]\\n', version)
        time.sleep(0.01)

        # uninstall Library with CLI
        command = ['lib', 'uninstall', lib_id]
        self.Commands.runCommand(command, extra_message=lib_name)

        # remove from preferences
        if (not self.Commands.error_running):
            installed = self.Preferences.get('user_libraries', '')
            if(installed):
                if(lib_id in installed):
                    self.Preferences.data.setdefault(
                        'user_libraries', []).remove(lib_id)
                    self.Preferences.saveData()

        # update menu
        Tools.updateMenuLibs()
開發者ID:BadgerAAV,項目名稱:Deviot,代碼行數:34,代碼來源:Libraries.py

示例2: installLibrary

# 需要導入模塊: from libs import Tools [as 別名]
# 或者: from libs.Tools import updateMenuLibs [as 別名]
    def installLibrary(self, selected):
        """
        Install the selected library

        Arguments:
            selected {int}
                position in dict of the library selected
        """
        list = self.getLibrary('quick_list.json')
        lib_id = list[selected][2]
        lib_name = list[selected][0]

        self.message_queue.startPrint()
        self.message_queue.put('[ Deviot {0} ]\\n', version)
        time.sleep(0.01)

        # Install Library with CLI
        command = ['lib', 'install', lib_id]
        self.Commands.runCommand(command, extra_message=lib_name)

        # update list of libraries installed in the preference file
        self.getInstalledList(ids=True)
        # update menu
        Tools.updateMenuLibs()
開發者ID:BadgerAAV,項目名稱:Deviot,代碼行數:26,代碼來源:Libraries.py


注:本文中的libs.Tools.updateMenuLibs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。