本文整理汇总了Python中Explorers.Explorer.splitURI方法的典型用法代码示例。如果您正苦于以下问题:Python Explorer.splitURI方法的具体用法?Python Explorer.splitURI怎么用?Python Explorer.splitURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Explorers.Explorer
的用法示例。
在下文中一共展示了Explorer.splitURI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openAndHandleCategoryErrors
# 需要导入模块: from Explorers import Explorer [as 别名]
# 或者: from Explorers.Explorer import splitURI [as 别名]
def openAndHandleCategoryErrors(self, uri, catFile=''):
if catFile:
if uri.startswith('zip://') and uri.endswith('.zip'):
openuri = uri +'://'+ catFile
else:
openuri = os.path.join(uri, catFile)
else:
openuri = uri
try:
prot, cat, res, _uri = Explorer.splitURI(openuri)
if prot not in ExplorerNodes.fileOpenDlgProtReg:
return None
if catFile:
res = os.path.dirname(res)
return Explorer.getTransport(prot, cat, res, self.transports)
except Explorer.TransportCategoryError, err:
prot = string.split(uri, ':')[0]
# bare protocol entered, route to right toplevel node
if err.args[0] == _('Category not found') and err.args[1]==catFile:
if prot == 'root':
self.open(self.transports)
return self.transports
elif self.transportsByProtocol.has_key(prot):
node = self.transportsByProtocol[prot]
self.open(node)
return node
else:
raise
else:
raise
示例2: GetFilePath
# 需要导入模块: from Explorers import Explorer [as 别名]
# 或者: from Explorers.Explorer import splitURI [as 别名]
def GetFilePath(self):
prot, cat, res, uri = Explorer.splitURI(self.GetPath())
assert prot == 'file', _('Only filesystem paths allowed')
return res
示例3: OnGotoSource
# 需要导入模块: from Explorers import Explorer [as 别名]
# 或者: from Explorers.Explorer import splitURI [as 别名]
def OnGotoSource(self, event=None):
selection = self.getSelection()
if selection != -1:
entry = self.stack[selection]
lineno = entry["lineno"]
modname = entry["modname"]
filename = entry["client_filename"]
if not filename:
return
editor = self.debugger.editor
editor.SetFocus()
try:
editor.openOrGotoModule(filename)
except Explorer.TransportLoadError, err:
serverPath = entry["filename"]
if serverPath[0] == "<" and serverPath[-1] == ">":
wx.LogError(_("Not a source file: %s, probably an executed " "string.") % serverPath)
return
res = wx.MessageBox(
_(
"Could not open file: %s.\n\nIf This is a "
"server path for which you\nhave not defined a mapping "
'click "Yes" to browse to the file to the mapping can '
'be computed.\nPress "No" to open the path dialog.'
)
% filename,
_("File Open Error, try to compute path?"),
wx.ICON_WARNING | wx.YES_NO | wx.CANCEL,
)
if res == wx.YES:
clientPath = editor.openFileDlg(curfile=os.path.basename(filename))
if clientPath:
clientPath = prevClientPath = Explorer.splitURI(clientPath)[2]
prevServerPath = serverPath
while 1:
serverPath, serverBase = os.path.split(serverPath)
clientPath, clientBase = os.path.split(clientPath)
if serverBase != clientBase:
paths = self.debugger.serverClientPaths[:]
paths.append((prevServerPath, prevClientPath))
if self.debugger.OnPathMappings(paths=paths):
self.refreshClientFilenames()
break
if not serverPath or not clientPath:
wx.LogError(_("Paths are identical"))
break
prevClientPath = clientPath
prevServerPath = serverPath
elif res == wx.NO:
if self.debugger.OnPathMappings():
self.refreshClientFilenames()
return
model = editor.getActiveModulePage().model
view = model.getSourceView()
if view is not None:
view.focus()
view.SetFocus()
view.selectLine(lineno - 1)