本文整理匯總了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()
示例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()