本文整理汇总了Python中sidebar.SideBarProject.SideBarProject.hasOpenedProject方法的典型用法代码示例。如果您正苦于以下问题:Python SideBarProject.hasOpenedProject方法的具体用法?Python SideBarProject.hasOpenedProject怎么用?Python SideBarProject.hasOpenedProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sidebar.SideBarProject.SideBarProject
的用法示例。
在下文中一共展示了SideBarProject.hasOpenedProject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from sidebar.SideBarProject import SideBarProject [as 别名]
# 或者: from sidebar.SideBarProject.SideBarProject import hasOpenedProject [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 hasOpenedProject [as 别名]
def run(self, paths = []):
project = SideBarProject()
if project.hasOpenedProject():
for item in SideBarSelection(paths).getSelectedItems():
if item.isDirectory():
project.excludeDirectory(item.path())
else:
project.excludeFile(item.path())