[Sugar-devel] webkit, hulahop; developing apps using browser engine DOM for widgets
Luke Kenneth Casson Leighton
lkcl at lkcl.net
Tue Jun 9 17:08:44 EDT 2009
folks, hi,
i might have mentioned some of this before, but wanted to emphasise a
few things - please bear with me if you've heard some of it before.
i'd been looking for python bindings to DOM model browser technology
for quite some time, and _eventually_ found it, in the most unlikely
of places, in hulahop. but - before i found that, i had had to go
through the whole rigmarole of adding glib / gobject bindings to
webkit, and work also on pywebkitgtk to add python bindings to _those_
bindings.
so i just wanted to ask: do you _know_ how many people have been
looking, for years, for python bindings to XUL? are you _aware_ how
powerful and how under-appreciated hulahop is? :) the mozilla mailing
lists and other mailing lists are stuffed with unanswered questions
dating back to 2006, "how do i use python-xpdom to actually _do_
anything???" and you guys just made it... dead-easy.
i've created a small sample, here:
http://lkcl.net/pyjamas/pyjamas-xpdom.tgz
run python ./hula.py and it will build a web page purely using DOM
manipulation in python and also turn the body background green - again
using DOM manipulation of the body CSS stylesheet. also i think i did
an event click listener (ContentInvoker) because those are quite
tricky to get right.
rather painfully, i had to add a timer delay in order to let the page
settle down (with a blank page) otherwise the DOM isn't ready /
initialised - i couldn't work out any other way of doing this but i
understand vaguely what's going on.
anyway - one thing i _did_ specifically want to mention is that i
_did_ notice the similarity between the olpc "browser" and the
pywebkitgtk "demobrowser.py" and the copyright notice in
demobrowser.py i had noticed mentioned olpc.
i can understand why you abandoned webkit and went for python-xpdom:
adding glib/gobject bindings to webkit was a _massive_ one-off
undertaking but, it's done!
http://github.com/lkcl/webkit/16401.master you can get the source there.
so - the things that were missing from webkit (decent python bindings
which include DOM-level manipulation) are now available, and you
could, conceivably, replace XUL with webkit, and still have the level
of functionality that is available, now (he said... :)
lastly i just want to emphasise that if you look at e.g.
pyjamas-desktop http://pyjd.org you can see that it is possible to
create an entire desktop widget set API on top of this browser
technology, that is actually independent of the browser technology
implementation: it doesn't matter if it's KHTML, xpdom/hulahop or
pywebkitgtk. and it's clear that browser technology makes for a
better desktop widget set API than desktop widget set APIs do. gtk
and qt4 are _crap_ by comparison.
.... that's all :)
l.
oh - btw: if anyone's going to be at europython.eu 2009 do say hello,
i'll be happy to explain more.
More information about the Sugar-devel
mailing list