本文整理汇总了Python中sidebar.SideBarProject.SideBarProject类的典型用法代码示例。如果您正苦于以下问题:Python SideBarProject类的具体用法?Python SideBarProject怎么用?Python SideBarProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SideBarProject类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
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')
示例2: run
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")
示例3: run
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())