Error catching in wx.html2 window

I’m using a wx.html2 (wx2.9) window to show an HTML help file. This works fine, but I can’t figure out how to catch any errors.

It’s possible that the user might get a site-down or 404 error. Is there a way to catch these errors? (Or any more detailed information on the new html2 control?)

In the attached code, I’d hoped OnError would be called and would raise an exception–but it never seems to be.

Thanks for any help.

web.py (450 Bytes)

I think your problem lies in the call
wv.Bind(wx.html2.EVT_WEB_VIEW_ERROR, self.OnError, wv) try deleting the
wv parameter as the Bind function is shown as taking an integer
representing the id of the window/menu/button/first of a range of ids.
You a passing the wv object which may not be the correct thing.

Gadget/Steve

···

On 28/05/2012 6:30 AM, Joel Burton wrote:

I'm using a wx.html2 (wx2.9) window to show an HTML help file. This
works fine, but I can't figure out how to catch any errors.

It's possible that the user might get a site-down or 404 error. Is
there a way to catch these errors? (Or any more detailed information
on the new html2 control?)

In the attached code, I'd hoped OnError would be called and would
raise an exception--but it never seems to be.

Thanks for any help.
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

That parameter will have its GetId() called if needed, but in this case since Bind is being called on the wv object it should be unnecessary anyway. (Because passing no item or Id means the binding will match an event from any widget when that event propagates past the widget doing the binding (wv) and since there can only be one in this case then there is no need to provide an item/id for the binding.)

BTW it looks like protocol typos are what is not triggering that event, but it does work for other types of navigation problems. If I change it to:

         wv.LoadURL("http://fubar.yadda.yahoo.com")

Then I do see the event here (on wxOSX-cocoa with 2.9.4 preview)

···

On 5/27/12 11:58 PM, Gadget/Steve wrote:

On 28/05/2012 6:30 AM, Joel Burton wrote:

I'm using a wx.html2 (wx2.9) window to show an HTML help file. This
works fine, but I can't figure out how to catch any errors.

It's possible that the user might get a site-down or 404 error. Is
there a way to catch these errors? (Or any more detailed information
on the new html2 control?)

In the attached code, I'd hoped OnError would be called and would
raise an exception--but it never seems to be.

Thanks for any help.
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I think your problem lies in the call
wv.Bind(wx.html2.EVT_WEB_VIEW_ERROR, self.OnError, wv) try deleting the
wv parameter as the Bind function is shown as taking an integer
representing the id of the window/menu/button/first of a range of ids.
You a passing the wv object which may not be the correct thing.

--
Robin Dunn
Software Craftsman

Perfect, thanks!