On Sun, Apr 29, 2012 at 8:21 PM, Phil Charlesworth
<[email protected]> wrote:
> On 28/04/12 02:43, [email protected] wrote:
>>
>>
>> Comment #12 on issue 715 by [email protected]: Images used by Tree.py
>> and DisclosurePanel.py are not found by pyjd.
>> http://code.google.com/p/pyjamas/issues/detail?id=715
>>
>> all right, we'll work something out.
>>
>>
> I've had a go at trying to draw the images using GWTCanvas with mixed
> results. Basically I've replaced the image element in TreeItem by a canvas
> element and, where the code loaded an image previously, I now draw the image
> again.
>
> It almost works:
> In pyjd/MSHTML, the canvas is redrawn properly when I click on it but the
> drawing seems to hide the focus element, so one has to poke around to find
> the outer region of the canvas which responds to a click.

 seems fine running IE8 under wine :)

> In pyjs mode, tested on Firefox and Chrome, the whole canvas area responds
> to the click but the image doesn't get redrawn properly in spite of the
> drawing code running. It looks as if canvas.clear() is not working.

 yes, apparently you have to resize the canvas.  that's really shit
and completely non-intuitive but it's what's needed: i didn't know
either but i took a look in examples/gwtcanvas and there it actually
comments out clear and uses resize instead.

> Does any of this sound like a known problem, or have I just written some
> crap code?

 good to me.

> I have attached my modified version of pyjamas/library/ui/TreeItem.py

 ok, what i've done is taken this a step further: i looked up how to
do base64-encoded images, and http://css-tricks.com/data-uris/ yaay!

 then i did a platform-override for TreeItem.mshtml.py (and identical
code for TreeItem.ie6.py - must sort that out some day, make a
TreeItem.trident.py platform which both those derive from)

 so, for safari, firefox and opera, base64-encoded embedded images
will be used.  oh, and for pythonwebkit and xulrunner (if anyone can
get it to bloody well work *sigh*) as well.  but for mshtml
(ie6,7,8.9) gwtcanvas will be used.

 thanks for kicking this off, phil.

 does anyone want to deploy the same trick for the remaining images?
there is the vertical bar and horizontal bar thing on the split panel,
as well as the separator.

 hmmm... i wooonderrrrr.... i wonder if gwtcanvas could be tricked
into accepting image data from the same css string that's used to
create an <image> element?  we've already got base64 decode in pyjs,
so.. in theeorryyyy... if the image was a simple format like BMP it
could be decoded in python and done one pixel at a time!  eeuw, eeuw
:)

 l.

Reply via email to