当前位置: 首页>>代码示例>>Python>>正文


Python Paths.getSublimeMenuPath方法代码示例

本文整理汇总了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
开发者ID:goolic,项目名称:Deviot,代码行数:15,代码来源:Menu.py

示例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)
开发者ID:BadgerAAV,项目名称:Deviot,代码行数:18,代码来源:Tools.py

示例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()
开发者ID:goolic,项目名称:Deviot,代码行数:20,代码来源:Menu.py

示例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()
开发者ID:goolic,项目名称:Deviot,代码行数:46,代码来源:Menu.py


注:本文中的libs.Paths.getSublimeMenuPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。