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

Discussion in 'Python' started by Kenneth McDonald, Dec 19, 2006.

  1. 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
     
    Kenneth McDonald, Dec 19, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cordula's Web

    Gecko bindings for Python?

    Cordula's Web, Jan 11, 2005, in forum: Python
    Replies:
    2
    Views:
    2,980
    Cordula's Web
    Jan 14, 2005
  2. Steven Reddie
    Replies:
    10
    Views:
    582
    Michael Hoffman
    Mar 7, 2005
  3. Steven Reddie
    Replies:
    2
    Views:
    311
    Scott David Daniels
    Mar 7, 2005
  4. Replies:
    0
    Views:
    305
  5. Franck Ditter

    Python toplevel in a Web page

    Franck Ditter, May 30, 2013, in forum: Python
    Replies:
    2
    Views:
    92
    Giorgos Tzampanakis
    Jun 1, 2013
Loading...

Share This Page