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.

Currently, my project won't compile with 'pyjsbuild ProcessTrain', but will
with 'pyjd ProcessTrain.py' Why one and not the other, I don't know, but
that's another issue for another day.

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

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. Is this fix in any way useful to anyone? I
searched the bug tracker and found no hits on "parameter incorrect". I'm
happy to open one, if that's useful.

If nothing else, maybe this will show in a search result and help someone
else out!


Kind regards,
Robert Peters
Winter Lion Software Ltd.

Reply via email to