当前位置: 首页>>代码示例>>Python>>正文


Python Explorer.splitURI方法代码示例

本文整理汇总了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
开发者ID:cbaeseman,项目名称:boa-constructor,代码行数:35,代码来源:FileDlg.py

示例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
开发者ID:cbaeseman,项目名称:boa-constructor,代码行数:6,代码来源:FileDlg.py

示例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)
开发者ID:emreoz,项目名称:boa-constructor,代码行数:67,代码来源:DebuggerControls.py


注:本文中的Explorers.Explorer.splitURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。