本文整理汇总了Python中sublime_lib.path.root_at_packages函数的典型用法代码示例。如果您正苦于以下问题:Python root_at_packages函数的具体用法?Python root_at_packages怎么用?Python root_at_packages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了root_at_packages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_new
def create_new(self, name):
print("[NewPackage] Creating new package...")
print(root_at_packages(name))
if self.dry_run:
msg = "[NewPackage] ** Nothing done. This was a test. **"
print(msg)
status(msg)
return
# Create top folder, default folders, default files.
map(os.makedirs, [root_at_packages(name, d) for d in DEFAULT_DIRS])
for fname, template in DEFAULT_FILES:
with open(root_at_packages(name, fname), 'w') as fh:
if template:
try:
content = ("".join(open(template, 'r').readlines())
% {"package_name": name})
except:
pass
finally:
content = "".join(open(template, 'r').readlines())
fh.write(content)
msg = "[NewPackage] Created new package '%s'." % name
print(msg)
status(msg)
开发者ID:Adarma,项目名称:AAAPackageDev,代码行数:29,代码来源:package_dev.py
示例2: run
def run(self, edit):
self.view.settings().set('default_dir', root_at_packages('User'))
self.view.settings().set('syntax', JSON_TMLANGUAGE_SYNTAX)
with in_one_edit(self.view):
self.view.run_command('insert_snippet',
{'contents': get_syntax_def_boilerplate()})
开发者ID:40a,项目名称:Chocolatey-Packages,代码行数:7,代码来源:syntax_def_dev.py
示例3: run
def run(self):
v = self.window.new_file()
v.settings().set('default_dir', root_at_packages('User'))
v.set_syntax_file(BUILD_SYSTEM_SYNTAX)
v.set_name('untitled.sublime-build')
template = """{\n\t"cmd": ["${0:make}"]\n}"""
v.run_command("insert_snippet", {"contents": template})
开发者ID:40a,项目名称:Chocolatey-Packages,代码行数:8,代码来源:build_sys_dev.py
示例4: run
def run(self, edit):
ext = "%stmLanguage" % ('%s-' % self.typ.upper() if self.typ != 'plist' else '')
s = self.view.settings()
s.set('default_dir', root_at_packages('User'))
s.set('default_extension', ext)
s.set('syntax', self.lang or BASE_SYNTAX_LANGUAGE % self.typ.upper())
self.view.run_command('insert_snippet', {'contents': boilerplates[self.typ] % uuid.uuid4()})
开发者ID:billputer,项目名称:sublime-text-2-config,代码行数:9,代码来源:syntax_def_dev.py
示例5: run
def run(self, fmt="yaml"):
view = self.window.new_file()
ext = "%stmLanguage" % ("%s-" % fmt.upper() if fmt != "plist" else "")
s = view.settings()
s.set("default_dir", root_at_packages("User"))
s.set("default_extension", ext)
if fmt == "plist":
view.set_syntax_file(XML_SYNTAX_LANGUAGE)
else:
view.set_syntax_file(SYNTAX_LANGUAGE_TMPL % fmt.upper())
view.run_command("insert_snippet", {"contents": boilerplates[fmt] % uuid.uuid4()})
开发者ID:thecodechef,项目名称:PackageDev,代码行数:13,代码来源:syntax_def_dev.py
示例6: enumerate
DEFAULT_FILES = [
("LICENSE.txt", None),
("README.rst", "data/README.rst"),
(".hgignore", "data/hgignore.txt"),
(".gitignore", "data/gitignore.txt"),
("bin/MakeRelease.ps1", "data/MakeRelease.ps1"),
("bin/CleanUp.ps1", "data/CleanUp.ps1"),
("data/html_template.txt", "data/html_template.txt"),
("data/main.css", "data/main.css"),
("setup.py", "data/setup.py")
]
for i, (name, path) in enumerate(DEFAULT_FILES):
if path is not None:
DEFAULT_FILES[i] = (
os.path.join(*name.split("/")),
root_at_packages(PLUGIN_NAME, os.path.join(*path.split("/")))
)
class NewPackageCommand(sublime_plugin.WindowCommand):
def on_done(self, pkg_name):
pam = PackageManager()
if pam.exists(pkg_name):
error(" NewPackage -- Error\n\n"
" Package '" + pkg_name + "' already exists.\n"
" You cannot overwrite an existing package."
)
return
pam.create_new(pkg_name)
开发者ID:Adarma,项目名称:AAAPackageDev,代码行数:31,代码来源:package_dev.py
示例7: run
def run(self):
v = self.window.new_file()
v.run_command('insert_snippet', {'contents': tpl})
v.settings().set('default_dir', path.root_at_packages('User'))
v.set_syntax_file(SYNTAX_DEF)
开发者ID:simonzack,项目名称:AAAPackageDev,代码行数:5,代码来源:commands_file_dev.py
示例8: run
def run(self, edit):
self.view.settings().set('default_dir', root_at_packages('User'))
self.view.settings().set('syntax', "Packages/XML/XML.tmLanguage")
with in_one_edit(self.view):
self.view.run_command('insert_snippet', {'contents': boilerplates[self.typ] % uuid.uuid4()})
开发者ID:SergeyAvd,项目名称:AAAPackageDev,代码行数:6,代码来源:syntax_def_dev.py
示例9: run
def run(self):
v = self.window.new_file()
v.run_command('insert_snippet', {"contents": TPL})
v.settings().set('syntax', COMPLETIONS_SYNTAX_DEF)
v.settings().set('default_dir', root_at_packages('User'))
开发者ID:simonzack,项目名称:AAAPackageDev,代码行数:5,代码来源:completions_dev.py
示例10: run
def run(self):
v = self.window.new_file()
v.settings().set('default_dir', root_at_packages('User'))
v.settings().set('syntax', SETTINGS_SYNTAX)
v.run_command('insert_snippet', {'contents': TPL})
开发者ID:SergeyAvd,项目名称:AAAPackageDev,代码行数:5,代码来源:settings_dev.py
示例11: run
def run(self):
v = self.window.new_file()
v.settings().set('default_dir', root_at_packages('User'))
v.settings().set('syntax', RAW_SNIPPETS_SYNTAX)
v.set_scratch(True)
开发者ID:Syndwar,项目名称:cf_engine,代码行数:5,代码来源:snippet_dev.py
示例12: root_at_packages
join_path = os.path.join
path_exists = os.path.exists
DEFAULT_DIRS = (
"Snippets",
"Support",
"Docs",
"Macros",
"bin",
"data"
)
# name, default template
DEFAULT_FILES = (
("LICENSE.txt", None),
("README.rst", root_at_packages(THIS_PACKAGE, "data/README.rst")),
(".hgignore", root_at_packages(THIS_PACKAGE, "data/hgignore.txt")),
(".gitignore", root_at_packages(THIS_PACKAGE, "data/gitignore.txt")),
("bin/MakeRelease.ps1", root_at_packages(THIS_PACKAGE, "data/MakeRelease.ps1")),
("bin/CleanUp.ps1", root_at_packages(THIS_PACKAGE, "data/CleanUp.ps1")),
("data/html_template.txt", root_at_packages(THIS_PACKAGE, "data/html_template.txt")),
("data/main.css", root_at_packages(THIS_PACKAGE, "data/main.css")),
("setup.py", root_at_packages(THIS_PACKAGE, "data/setup.py")),
)
class NewPackageCommand(sublime_plugin.WindowCommand):
def on_done(self, pkg_name):
pam = PackageManager()
if pam.exists(pkg_name):
开发者ID:dwoodard,项目名称:sublimentz,代码行数:31,代码来源:package_dev.py
示例13: test_root_at_packages
def test_root_at_packages():
sublime.packages_path = mock.Mock()
sublime.packages_path.return_value = "XXX"
expected = os.path.join("XXX", "ZZZ")
assert su_path.root_at_packages("ZZZ") == expected
开发者ID:lmno,项目名称:AAAPackageDev,代码行数:5,代码来源:test_path.py
示例14: exists
def exists(self, name):
return path_exists(root_at_packages(name))
开发者ID:Adarma,项目名称:AAAPackageDev,代码行数:2,代码来源:package_dev.py
示例15: enumerate
# name, default template
DEFAULT_FILES = [
("LICENSE.txt", None),
("README.rst", "data/README.rst"),
(".hgignore", "data/hgignore.txt"),
(".gitignore", "data/gitignore.txt"),
("bin/MakeRelease.ps1", "data/MakeRelease.ps1"),
("bin/CleanUp.ps1", "data/CleanUp.ps1"),
("data/html_template.txt", "data/html_template.txt"),
("data/main.css", "data/main.css"),
("setup.py", "data/setup.py"),
]
for i, (name, path) in enumerate(DEFAULT_FILES):
if path is not None:
DEFAULT_FILES[i] = (name, root_at_packages(PLUGIN_NAME, path))
class NewPackageCommand(sublime_plugin.WindowCommand):
def on_done(self, pkg_name):
pam = PackageManager()
if pam.exists(pkg_name):
error(" NewPackage -- Error\n\n"
" Package '" + pkg_name + "' already exists.\n"
" You cannot overwrite an existing package."
)
return
pam.create_new(pkg_name)
开发者ID:Jaykul,项目名称:AAAPackageDev,代码行数:29,代码来源:package_dev.py
注:本文中的sublime_lib.path.root_at_packages函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论