[Pyxpcomext] Display and Rendering Question

Peter Rust peter at cornerstonenw.com
Thu Feb 25 10:07:59 PST 2010


Nathan,
 
>From Javascript, I'm doing something similar
(document.getElementById('browser')) and it returns a Browser
<https://developer.mozilla.org/en/XUL/browser#m-reload>  instance and "just
works". I'm guessing that from Python, you may have to do some kind of
QueryInterface to get the interface you're expecting, perhaps something
along the lines of:
 
browser = browser.QueryInterface(xpcom.components.interfaces.Browser);
 
(not sure if the interface name is "interfaces.Browser" or
"interfaces.browser" or "interfaces.nsBrowser" or "interfaces.nsIBrowser".)
 
-- peter
 
From: pyxpcomext-bounces at mozdev.org [mailto:pyxpcomext-bounces at mozdev.org]
On Behalf Of Nathan Hamiel
Sent: Thursday, February 25, 2010 9:39 AM
To: pyxpcomext at mozdev.org
Subject: [Pyxpcomext] Display and Rendering Question
 
I have a couple of questions about the display and rendering of HTML using
XUL with Python. For example in my XULrunner application, I want to
construct a request using httplib or httplib2 and display the return data in
both HTML source as well as rendered HTML. 
 
So I would have something like so:
 
urlval = "http://python.org"
handler = httplib2.Http()
resp, content = handler.request(urlval, "GET")

I have some tabpanels set up with vbox's on them. What I would like to do
after the request for this content is made is take the content value, which
contains the HTML of the return response, and on one panel display the HTML
source (preferably syntax highlighted) and on other panel render the HTML.
It shouldn't matter how the HTML is retrieved though since at some point it
may be pulled from something such as a SQLite database or other storage
mechanism.
 
I am not sure of the best way to go about this. If there are any examples or
documentation anyone can point me to, it would be greatly appreciated. Sorry
if the answer is painfully obvious and there is something I am just not
getting. 
 
I have even tried to use the browser object by instantiating it like so:
 
In my XUL file I have:
<browser id="browser" src="about:blank" flex="1" />
 
In my .py file I have:
browser = document.getElementById("browser")
 
However, when trying to use this an to say reload an error like so happens:
 
XPCOM component '<unknown>' has no attribute 'reload'
 
Anyway, I am stumped and I figured I would ask for help. Please let me know
if I need to provide more detail and I will gladly do so. Thanks in advance.


-- 
Nathan 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/pyxpcomext/attachments/20100225/494be133/attachment-0001.html>


More information about the Pyxpcomext mailing list