def getRelativeUrl(relativeTo, fullPath, pythonUrl=False):
    """
    Returns URL relative to relativeTo. If relativeTo is "" or None
    the URL is absolute.
    """
    if relativeTo is None or relativeTo == "":
        if pythonUrl:
            #             return escapeHtml(u"file:" + urllib.pathname2url(fullPath))
            return u"file:" + urlFromPathname(fullPath)
        else:
            return wx.FileSystem.FileNameToURL(fullPath)

    relPath = relativeFilePath(relativeTo, fullPath)
    if relPath is None:
        if pythonUrl:
            #             return escapeHtml(u"file:" + urllib.pathname2url(fullPath))
            return u"file:" + urlFromPathname(fullPath)
        else:
            return wx.FileSystem.FileNameToURL(fullPath)

    return urlFromPathname(relPath)
Example #2
0
def getRelativeUrl(relativeTo, fullPath, pythonUrl=False):
    """
    Returns URL relative to relativeTo. If relativeTo is "" or None
    the URL is absolute.
    """
    if relativeTo is None or relativeTo == "":
        if pythonUrl:
#             return escapeHtml(u"file:" + urllib.pathname2url(fullPath))
            return u"file:" + urlFromPathname(fullPath)
        else:
            return wx.FileSystem.FileNameToURL(fullPath)

    relPath = relativeFilePath(relativeTo, fullPath)
    if relPath is None:
        if pythonUrl:
#             return escapeHtml(u"file:" + urllib.pathname2url(fullPath))
            return u"file:" + urlFromPathname(fullPath)
        else:
            return wx.FileSystem.FileNameToURL(fullPath)

    return urlFromPathname(relPath)
Example #3
0
            content = self.presenter.getLiveText()

            html = self.exporterInstance.exportWikiPageToHtmlString(wikiPage)

            wx.GetApp().getInsertionPluginManager().taskEnd()
            
            if self.currentLoadedWikiWord == word and \
                    self.anchor is None:

                htpath = self.htpaths[self.currentHtpath]

                with open(htpath, "w") as f:
                    f.write(utf8Enc(html)[0])

                url = "file:" + urlFromPathname(htpath)
                self.currentLoadedUrl = url
                self.passNavigate += 1
#                 self.RefreshPage(iewin.REFRESH_COMPLETELY)

                lx, ly = self.GetViewStart()

                self.LoadUrl(url, iewin.NAV_NoReadFromCache | iewin.NAV_NoWriteToCache)
                self.scrollDeferred(lx, ly)
            else:                        
                self.currentLoadedWikiWord = word

                self.currentHtpath = 1 - self.currentHtpath
                htpath = self.htpaths[self.currentHtpath]
                
                with open(htpath, "w") as f:
Example #4
0
            content = self.presenter.getLiveText()

            html = self.exporterInstance.exportWikiPageToHtmlString(wikiPage)

            wx.GetApp().getInsertionPluginManager().taskEnd()

            if self.currentLoadedWikiWord == word and \
                    self.anchor is None:

                htpath = self.htpaths[self.currentHtpath]

                with open(htpath, "w") as f:
                    f.write(utf8Enc(html)[0])

                url = "file:" + urlFromPathname(htpath)
                self.currentLoadedUrl = url
                self.passNavigate += 1
                #                 self.RefreshPage(iewin.REFRESH_COMPLETELY)

                lx, ly = self.GetViewStart()

                self.LoadUrl(
                    url, iewin.NAV_NoReadFromCache | iewin.NAV_NoWriteToCache)
                self.scrollDeferred(lx, ly)
            else:
                self.currentLoadedWikiWord = word

                self.currentHtpath = 1 - self.currentHtpath
                htpath = self.htpaths[self.currentHtpath]