[GRASS-dev] [GRASS GIS] #3112: wxgui scatterplot tool: C++ assertion "m_window" failed at ../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work without window

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
-------------------------+-------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Keywords: scatterplot | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
Trying to use the bivariate scatterplot tool in the Map Display I get the
following error and nothing else:

{{{
Traceback (most recent call last):
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/mapdisp/frame.py", line 1175, in
OnScatterplot

win = ScatterFrame(parent=self, rasterList=raster)
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/wxplot/scatter.py", line 42, in
__init__

BasePlotFrame.__init__(self, parent, size=size, **kwargs)
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-
linux-gnu/gui/wxpython/wxplot/base.py", line 113, in
__init__

self.client.canvas.Bind(wx.EVT_LEFT_DOWN,
self.OnMouseLeftDown)
   File "/usr/lib/python2.7/dist-
packages/wx-3.0-gtk2/wx/_core.py", line 4228, in Bind

event.Bind(self, id, id2, handler)
   File "/usr/lib/python2.7/dist-
packages/wx-3.0-gtk2/wx/_core.py", line 4572, in Bind

target.Connect(id1, id2, et, function)
   File "/usr/lib/python2.7/dist-
packages/wx-3.0-gtk2/wx/_core.py", line 4182, in Connect

return _core_.EvtHandler_Connect(*args, **kwargs)
wx._core
.
PyAssertionError
:
C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize()
doesn't work without window

}}}

Maybe linked to wx 3 ?

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by pvanbosgeo):

I can confirm that the bivariate scatterplot tool in the Map Display is
not working (grass 7.3svn, r69054, python 2.7.12, wxpython 3.0.2.0, ubuntu
16.04). The error I got is slightly different, so adding below.

{{{
Traceback (most recent call last):
   File "/usr/local/grass7/grass-7.3.svn/gui/wxpython/mapdisp
/frame.py", line 1174, in OnScatterplot

win = ScatterFrame(parent=self, rasterList=raster)
   File "/usr/local/grass7/grass-7.3.svn/gui/wxpython/wxplot/
scatter.py", line 42, in __init__

BasePlotFrame.__init__(self, parent, size=size, **kwargs)
   File "/usr/local/grass7/grass-7.3.svn/gui/wxpython/wxplot/
base.py", line 107, in __init__

self.client = plot.PlotCanvas(self)
   File "/usr/lib/python2.7/dist-
packages/wx-3.0-gtk2/wx/lib/plot.py", line 598, in __init__

self.HandCursor = wx.Cursor(Hand.GetImage())
   File "/usr/lib/python2.7/dist-
packages/wx-3.0-gtk2/wx/_gdi.py", line 1510, in __init__

_gdi_.Cursor_swiginit(self,_gdi_.new_Cursor(*args,
**kwargs))
TypeError
:
Required argument 'type' (pos 2) not found

}}}

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

Replying to [ticket:3112 mlennert]:
> Trying to use the bivariate scatterplot tool in the Map Display I get
the following error and nothing else:

Please check if you have any local changes. I've seen this error when I
was experimenting with #2558.

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [comment:2 annakrat]:
> Replying to [ticket:3112 mlennert]:
> > Trying to use the bivariate scatterplot tool in the Map Display I get
the following error and nothing else:
>
> Please check if you have any local changes. I've seen this error when I
was experimenting with #2558.

I just compiled a completely fresh checkout of trunk now. I don't think
that the python-wx had any local modifications.

But the issue seems to be known:

* http://trac.wxwidgets.org/ticket/17293
* http://nuand.com/forums/viewtopic.php?t=3604&p=5820

Apparently some inconsistencies in python-wx3, IIUC.

The latest Debian version that I use actually includes a bugfix for the
lib/plot.py:

http://metadata.ftp-
master.debian.org/changelogs//main/w/wxpython3.0/wxpython3.0_3.0.2.0+dfsg-
3_changelog

based on a patch proposed in Launchpad:

https://bugs.launchpad.net/ubuntu/+source/wxpython3.0/+bug/1545698

which gets rid of the problem reported in #2558, but now I see the problem
reported here...

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

Then it makes sense, your version of wxPython has fixed the original
problem, but now a different problem appears (apparently only for wxGTK).
There are some clues in the ticket you link, but I am not sure if it
helps. If I can reproduce it on my system I'll try to look at it.

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by annakrat):

* Attachment "wxlibplot.py" added.

modified plot.py

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

I modified the plot.py based on the information in the ticket and now it
works for me, please test. I added it to gui_core and change all imports
to:
{{{import gui_core.wxlibplot as plot}}}

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by annakrat):

* Attachment "wxlibplot_imports.diff" added.

changes in imports

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

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [comment:5 annakrat]:
> I modified the plot.py based on the information in the ticket and now it
works for me, please test. I added it to gui_core and change all imports
to:
> {{{import gui_core.wxlibplot as plot}}}

Beautiful, Anna ! This solves the issue (and so also #2558) and I now have
all these great tools back: profile, histogram, and scatterplot !!

Thank you very much for looking into this !

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3112#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by annakrat):

* status: new => closed
* resolution: => fixed

Comment:

Fixed in r69075 (and backported in r69076 and r69077). wxPython file
wx.lib.plot.py (the fixed version, see
http://trac.wxwidgets.org/ticket/16767) is now distributed with GRASS and
modified to workaround this bug specific for wxGTK only:
http://trac.wxwidgets.org/ticket/17293

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3112#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mlennert):

Replying to [comment:7 annakrat]:
> Fixed in r69075 (and backported in r69076 and r69077). wxPython file
wx.lib.plot.py (the fixed version, see
http://trac.wxwidgets.org/ticket/16767) is now distributed with GRASS and
modified to workaround this bug specific for wxGTK only:
> http://trac.wxwidgets.org/ticket/17293

I imagine that this should only be temporary: as soon as the bug is fixed
in a new wxpython distribution, we should not maintain that code in our
code base.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3112#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>

#3112: wxgui scatterplot tool: C++ assertion "m_window" failed at
../src/gtk/dcclient.cpp(2043) in DoGetSize(): GetSize() doesn't work
without window
--------------------------+-------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: scatterplot
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by annakrat):

Replying to [comment:8 mlennert]:
> Replying to [comment:7 annakrat]:
> > Fixed in r69075 (and backported in r69076 and r69077). wxPython file
wx.lib.plot.py (the fixed version, see
http://trac.wxwidgets.org/ticket/16767) is now distributed with GRASS and
modified to workaround this bug specific for wxGTK only:
> > http://trac.wxwidgets.org/ticket/17293
>
> I imagine that this should only be temporary: as soon as the bug is
fixed in a new wxpython distribution, we should not maintain that code in
our code base.

Yes, the problem is nobody knows if and when classic wxPython 3 is
released.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3112#comment:9&gt;
GRASS GIS <https://grass.osgeo.org>