[GRASS-dev] empty map window/map rendering doesn't work (wxgui)

On Mar 15, 2009, at 3:19 PM, <grass-dev-request@lists.osgeo.org> wrote:

From: Huidae Cho <grass4u@gmail.com>

Date: March 15, 2009 3:21:14 PM GMT-07:00

To: grass-dev@lists.osgeo.org

Cc: grass-user@lists.osgeo.org, Martin Landa <landa.martin@gmail.com>

Subject: [GRASS-dev] empty map window/map rendering doesn’t work (wxgui)

Hi,

I’m having a similar problem to this one after updating my repository
(grass/trunk) yesterday. I installed SWIG, wxPython (version 2.8.9.2),
and wxWidgets (version 2.8.9.2, --enable-graphics_ctx), but my Cairo
version is 1.4.10, which means no g.cairocomp.

My error message looks like this:

Traceback (most recent call last):
File “/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
gnu/etc/wxpython/gui_modules/mapdisp_window.py”, line 448,
in OnPaint

self.pdc.DrawToDCClipped(dc, rgn)
File “/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
gnu/etc/wxpython/vdigit/grass7_wxvdigit.py”, line 384, in
DrawToDCClipped

def DrawToDCClipped(self, *args): return
_grass7_wxvdigit.PseudoDC_DrawToDCClipped(self, *args)
TypeError
:
in method ‘PseudoDC_DrawToDCClipped’, argument 2 of type
‘void *’
Traceback (most recent call last):
File “/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
gnu/etc/wxpython/gui_modules/mapdisp_window.py”, line 540,
in OnIdle

self.UpdateMap(render=True)
File “/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
gnu/etc/wxpython/gui_modules/mapdisp_window.py”, line 665,
in UpdateMap

self.Draw(self.pdc, self.img, drawid=id)
File “/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
gnu/etc/wxpython/gui_modules/mapdisp_window.py”, line 264,
in Draw

pdc.SetBackground(bg)
File “/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
gnu/etc/wxpython/vdigit/grass7_wxvdigit.py”, line 374, in
SetBackground

def SetBackground(self, *args): return
_grass7_wxvdigit.PseudoDC_SetBackground(self, *args)
TypeError
:
in method ‘PseudoDC_SetBackground’, argument 2 of type
‘wxBrush const &’

I took a closer look at the code of _wrap_PseudoDC_DrawToDCClipped
(grass7_wxvdigit_wrap.cpp) and SWIG_IsOK, and SWIG_ConvertPtr
(swig-1.3.38/Lib/python/pyrun.swg).

To get the above error (i.e., !SWIG_IsOK(res2)), SWIG_ConvertPtr(obj1,
SWIG_as_voidptrptr(&arg2), 0, 0) or SWIG_Python_ConvertPtrAndOwn(obj1,
SWIG_as_voidptrptr(&arg2), 0, 0) should return a negative integer. What
happens in SWIG_Python_ConvertPtrAndOwn is that it returns SWIG_ERROR
(-1) when (obj1 is NULL) or (SWIG_Python_GetSwigThis(obj1) is NULL
and flags (the last argument, 0) is 0).

This error starts from self.pdc.DrawToDCClipped(dc, rgn) in
mapdisp_window.py, and obj1 is dc in this call. Is dc NULL? No, it
isn’t. “print dc” displays “<wx._gdi.BufferedPaintDC; proxy of <Swig
Object of type ‘wxBufferedPaintDC *’ at 0x9427940> >”. Then, did
SWIG_Python_GetSwigThis return NULL? Probably…

This error occurs even before calling gwxPseudoDC_DrawToDCClipped, so I
think just chaning the prototype of DrawToDCClipped in pseudodc.i as in
revision 36252 cannot solve this problem (and, actually, it didn’t).

Could it be my wxWidget configure flags? --enable-unicode
–enable-sound --enable-graphics_ctx --with-sdl --with-opengl

Any ideas?

Thanks.
Huidae

I updated last night and am having no problems like this with 6.5 or 7 (on Mac OS X).

Michael

Martin and Michael,

After investing some time, I found a note in
swig-1.3.38/Tools/pyname_patch.py saying that they have renamed PySwig*
to SwigPy* since swig 1.3.37. wxPython 2.8.9.2 (current stable version)
still uses old naming, so we have to stick to swig >= 1.3.31 and <=
1.3.36. Now, GUI works great!

BTW, gui/wxpython/README says that swig is required only for the vector
digitizer, but I got the error below even at startup OnPaint events. Am
I missing something? Or is swig now required for the entire gui?

Thank you.
Huidae

