本文整理汇总了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()
示例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)
示例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])