[GRASS-dev] [GRASS GIS] #1425: error in python _core.py from wxNVIZ

#1425: error in python _core.py from wxNVIZ
---------------------------+------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: mouse, wxNVIZ | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------
The following code raises an error when a mouse click is registered in
wxNVIZ

{{{

Create folder...

/usr/local/tcltk_active/lib/...

make links to the ActiveTcl framework binaries

libtcl.dylib -> /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
libtcl8.5.dylib -> /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
libtclstub8.5.a ->
/Library/Frameworks/Tcl.framework/Versions/8.5/libtclstub8.5.a
libtk.dylib -> /Library/Frameworks/Tk.framework/Versions/8.5/Tk
libtk8.5.dylib -> /Library/Frameworks/Tk.framework/Versions/8.5/Tk
libtkstub8.5.a ->
/Library/Frameworks/Tk.framework/Versions/8.5/libtkstub8.5.a

Then configure grass with:

--with-tcltk-includes="/Library/Frameworks/Tcl.framework/Headers /
Library/Frameworks/Tk.framework/Headers /Library/Frameworks/
Tk.framework/PrivateHeaders" --with-tcltk-libs=/usr/local/tcltk_active/
lib

}}}

The error is

{{{

Traceback (most recent call last):
   File "/Users/Shared/grass_dev/grass70_dev/dist.i386-apple-
darwin10.8.0/etc/gui/wxpython/gui_modules/nviz_mapdisp.py",
line 341, in OnMouseAction

self.OnLeftUp(event)
   File "/Users/Shared/grass_dev/grass70_dev/dist.i386-apple-
darwin10.8.0/etc/gui/wxpython/gui_modules/nviz_mapdisp.py",
line 475, in OnLeftUp

self.ReleaseMouse()
   File "/Users/Shared/grass_dev/grass70_dev/macosx/dist/GRAS
S-7.0.app/Contents/MacOS/etc/python/wx/_core.py", line 9744,
in ReleaseMouse

return _core_.Window_ReleaseMouse(*args, **kwargs)
wx._core
.
PyAssertionError
:
C++ assertion "GetCapture() == this" failed at /BUILD
/wxPython-src-2.8.12.0/src/common/wincmn.cpp(2536) in
ReleaseMouse(): attempt to release mouse, but this window
hasn't captured it

}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1425&gt;
GRASS GIS <http://grass.osgeo.org>

#1425: error in python _core.py from wxNVIZ
---------------------------+------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: mouse, wxNVIZ | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by cmbarton):

Replying to [ticket:1425 cmbarton]:
> The following code raises an error when a mouse click is registered in
wxNVIZ
>
> {{{

     def ReleaseMouse(*args, **kwargs):
         """
         ReleaseMouse(self)

         Releases mouse input captured with wx.Window.CaptureMouse.
         """
         return _core_.Window_ReleaseMouse(*args, **kwargs)

> }}}
>
> The error is
>
> {{{
>
> Traceback (most recent call last):
> File "/Users/Shared/grass_dev/grass70_dev/dist.i386-apple-
> darwin10.8.0/etc/gui/wxpython/gui_modules/nviz_mapdisp.py",
> line 341, in OnMouseAction
>
> self.OnLeftUp(event)
> File "/Users/Shared/grass_dev/grass70_dev/dist.i386-apple-
> darwin10.8.0/etc/gui/wxpython/gui_modules/nviz_mapdisp.py",
> line 475, in OnLeftUp
>
> self.ReleaseMouse()
> File "/Users/Shared/grass_dev/grass70_dev/macosx/dist/GRAS
> S-7.0.app/Contents/MacOS/etc/python/wx/_core.py", line 9744,
> in ReleaseMouse
>
> return _core_.Window_ReleaseMouse(*args, **kwargs)
> wx._core
> .
> PyAssertionError
> :
> C++ assertion "GetCapture() == this" failed at /BUILD
> /wxPython-src-2.8.12.0/src/common/wincmn.cpp(2536) in
> ReleaseMouse(): attempt to release mouse, but this window
> hasn't captured it
>
> }}}

I had to correct the code I put in the original report.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1425#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1425: error in python _core.py from wxNVIZ
---------------------------+------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: mouse, wxNVIZ | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by annakrat):

Hi Michael,

how can I reproduce this error?
I'm not sure I understand the problem but try to remove the first line in
GLWindow.OnLeftUp:
{{{
self.ReleaseMouse()
}}}

or use:
{{{
if self.HasCapture():
    self.ReleaseMouse()
}}}

Does it help?

Anna

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1425#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1425: error in python _core.py from wxNVIZ
---------------------------+------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: mouse, wxNVIZ | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by cmbarton):

self.ReleaseMouse() calls code in _core.py that bombs

I'll try the new code shortly.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1425#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1425: error in python _core.py from wxNVIZ
---------------------------+------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: mouse, wxNVIZ | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by cmbarton):

Unfortunately I'm still getting the same error. The error might be
somewhat bogus, because it is not clear that any functionality is
affected. Maybe the offending line can simply be commented out.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1425#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1425: error in python _core.py from wxNVIZ
---------------------------+------------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: mouse, wxNVIZ | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by cmbarton):

Some testing results.

self.ReleaseMouse() is needed in order to be able to place a north arrow
or scale bar with the mouse. Why is this? I inserted a self.HasCapture()
command to test whether or not the window is somehow capturing the mouse,
but it is not.

The ReleaseMouse() command is to release the mouse following the
CaptureMouse(). But I cannot see that the CaptureMouse() command has been
issued anywhere. This is why ReleaseMouse() raises an error in the
OnLeftUp mouse button handler.

What is not at all clear is what ReleaseMouse() is doing to make the north
arrow and scalebar placement possible. Any thoughts on this?

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1425#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>