mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Merge pull request #1069 from RobinD42/fix-issue1068
Fixed the wrappers for wx.html.HtmlWindow.OnOpeningURL
This commit is contained in:
@@ -142,6 +142,10 @@ Changes in this release include the following:
|
||||
object from Python to C++. This possible double-deletion and related crashing
|
||||
problems. (#1061)
|
||||
|
||||
* Fixed the wrappers for wx.html.HtmlWindow.OnOpeningURL to properly handle the
|
||||
redirect output parameter. (#1068) This is a backwards-incompatible change,
|
||||
please see the Migration Guide for details.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,11 @@ class MyHtmlWindow(html.HtmlWindow):
|
||||
self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
|
||||
return super(MyHtmlWindow, self).OnCellClicked(cell, x, y, evt)
|
||||
|
||||
# def OnHTMLOpeningURL(self, urlType, url):
|
||||
# self.log.WriteText('OnHTMLOpeningURL: %s %s' % (urlType, url))
|
||||
# if urlType == wx.html.HTML_URL_IMAGE and 'canada' not in url:
|
||||
# return (wx.html.HTML_REDIRECT, "bitmaps/canada.gif")
|
||||
# return (wx.html.HTML_OPEN, "")
|
||||
|
||||
|
||||
# This filter doesn't really do anything but show how to use filters
|
||||
|
||||
@@ -596,6 +596,22 @@ are using Python3 and would like the newest version of PyPubSub then you can
|
||||
drop the version number from the pip command above.
|
||||
|
||||
|
||||
wx.html.HtmlWindow.OnOpeningURL
|
||||
-------------------------------
|
||||
|
||||
In Classic the return value of ``wx.html.HtmlWindow.OnOpeningURL`` could be
|
||||
either a value from the ``wx.html.HtmlOpeningStatus`` enumeration, or a string
|
||||
containing the URL to redirect to. In Phoenix this has been changed to a simpler
|
||||
wrapper implementation which requires that both an enum value and a string be
|
||||
returned as a tuple. For example::
|
||||
|
||||
def OnHTMLOpeningURL(self, urlType, url):
|
||||
if urlType == wx.html.HTML_URL_IMAGE and url != self.otherURL:
|
||||
return (wx.html.HTML_REDIRECT, self.otherURL)
|
||||
return (wx.html.HTML_OPEN, "")
|
||||
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:hidden:
|
||||
|
||||
@@ -34,6 +34,12 @@ def run():
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
c = module.find('wxHtmlWindowInterface')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.find('OnHTMLOpeningURL.redirect').out = True
|
||||
c.find('OnHTMLOpeningURL.redirect').name = 'redirectTo'
|
||||
|
||||
|
||||
c = module.find('wxHtmlWindow')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
@@ -47,7 +53,7 @@ def run():
|
||||
'OnOpeningURL',
|
||||
'OnSetTitle',
|
||||
'OnCellMouseHover',
|
||||
'OnCellClicked']:
|
||||
'OnCellClicked' ]:
|
||||
c.find(name).isVirtual = True
|
||||
c.find(name).ignore(False)
|
||||
|
||||
@@ -58,7 +64,7 @@ def run():
|
||||
virtual void OnHTMLLinkClicked(const wxHtmlLinkInfo& link);
|
||||
virtual wxHtmlOpeningStatus OnHTMLOpeningURL(wxHtmlURLType type,
|
||||
const wxString& url,
|
||||
wxString *redirect) const;
|
||||
wxString *redirectTo /Out/) const;
|
||||
virtual wxPoint HTMLCoordsToWindow(wxHtmlCell *cell,
|
||||
const wxPoint& pos) const;
|
||||
virtual wxWindow* GetHTMLWindow();
|
||||
|
||||
Reference in New Issue
Block a user