當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。