On Fri, Jan 27, 2012 at 10:24 PM, Rob Peters
<[email protected]> wrote:
> Hi everyone,
>
> I'm currently converting a project from PyQt into Pyjamas to ease its
> distribution via making it browser based. I've loved Pyjamas ever since I
> heard about it (I've worked in GWT and I am using the Django ORM in my
> project, so staying in Python is very appealing to me) and am excited to be
> finally able to use it. I'd like to contribute back as well, as best I can.
> This is a 'first steps' in that process.

 cool!

> Currently, my project won't compile with 'pyjsbuild ProcessTrain',

 ah, that's quite important to track down.  there may be some syntax
that you're endeavouring to use which isn't supported.  we need to
track down what that is, ok?

> but will
> with 'pyjd ProcessTrain.py' Why one and not the other, I don't know, but
> that's another issue for another day.

 ahh... there's no "compilation" in pyjd.

> I'm using Python 2.7, the latest version of Pyjamas (pulled from git),
> Windows 7 64-bit, compiling with pyjd (not pyjsbuilder).

 pyjd isn't "compiled".  it's direct python.  just like pyqt4, pygtk2
and python-wxWidgets

> As it stands, I have a Tree with a TreeItem in it. When I click on the
> TreeItem, pyjd throws the following stack trace:
>
>
> C:\Users\kpeters\Dropbox\WLS\
> pyjsprocesstrain>pyjd ProcessTrain.py
>
> Traceback (most recent call last):
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\pyjd\mshtmlevents.py", line
> 243, in IDispatch_Invoke
>     result = mth(self.sender, event, None)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\DOM.py", line 108,
> in _dispatchEvent
>     def _dispatchEvent(sender, evt, useCap):
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\DOM.py", line 962,
> in dispatchEvent
>     dispatchEventImpl(event, element, listener)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\DOM.py", line 999,
> in dispatchEventImpl
>     listener.onBrowserEvent(event)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\ui\Composite.py",
> line 62, in onBrowserEvent
>     self.widget.onBrowserEvent(event)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\ui\Tree.py", line
> 138, in onBrowserEvent
>     self.elementClicked(self.root, DOM.eventGetTarget(event))
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\ui\Tree.py", line
> 250, in elementClicked
>     self.onSelection(item, True)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\ui\Tree.py", line
> 347, in onSelection
>     self.moveFocus(self.curSelection)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\ui\Tree.py", line
> 294, in moveFocus
>     DOM.setIntStyleAttribute(self.focusable, "top", top)
>   File "C:\Users\kpeters\Dropbox\WLS\pyjamas\library\gwt\DOM.py", line 885,
> in setIntStyleAttribute
>     elem.style.setProperty(mf.mash_attrib(attr), str(value), "")
>   File "C:\Python27\lib\site-packages\comtypes\client\lazybind.py", line
> 163, in caller
>     return self._comobj._invoke(descr.memid, descr.invkind, 0, *args)
>   File "C:\Python27\lib\site-packages\comtypes\automation.py", line 664, in
> _invoke
>     dp, var, None, argerr)
> COMError: (-2147024809, 'The parameter is incorrect.', (None, None, None, 0,
> None))
>
> With some googling and trawling the pyjamasdev mailing list, it seems
> related to mshtml not liking its height and width parameters as an integer,
> but needing "px" behind it. I've added the following lines to the
> "moveFocus" method of pyjamas.ui.Tree, line 290.
>
>             left = '%spx' % left
>             top = '%spx' % top
>             width = '%spx' % width
>             height = '%spx' % height
>
> This seems to solve the problem.

 oh bloody 'ell.  one of those.  *sigh*.

 let's 'av'a'look at gwt's Tree.java

 
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/client/ui/Tree.java#1226

 hey well done, that's exactly what's needed.


> Is this fix in any way useful to anyone?

  yyyep.

 ok, can you please make that DOM.setStyleAttribute, then also add
yourself to the top of the file (Copyright (C) 2012 Rob Peters
<[email protected]>) as well as add an entry into the
pyjamas/copyright file, then use "git diff" - i assume you're using
git, right? - and send it in as an attachment?

 although i _could_ correct what you've found, myself, i kinda prefer
that people have a sense that they were actively and directly involved
in fixing the software that they're using.  less "black-box" that way.

 thanks peter - good find.  and well done for not going "um it's a
black box, i don't have to look at the source code" :)

 l.

Reply via email to