当前位置: 首页>>代码示例>>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;未经允许,请勿转载。