本文整理汇总了Python中libs.Paths.getSublimeMenuPath方法的典型用法代码示例。如果您正苦于以下问题:Python Paths.getSublimeMenuPath方法的具体用法?Python Paths.getSublimeMenuPath怎么用?Python Paths.getSublimeMenuPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libs.Paths
的用法示例。
在下文中一共展示了Paths.getSublimeMenuPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getSublimeMenu
# 需要导入模块: from libs import Paths [as 别名]
# 或者: from libs.Paths import getSublimeMenuPath [as 别名]
def getSublimeMenu(self, user_path=False):
"""
Get the data of the different files that make up the main menu
Keyword Arguments:
user_path {boolean} -- True: get file from Packages/Deviot/Preset
--False: get file from Packages/User/Deviot/Preset
(Defaul:False)
"""
menu_path = Paths.getSublimeMenuPath(user_path)
menu_file = JSONFile(menu_path)
menu_data = menu_file.getData()
return menu_data
示例2: removePreferences
# 需要导入模块: from libs import Paths [as 别名]
# 或者: from libs.Paths import getSublimeMenuPath [as 别名]
def removePreferences():
from shutil import rmtree
try:
from . import Paths
except:
from libs import Paths
plug_path = Paths.getPluginPath()
dst = os.path.join(plug_path, 'Settings-Default', 'Main.sublime-menu')
user_path = Paths.getDeviotUserPath()
main_menu = Paths.getSublimeMenuPath()
# remove files
rmtree(user_path, ignore_errors=False)
os.remove(main_menu)
os.remove(dst)
示例3: saveSublimeMenu
# 需要导入模块: from libs import Paths [as 别名]
# 或者: from libs.Paths import getSublimeMenuPath [as 别名]
def saveSublimeMenu(self, data, sub_folder=False, user_path=False):
"""
Save the data in different files to make up the main menu
Arguments:
data {json} -- json st data to create the menu
Keyword Arguments:
sub_folder {string/bool} -- name of the sub folder to save the file
-- (default: False)
user_path {boolean} -- True: Save file in Packages/Deviot/Preset
-- False: Save file in Packages/User/Deviot/Preset
(Defaul:False)
"""
menu_file_path = Paths.getSublimeMenuPath(sub_folder, user_path)
file_menu = JSONFile(menu_file_path)
file_menu.setData(data)
file_menu.saveData()
示例4: createMainMenu
# 需要导入模块: from libs import Paths [as 别名]
# 或者: from libs.Paths import getSublimeMenuPath [as 别名]
def createMainMenu(self):
'''
Creates the main menu with the differents options
including boards, libraries, and user options.
'''
boards = self.createBoardsMenu()
if(not boards):
return False
menu_data = self.getTemplateMenu(file_name='menu_main.json')
# Main Menu
for first_menu in menu_data[0]:
for second_menu in menu_data[0][first_menu]:
if 'caption' in second_menu:
second_menu['caption'] = _(second_menu['caption'])
if 'children' in second_menu:
if(second_menu['id'] == 'select_board'):
second_menu['children'] = boards
# sub menu translation (avoiding the boards menu)
for third_menu in menu_data[0]['children']:
try:
for caption in third_menu['children']:
caption['caption'] = _(caption['caption'])
try:
for item in caption['children']:
item['caption'] = _(item['caption'])
except:
pass
except:
pass
self.saveSublimeMenu(data=menu_data)
env_path = Paths.getSublimeMenuPath(
'environment', user_path=True)
if(os.path.isfile(env_path)):
self.createEnvironmentMenu()
self.createLanguageMenu()