On Sun, Mar 15, 2009 at 03:49:15PM -0700, Michael Barton wrote:

   On Mar 15, 2009, at 3:19 PM, <[1]grass-dev-request@lists.osgeo.org>
   wrote:

   From: Huidae Cho <[2]grass4u@gmail.com>

   Date: March 15, 2009 3:21:14 PM GMT-07:00

   To: [3]grass-dev@lists.osgeo.org

   Cc: [4]grass-user@lists.osgeo.org, Martin Landa
   <[5]landa.martin@gmail.com>

   Subject: [GRASS-dev] empty map window/map rendering doesn't work
   (wxgui)

     Hi,
     I'm having a similar problem to this one after updating my
     repository
     (grass/trunk) yesterday. I installed SWIG, wxPython (version
     2.8.9.2),
     and wxWidgets (version 2.8.9.2, --enable-graphics_ctx), but my Cairo
     version is 1.4.10, which means no g.cairocomp.
     My error message looks like this:
     ----------------
     Traceback (most recent call last):
      File "/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
     gnu/etc/wxpython/gui_modules/mapdisp_window.py", line 448,
     in OnPaint
     self.pdc.DrawToDCClipped(dc, rgn)
      File "/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
     gnu/etc/wxpython/vdigit/grass7_wxvdigit.py", line 384, in
     DrawToDCClipped
     def DrawToDCClipped(self, *args): return
     _grass7_wxvdigit.PseudoDC_DrawToDCClipped(self, *args)
     TypeError
     :
     in method 'PseudoDC_DrawToDCClipped', argument 2 of type
     'void *'
     Traceback (most recent call last):
      File "/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
     gnu/etc/wxpython/gui_modules/mapdisp_window.py", line 540,
     in OnIdle
     self.UpdateMap(render=True)
      File "/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
     gnu/etc/wxpython/gui_modules/mapdisp_window.py", line 665,
     in UpdateMap
     self.Draw(self.pdc, self.img, drawid=id)
      File "/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
     gnu/etc/wxpython/gui_modules/mapdisp_window.py", line 264,
     in Draw
     pdc.SetBackground(bg)
      File "/home/geni/usr/grass/grass-trunk/dist.i686-pc-linux-
     gnu/etc/wxpython/vdigit/grass7_wxvdigit.py", line 374, in
     SetBackground
     def SetBackground(self, *args): return
     _grass7_wxvdigit.PseudoDC_SetBackground(self, *args)
     TypeError
     :
     in method 'PseudoDC_SetBackground', argument 2 of type
     'wxBrush const &'
     ----------------
     I took a closer look at the code of _wrap_PseudoDC_DrawToDCClipped
     (grass7_wxvdigit_wrap.cpp) and SWIG_IsOK, and SWIG_ConvertPtr
     (swig-1.3.38/Lib/python/pyrun.swg).
     To get the above error (i.e., !SWIG_IsOK(res2)),
     SWIG_ConvertPtr(obj1,
     SWIG_as_voidptrptr(&arg2), 0, 0) or
     SWIG_Python_ConvertPtrAndOwn(obj1,
     SWIG_as_voidptrptr(&arg2), 0, 0) should return a negative integer.
     What
     happens in SWIG_Python_ConvertPtrAndOwn is that it returns
     SWIG_ERROR
     (-1) when (obj1 is NULL) or (SWIG_Python_GetSwigThis(obj1) is NULL
     and flags (the last argument, 0) is 0).
     This error starts from self.pdc.DrawToDCClipped(dc, rgn) in
     mapdisp_window.py, and obj1 is dc in this call. Is dc NULL? No, it
     isn't. "print dc" displays "<wx._gdi.BufferedPaintDC; proxy of
     <Swig
     Object of type 'wxBufferedPaintDC *' at 0x9427940> >". Then, did
     SWIG_Python_GetSwigThis return NULL? Probably...
     This error occurs even before calling gwxPseudoDC_DrawToDCClipped,
     so I
     think just chaning the prototype of DrawToDCClipped in pseudodc.i as
     in
     revision 36252 cannot solve this problem (and, actually, it didn't).
     Could it be my wxWidget configure flags? --enable-unicode
     --enable-sound --enable-graphics_ctx --with-sdl --with-opengl
     Any ideas?
     Thanks.
     Huidae

   I updated last night and am having no problems like this with 6.5 or 7
   (on Mac OS X).

   Michael

References

   1. mailto:grass-dev-request@lists.osgeo.org
   2. mailto:grass4u@gmail.com
   3. mailto:grass-dev@lists.osgeo.org
   4. mailto:grass-user@lists.osgeo.org
   5. mailto:landa.martin@gmail.com

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Hi,

2009/3/16 Huidae Cho <grass4u@gmail.com>:

After investing some time, I found a note in
swig-1.3.38/Tools/pyname_patch.py saying that they have renamed PySwig*
to SwigPy* since swig 1.3.37. wxPython 2.8.9.2 (current stable version)
still uses old naming, so we have to stick to swig >= 1.3.31 and <=
1.3.36. Now, GUI works great!

BTW, gui/wxpython/README says that swig is required only for the vector
digitizer, but I got the error below even at startup OnPaint events. Am
I missing something? Or is swig now required for the entire gui?

swig is needed for compilation of vdigit and nviz extension. Anyway in
devbr6 and trunk is used local copy of PseudoDC (from vdigit) in the
whole wxGUI. In the case that vdigit is not compiled wx.PseudoDC class
is used instead.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa