On Thu, May 24, 2012 at 6:28 AM, C Anthony Risinger <[email protected]> wrote:
>
> if all goes well you should be able to run the helloworld example at
> the very least. more than likely though, if installing to /usr/local,
> you will have to export some additional ENV vars to pickup the GI
> typelibs (the mechanism pygi uses to generate dynamic bindings to
> libwebkit3) ... not sure off-hand what they are (normally i build a
> package and replace the existing libwebkit3) but i'll look into that.
well, i tested it tonight, and amazingly it works just as well as it
did before ... which is about 50% :-) not too bad for a days work ...
i only spent a day or so on the actualy pyjs parts, realized evens
were busted, and spent the next several weeks digging into WebKit
itself ...
anyways, i've updated the `develop-giwebkit` branch to working order.
you will have to run bootstrap.py again to regenerate the
pyjd/__init__.py file and include the `giwebkit` engine (i plan to
remove the need to bootstrap completely, including this bit).
it can handle pretty much anything DOM/Event related, but the
"attaching" process isn't smart enough yet, and serveral object will
appear to be missing random things ... for example if you try to run
the KitchenSink, it will fail trying to access window.location; these
object are available, but they are either named slightly different,
nested on `prop` attribute, or otherwise, and mappings must be created
in a lazy fashion linking them up.
for anyone briefly interested in how it all works ... before the pyjd
mainloop starts a "parasite" function of sorts is executed. this
function dynamically installs new __getattr__ and __setattr__ methods
on the target classes (DOMHTMLDocument, DOMEvent, etc), falling back
on the original. this makes it very fast: __getattr__ is only called
for *missing* attributes (vs. __getattribute__ which is mandatory)
thus each attribute is patched only *once*, on the class, immediately
making it available to all instances ...
... for naming variations, a simple alias is created:
cls.createElement = cls.create_element
... for "gprop" access, gprop being a special property on all gobjects
that behave more naturally (eg. @property) a descriptor is installed
on the class that will access the property:
cls.type = _property_gprops_simple('type')
... which simply calls:
cls.get_property('type')
... and then DOM stuff mostly Just Works :-)
what remains is mapping out the obscure/edge cases, and adding support
for XMLHTTP, Timers, and whatever else. GObject Introspection is
incredibly comprehensive -- in fact, i believe only about 5-10
functions from the C-API are omitted -- so i don't see much issue
here, just a matter of finding the object to call, how to call, and
then the busy work linking it all up.
the best way to explor IMO is to look directly at the GIR file:
# vim /usr/share/gir-1.0/WebKit-3.0.gir
... the .typelib files are simple binary versions of the GIR file, and
it will contain every possible class, method, and property at your
disposal.
thanks,
--
C Anthony