[Sugar-devel] webkit, hulahop; developing apps using browser engine DOM for widgets
Tomeu Vizoso
tomeu at sugarlabs.org
Wed Jun 10 04:55:22 EDT 2009
Hi Luke,
On Tue, Jun 9, 2009 at 23:08, Luke Kenneth Casson Leighton<lkcl at lkcl.net> wrote:
> 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.
Well, I actually blogged about this recently, though it was syndicated
only by the sugar and gnome planets:
http://blog.tomeuvizoso.net/2009/01/embedding-mozilla.html
http://blog.tomeuvizoso.net/2009/01/galeon-and-learning.html
Would be great if more people used hulahop and even took over the
maintenance of the project. Even more if pyxpcom was more actively
maintained.
> 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.
A progress listener should work, if I understand the issue correctly. See:
http://git.sugarlabs.org/projects/browse/repos/mainline/blobs/master/progresslistener.py
An check out how we attach the listener to mozilla, there's some
weakref magic 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.
Well, we actually started with mozilla and gtkmozembed, and though we
have considered adding a webkit backend at some points, nobody had the
time to go for it to the end.
> 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... :)
What about the other mozilla stuff we use through PyXPCOM? Are there
equivalents in Webkit for all of them?
> 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.
Would be interesting to have some sample Sugar activities written
using pyjamas. That would allow us to better compare it to pygtk for
our uses.
Thanks for the feedback,
Tomeu
> .... 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.
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
More information about the Sugar-devel
mailing list