[GRASS-SVN] r46464 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 31 04:35:54 EDT 2011


Author: martinl
Date: 2011-05-31 01:35:54 -0700 (Tue, 31 May 2011)
New Revision: 46464

Modified:
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
Log:
#1375 wxGUI: vector digitizer: cannot close (empty) vector map


Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-05-31 07:30:10 UTC (rev 46463)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-05-31 08:35:54 UTC (rev 46464)
@@ -609,7 +609,7 @@
         
         self.mapdisplay.toolbars['vdigit'].OnExit()
         if self.lmgr:
-            self.lmgr.toolbar.Enable('vdigit', enable = True)
+            self.lmgr.toolbars['tools'].Enable('vdigit', enable = True)
         
         self._setGradient()
         self.RefreshLine(self.layer_selected)

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-05-31 07:30:10 UTC (rev 46463)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2011-05-31 08:35:54 UTC (rev 46464)
@@ -571,7 +571,7 @@
         
         # deselect features in vdigit
         if self.toolbars['vdigit']:
-            self.MapWindow.display.SetSelected([])
+            self.MapWindow.digit.GetDisplay().SetSelected([])
             self.MapWindow.UpdateMap(render = True, renderVector = True)
         else:
             self.MapWindow.UpdateMap(render = True)

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-05-31 07:30:10 UTC (rev 46463)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2011-05-31 08:35:54 UTC (rev 46464)
@@ -490,8 +490,8 @@
         self.layerTree     = layerTree  # reference to layer tree associated to map display
         self.log           = log        # log area
         AbstractToolbar.__init__(self, parent)
-        self.digit         = self.parent.MapWindow.digit
-
+        self.digit         = None
+        
         # currently selected map layer for editing (reference to MapLayer instance)
         self.mapLayer = None
         # list of vector layers from Layer Manager (only in the current mapset)
@@ -640,7 +640,7 @@
         # clear tmp canvas
         if self.action['id'] != id:
             self.parent.MapWindow.ClearLines(pdc = self.parent.MapWindow.pdcTmp)
-            if self.parent.MapWindow.digit and \
+            if self.digit and \
                     len(self.parent.MapWindow.digit.GetDisplay().GetSelected()) > 0:
                 # cancel action
                 self.parent.MapWindow.OnMiddleDown(None)
@@ -709,7 +709,7 @@
         
         # disable the toolbar
         self.parent.RemoveToolbar("vdigit")
-                
+        
     def OnMoveVertex(self, event):
         """!Move line vertex"""
         Debug.msg(2, "Digittoolbar.OnMoveVertex():")
@@ -1162,7 +1162,7 @@
         self.parent.toolbars['map'].combo.SetValue (_('Digitize'))
         lmgr = self.parent.GetLayerManager()
         if lmgr:
-            lmgr.toolbar.Enable('vdigit', enable = False)
+            lmgr.toolbars['tools'].Enable('vdigit', enable = False)
         
         Debug.msg (4, "VDigitToolbar.StartEditing(): layer=%s" % mapLayer.GetName())
         
@@ -1209,7 +1209,7 @@
                                                 0)
             lmgr = self.parent.GetLayerManager()
             if lmgr:
-                lmgr.toolbar.Enable('vdigit', enable = True)
+                lmgr.toolbars['tools'].Enable('vdigit', enable = True)
                 lmgr.notebook.SetSelection(1)
             self.digit.CloseMap()
             if lmgr:
@@ -1231,8 +1231,8 @@
                 self.parent.dialogs[dialog].Close()
                 self.parent.dialogs[dialog] = None
         
-        self.digit.__del__() # FIXME: destructor is not called here (del)
-        self.digit = self.parent.MapWindow.digit = None
+        del self.digit
+        del self.parent.MapWindow.digit
         
         self.mapLayer = None
         

Modified: grass/trunk/gui/wxpython/gui_modules/wxvdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdigit.py	2011-05-31 07:30:10 UTC (rev 46463)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdigit.py	2011-05-31 08:35:54 UTC (rev 46464)
@@ -165,6 +165,7 @@
             self.InitCats()
         
     def __del__(self):
+        Debug.msg(1, "IVDigit.__del__()")
         Vect_destroy_line_struct(self.poPoints)
         self.poPoints = None
         Vect_destroy_cats_struct(self.poCats)



More information about the grass-commit mailing list