PNG images & relative URLs for wxHtmlWindow in wxWidgets 2.4

Hi all,

I'm learning to use wxWindows 2.4.2.4 on a Debian GNU/Linux system
running Python 2.3.3. I'm using the wxHtmlWindow class to add simple
web page browsing in a small application I'm developing. It seems PNG
support needs to be added for pages to load correctly, since a local
copy of a page with the .png removed loads just fine. Has anyone added
support for this via the wxHtmlWindow::AddFilter? Do I need to
double-check that I've initialized the appropriate wxImage type?

Also, does anyone have a sample of how to add support for relative URLs?

Thanks in advance,

···

--
-- Grant Bowman <grantbow@grantbow.com>

Thanks for your reply Robin, keep up the good work!

* Robin Dunn <robin@alldunn.com> [040604 10:53]:

Grant Bowman wrote:
>Hi all,
>
>I'm learning to use wxWindows 2.4.2.4 on a Debian GNU/Linux system
>running Python 2.3.3. I'm using the wxHtmlWindow class to add simple
>web page browsing in a small application I'm developing. It seems PNG
>support needs to be added for pages to load correctly, since a local
>copy of a page with the .png removed loads just fine. Has anyone added
>support for this via the wxHtmlWindow::AddFilter?

It should already be handling them.

> Do I need to
>double-check that I've initialized the appropriate wxImage type?

Just call wx.InitAllImageHandlers at the begining of your app.

I do a LoadPage (not a SetPage) and call wxInitAllImageHandlers()
(wxWidgets 2.4) right before I load it.

        self.htmlWindow1.LoadPage('DashboardViewSpec.html')

is my local copy with the png cut out of it. It loads without error and
shows the 4 gifs in the page content.

        self.htmlWindow1.LoadPage('http://wiki.osafoundation.org/twiki/bin/view/Chandler/DashboardViewSpec’)

shows all the text of the page and gives me an error "No handler found
for image type" repeated 4 times in a popup error box. The png shows up
but the 4 gif images are not displayed.

So my initial guess was wrong. Sorry about that. I still have an issue
somewhere. So I guess the question to ask now is: how can I enable two
kinds of images on one page?

>
>Also, does anyone have a sample of how to add support for relative URLs?

To do relative URLs wx.HtmlWindow needs to know the location of the page
currently being displayed. If you use SetPage then there is no location
since you are just giving it the HTML in a string, but if you use
LoadPage then there is location since wxHtmlWindow is loading from a
file or a URL.

The relative URLs for the wiki are a bit odd. For example, one shows up
as '/twiki/bin/view/Chandler/WebChanges' for the Changes link at the top
of the page. It should prepend http://wiki.osafoundation.org
automatically, so maybe something needs to handle the case of a relative
url string starting with a '/' ?

···

--
-- Grant Bowman <grantbow@grantbow.com>