On Sun, Jan 22, 2012 at 5:28 AM, Peter Bittner <[email protected]> wrote: > 2012/1/21 lkcl luke <[email protected]>: >> pythonwebkit compiles easily enough, and there _is_ debian packaging >> for it (i created it). phil endeavoured to get the debian packaging >> up-to-date before new year, but he's a little distracted because his >> wife's baby is due. > > Okay, I managed to install pythonwebkit following the Wiki at > http://pyjs.org/wiki/pyjamasubuntuwebkitgtk/
yaay > Some examples run and work. Many examples throw an exception when > starting up, however: > > E.g. the asteroids example, or the hangman example: > ... > AttributeError: 'pywebkit.HTMLCanvasElement' object has no attribute > 'getContext' yep, that's to be expected: the bindings for SVG Canvas will take me about 8 days full-time @ 11hrs / day to add. > Or, e.g. the MailApp example: > ... > File "/home/pbittner/Development/30-percent/pyjamas/library/gwt/Window.py", > line 39, in enableScrolling > doc().body.style.overflow = enable and 'auto' or 'hidden' > AttributeError: 'pywebkit.CSSStyleDeclaration' object has no > attribute 'overflow' ah that's a bug that shouldn't happen: it means that i missed a platform override when... > I understand those problems result from the current status of Python-Webkit. > > (From: http://www.gnu.org/software/pythonwebkit/) >> The current status is that the SVG 2D Canvas element is not available, >> and CSS Styles have to be modified through the style.setProperty >> function (rather than being accessible as python properties). ... yep, that's it :) > Can you explain why this isn't implemented yet, what's the actual the > problem in the implementation? (Can't the access to the CSS styles be > patched in the Python-Webkit sources, or have a fallback > implementation for ".style.xxxxxx = ..." in pyjd?) it's complicated. there's a list of CSS styles, it is necessary to write an auto-generator which takes that list, and spews forth python code that adds python-c-based "properties" to the module. it was much _much_ easier to just have the one function - setProperty - than it was to do that. however, the implementation _of_ that properties system would in fact be to internally call that setProperty function. the alternative is to write a python-based wrapper which goes "oh look, it's a class of type CSSStyleDecoration, let's add it using python properties. the problem is that you cannot do that sort of thing to c-based python objects: their properties and methods are effectively read-only (non-modifiable, non-addable-to). so now you have to arse about creating a new class, but how do you get everything to return it? whoops, you can't, so now you have to write a wrapper for EVERY single class in the module. ... can you see now why i haven't done this? :) so in the mean-time, there needs to be a platform override pyjamas/gwt/platform/Windowpywebkitgtk.py which has, instead of this: doc().body.style.overflow = enable and 'auto' or 'hidden' has this: doc().body.style.setProperty("overflow", enable and 'auto' or 'hidden') that's all. i'll add it, you let me know if it works, ok? l.

