本文整理汇总了Python中sidebar.SideBarProject.SideBarProject.getPreference方法的典型用法代码示例。如果您正苦于以下问题:Python SideBarProject.getPreference方法的具体用法?Python SideBarProject.getPreference怎么用?Python SideBarProject.getPreference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sidebar.SideBarProject.SideBarProject
的用法示例。
在下文中一共展示了SideBarProject.getPreference方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from sidebar.SideBarProject import SideBarProject [as 别名]
# 或者: from sidebar.SideBarProject.SideBarProject import getPreference [as 别名]
def run(self, paths = [], type = False):
import webbrowser
project = SideBarProject()
if project.hasOpenedProject():
if type == False or type == 'testing':
url = project.getPreference('url')
elif type == 'production':
url = project.getPreference('url_production')
else:
url = project.getPreference('url')
if url:
if url[-1:] != '/':
url = url+'/'
for item in SideBarSelection(paths).getSelectedItems():
if item.isUnderCurrentProject():
webbrowser.open_new_tab(url + item.pathRelativeFromProjectEncoded())
else:
webbrowser.open_new_tab(item.uri())
else:
for item in SideBarSelection(paths).getSelectedItems():
webbrowser.open_new_tab(item.uri())
sublime.status_message('Preference "url" was not found in project file.\n"'+project.getProjectFile()+'", opening local file')
else:
for item in SideBarSelection(paths).getSelectedItems():
webbrowser.open_new_tab(item.uri())
示例2: run
# 需要导入模块: from sidebar.SideBarProject import SideBarProject [as 别名]
# 或者: from sidebar.SideBarProject.SideBarProject import getPreference [as 别名]
def run(self, paths = []):
import webbrowser
project = SideBarProject()
url = project.getPreference('url')
if url:
if url[-1:] != '/':
url = url+'/'
for item in SideBarSelection(paths).getSelectedItems():
webbrowser.open_new_tab(url + item.pathRelativeFromProjectEncoded())
else:
for item in SideBarSelection(paths).getSelectedItems():
webbrowser.open_new_tab(item.uri())
sublime.status_message('Preference "url" was not found in project file.\n"'+project.getProjectFile()+'", opening local file')
示例3: run
# 需要导入模块: from sidebar.SideBarProject import SideBarProject [as 别名]
# 或者: from sidebar.SideBarProject.SideBarProject import getPreference [as 别名]
def run(self, paths = []):
to_copy = []
project = SideBarProject()
url = project.getPreference('url_production')
if url:
if url[-1:] != '/':
url = url+'/'
for item in SideBarSelection(paths).getSelectedItems():
if item.isUnderCurrentProject():
to_copy.append(url + item.pathRelativeFromProjectEncoded())
sublime.set_clipboard("\n".join(to_copy));
if len(paths) > 1 :
sublime.status_message("Items URL copied")
else :
sublime.status_message("Item URL copied")