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


Python Paths.getPresetPath方法代碼示例

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


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

示例1: endSetup

# 需要導入模塊: from libs import Paths [as 別名]
# 或者: from libs.Paths import getPresetPath [as 別名]
    def endSetup(self):
        # get pio version
        executable = os.path.join(self.env_bin_dir, 'pio')
        cmd = ['\"' + executable + '\"', '--version']
        out = childProcess(cmd)

        pio_version = match(r"\w+\W \w+ (.+)", out[1]).group(1)
        self.Preferences.set('pio_version', pio_version)

        # save env paths
        env_path = [self.env_bin_dir]
        self.saveEnvPaths(env_path)

        # copy menu
        sys_os = Tools.getOsName()
        preset_path = Paths.getPresetPath()
        plg_path = Paths.getPluginPath()
        dst = os.path.join(plg_path, 'Settings-Default', 'Main.sublime-menu')

        if(sys_os == 'windows'):
            src_path = os.path.join(preset_path, 'Main.sublime-menu.windows')
            copy(src_path, dst)
        elif(sys_os == 'osx'):
            src_path = os.path.join(preset_path, 'Main.sublime-menu.osx')
            copy(src_path, dst)
        else:
            src_path = os.path.join(preset_path, 'Main.sublime-menu.linux')
            copy(src_path, dst)

        # creating files (menu, completions, syntax)
        generateFiles()
開發者ID:ikthap,項目名稱:Deviot,代碼行數:33,代碼來源:Install.py

示例2: endSetup

# 需要導入模塊: from libs import Paths [as 別名]
# 或者: from libs.Paths import getPresetPath [as 別名]
    def endSetup(self):
        try:
            from .PlatformioCLI import generateFiles
        except:
            from libs.PlatformioCLI import generateFiles

        # save env paths
        if(self.os != 'osx'):
            env_path = [self.env_bin_dir]
            self.saveEnvPaths(env_path)

        # get pio version
        if(self.os == 'osx'):
            executable = os.path.join(self.env_bin_dir, 'python')
            cmd = ['"%s"' % (executable), '-m', 'platformio', '--version']
        else:
            executable = os.path.join(self.env_bin_dir, 'pio')
            cmd = ['"%s"' % (executable), '--version']
        out = childProcess(cmd)

        pio_version = match(r"\w+\W \w+ (.+)", out[1]).group(1)
        self.Preferences.set('pio_version', pio_version)

        # copy menu
        sys_os = Tools.getOsName()
        preset_path = Paths.getPresetPath()
        plg_path = Paths.getPluginPath()
        dst = os.path.join(plg_path, 'Settings-Default', 'Main.sublime-menu')

        if(sys_os == 'windows'):
            if(platform.release() == '7'):
                src_path = os.path.join(preset_path, 'Main.sublime-menu.w7')
            else:    
                src_path = os.path.join(preset_path, 'Main.sublime-menu.windows')
            copy(src_path, dst)
        elif(sys_os == 'osx'):
            src_path = os.path.join(preset_path, 'Main.sublime-menu.osx')
            copy(src_path, dst)
        else:
            src_path = os.path.join(preset_path, 'Main.sublime-menu.linux')
            copy(src_path, dst)

        # creating files (menu, completions, syntax)
        sublime.set_timeout(generateFiles, 0)

        self.Preferences.set('protected', True)
        self.Preferences.set('enable_menu', True)
開發者ID:ashgan-dev,項目名稱:Deviot,代碼行數:49,代碼來源:Install.py

示例3: createSketch

# 需要導入模塊: from libs import Paths [as 別名]
# 或者: from libs.Paths import getPresetPath [as 別名]
def createSketch(sketch_name, path):
    try:
        from . import Paths
        from .Preferences import Preferences
    except:
        from libs import Paths
        from libs.Preferences import Preferences

    # file path
    sketch_path = os.path.join(path, sketch_name)
    if not os.path.exists(sketch_path):
        os.makedirs(sketch_path)

    # use cpp file/template intead of ino
    cpp = Preferences().get('use_cpp', False)
    if cpp:
        ext = '.cpp'
    else:
        ext = '.ino'

    # get template
    template_file_name = 'template' + ext
    preset_path = Paths.getPresetPath()
    template_file_path = os.path.join(preset_path, template_file_name)
    with open(template_file_path) as file:
        src_code = file.read()
    src_file_name = sketch_name + ext
    src_file_path = os.path.join(sketch_path, src_file_name)

    # save new file
    with open(src_file_path, 'w') as src_file:
        src_code = src_code.replace('${src_file_name}', src_file_name)
        src_file.write(src_code)

    # open new file
    window = sublime.active_window()
    view = window.open_file(src_file_path)
    views.append(view)
    if views:
        window.focus_view(views[0])
開發者ID:BadgerAAV,項目名稱:Deviot,代碼行數:42,代碼來源:Tools.py


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