Lightweight embedding of Firefox Gecko into application whose toplevel is Python--possible?

K

Kenneth McDonald

Sorry for crossposting to several lists, but from what I can tell, what
I want to do may involve several different areas of expertise. (None of
which I have :-( )

I'd like to use Gecko as the UI for an application mostly implemented in
Python. Ideally, I'd like to somehow come up with a Python module that
wraps the Gecko, so that I can:

1) Create windows whose content is drawn by Gecko.
1) Dynamically manipulate what is shown by Gecko.
2) Respond to mouse events and keypresses occurring on the window Gecko
is in.

I really don't need, or want, anything beyond this. Presumably Gecko
does have some notion of the DOM, since it handles CSS (which I do want)
and CSS needs the DOM to be meaningful. And I'm also assuming that Gecko
has or requires JavaScript, in order to actually do things with the DOM,
or at least to handle DOM events. (Or at the very least to handle mouse
events, since key events could in theory be handled outside of the
layout engine.) But I'd like to be able to build something with _just_
those features.

Given the above, using Firefox or even Xulrunner seems to be very
heavyweight and unnecessary. It would be somewhat nice to be able to
manipulate a XUL DOM to created panes, menus, etc. But even that is not
necessary--so far as I can tell, DOM manipulation+CSS has the ability
right now to do menus, scrollable sidebars, panes, etc.

I'd like to get away from the rest of the FF/Mozilla baggage (especially
XPCOM) because:

1) I don't want to have to deal with XPCOM, chrome stuff, XUL, make
details, XPIDL (or whatever it is), etc. etc. My brain is already too
full. :)
2) Even if I did want to deal with the above, I find the documentation
for it disorganized and, more often than not, out of date. Not a
criticism, just an unavoidable weakness of open source development with
a large number of developers.

Given that the _only_ thing I really want to use is the Gecko layout
engine with some sort of relatively rudimentary keyboard and mouse
handling (I'll do all of the sophisticated handling in Python), it'd
just be nice to be able to dispense with all of the rest of the stuff.

For the record, I do know that PyXPCOM is still being developed, and
what little I've been able to glean suggests it's been going reasonably
well. However, I'm not sure it will do what I want it to. It appears to
be a way to write XPCOM components in Python, and I have no idea if that
will allow me to just use Python in the same way JavaScript is used
right now, which is what I want. From what little I've been able to
track down it seems that PyXPCOM may only be the starting point for
moving towards using Python for DOM scripting. Also, I'm not sure when
it will actually be done. Up-to-date online info about PyXPCOM (aside
from bug tracking) seems very sparse.

Given all of that, answers to the following questions (or suggestions
related to the whole endeavour) would be appreciated.
1) Does this even seem feasible? Can Gecko be 'broken out' from the
other Moz technologies to this extent?
2) Does anyone know of similar projects?
3) Can anyone point out a simple example of encapsulating Gecko in a
small C/C++ app, and then running/communicating with Gecko from that
code? (i.e. a Gecko embedding "Hello world") This is in some sense what
I'd be doing, since using Gecko from Python would involve (I assume)
wrapping Gecko in a Python-compatible C wrapper. I've come across a
number of embedding Gecko tutorials, but nothing that starts at such a
basic level.
4) Do I need to somehow provide/link in a windowing system of some sort,
or do I get that with the version of Gecko appropriate for the target
platform?
5) Will PyXPCOM let me do what I want? And is it close enough that I
should just wait for it? (It doesn't bother me if all of the rest of the
Moz/FF stuff is included in my app, just as long as I don't have to deal
with it.)

Many thanks,
Ken McDonald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top