[GRASS-dev] Re: [GRASS GIS] #58: wx version of v.digit relies upon non-portable hacks

GRASS GIS trac at osgeo.org
Wed Jan 21 16:16:27 EST 2009


#58: wx version of v.digit relies upon non-portable hacks
--------------------------+-------------------------------------------------
  Reporter:  marisn       |       Owner:  martinl       
      Type:  defect       |      Status:  assigned      
  Priority:  critical     |   Milestone:  6.4.0         
 Component:  default      |     Version:  6.3.0 RCs     
Resolution:               |    Keywords:  wxGUI, v.digit
  Platform:  Unspecified  |         Cpu:  Unspecified   
--------------------------+-------------------------------------------------
Comment (by glynn):

 Replying to [comment:14 glynn]:

 > It certainly won't work in general, as the Python code (toolbar.py) is
 creating a wx.PseduoDC, not the local version. I daresay that it will work
 if the local copies happen to exactly match the installed version of
 wxPython, but not otherwise.
 >
 > IOW, any local copy needs to be SWIG'd and used from Python in place of
 wx.PseudoDC.

 I've committed this in r35537.

 Drawbacks and caveats:

 1. I only SWIG'd the methods which were actually being called.

 2. I had to bypass the type-checking for wxDC*. The SWIG'd function is a
 wrapper which takes a void* instead of a wxDC*, casts it, and passes that
 to DrawToDC[Clipped]. If you pass some other pointer, you'll get a
 segfault rather than a Python exception. The alternative was to require
 that wxPython's .i files were installed, and figure out how to use them
 (without them, SWIG doesn't know how to cast e.g. wxClientDC* to wxDC*).

 3. DrawToDCClipped() requires a wx.Rect; it won't accept a tuple or list.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/58#comment:16>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list