HtmlWindow.OnOpeningURL > REDIRECT

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

HtmlWindow.OnOpeningURL > REDIRECT

Torsten
Hello everyone,

in wxPython 3 we used the following code to redirect image links:

def OnOpeningURL(self, htmlUrlType, url):
    if (
        htmlUrlType == HTML_URL_IMAGE and
        (self.basePath is not None) and
        not url.startswith(self.basePath)
    ):
        return self.basePath + "/" + url
    else:
        return HTML_OPEN

wxPython 4 now raises

TypeError: invalid result from HtmlWindow.OnOpeningURL(), a member of enum 'HtmlOpeningStatus' is expected not 'unicode'

From reading the docs OnOpeningURL has a fourth parameter redirect which is a Pointer to String variable that must be filled with an URL. How do i use this? I tried
        redirect = self.basePath + "/" + url
        return HTML_REDIRECT
    else:
        return HTML_OPEN
but with no success.

How is the correct way of handling the redirect in wxPython 4?

--
TIA,
Torsten

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: HtmlWindow.OnOpeningURL > REDIRECT

Robin Dunn
It looks like the custom implementation for that method wasn't ported from Classic. I'll look into it this evening and implement something for the next release. (Coming soon, I hope.)


https://github.com/wxWidgets/Phoenix/issues/1068

--
Robin


On Wednesday, October 31, 2018 at 5:24:12 AM UTC-7, Torsten wrote:
Hello everyone,

in wxPython 3 we used the following code to redirect image links:

def OnOpeningURL(self, htmlUrlType, url):
    if (
        htmlUrlType == HTML_URL_IMAGE and
        (self.basePath is not None) and
        not url.startswith(self.basePath)
    ):
        return self.basePath + "/" + url
    else:
        return HTML_OPEN

wxPython 4 now raises

TypeError: invalid result from HtmlWindow.OnOpeningURL(), a member of enum 'HtmlOpeningStatus' is expected not 'unicode'

From reading the docs OnOpeningURL has a fourth parameter redirect which is a Pointer to String variable that must be filled with an URL. How do i use this? I tried
        redirect = self.basePath + "/" + url
        return HTML_REDIRECT
    else:
        return HTML_OPEN
but with no success.

How is the correct way of handling the redirect in wxPython 4?

--
TIA,
Torsten

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.