[GRASS-SVN] r56998 - grass/trunk/gui/wxpython/vnet

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 3 05:38:12 PDT 2013


Author: turek
Date: 2013-07-03 05:38:12 -0700 (Wed, 03 Jul 2013)
New Revision: 56998

Modified:
   grass/trunk/gui/wxpython/vnet/dialogs.py
   grass/trunk/gui/wxpython/vnet/vnet_core.py
   grass/trunk/gui/wxpython/vnet/vnet_data.py
Log:
wx.vnet: cleanup fix

Modified: grass/trunk/gui/wxpython/vnet/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/dialogs.py	2013-07-03 11:06:40 UTC (rev 56997)
+++ grass/trunk/gui/wxpython/vnet/dialogs.py	2013-07-03 12:38:12 UTC (rev 56998)
@@ -158,10 +158,6 @@
 
         self.toolbars['mainToolbar'].UpdateUndoRedo(0, 0)
 
-    def  __del__(self):
-        """!Removes temp layers, unregisters handlers and graphics"""
-        #TODO onclose
-        pass
 
     def _addPanes(self):
         """!Adds toolbar pane and pane with tabs"""
@@ -759,6 +755,7 @@
 
     def OnCloseDialog(self, event):
         """!Cancel dialog"""
+        self.vnet_mgr.CleanUp()
         self.parent.dialogs['vnet'] = None
         self.Destroy()
 
@@ -1633,7 +1630,7 @@
 
         self.btnAdd.Bind(wx.EVT_BUTTON, self.OnAddButtonClick)
         self.btnRemove.Bind(wx.EVT_BUTTON, self.OnRemoveButtonClick)
-        self.btnClose.Bind(wx.EVT_BUTTON, self.OnCloseDialog)
+        self.Bind(wx.EVT_CLOSE, self.OnCloseDialog)
         self.useUTurns.Bind(wx.EVT_CHECKBOX, self.OnCheckedUTurns)
                 
         self.btnClose.SetDefault()

Modified: grass/trunk/gui/wxpython/vnet/vnet_core.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/vnet_core.py	2013-07-03 11:06:40 UTC (rev 56997)
+++ grass/trunk/gui/wxpython/vnet/vnet_core.py	2013-07-03 12:38:12 UTC (rev 56998)
@@ -60,9 +60,6 @@
         self.history = VNETHistory(self.guiparent, self.vnet_data, self.tmp_maps)
         self.analyses = VNETAnalyses(self.vnet_data, self.RunAnDone, self.goutput, self.tmp_maps)
 
-        # information, whether mouse event handler is registered in map window
-        self.handlerRegistered = False
-
         self.snap_nodes = SnappingNodes(self.vnet_data, self.tmp_maps, self.mapWin)
 
         self.ttbCreated = Signal('VNETManager.ttbCreated')
@@ -75,9 +72,15 @@
 
 
     def  __del__(self):
+        self.CleanUp()
+
+    def CleanUp(self):
         """!Removes temp layers, unregisters handlers and graphics"""
+
         update = self.tmp_maps.DeleteAllTmpMaps()
 
+        self.vnet_data.CleanUp()
+        
         if update:
             up_map_evt = gUpdateMap(render = True, renderVector = True)
             wx.PostEvent(self.mapWin, up_map_evt)

Modified: grass/trunk/gui/wxpython/vnet/vnet_data.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/vnet_data.py	2013-07-03 11:06:40 UTC (rev 56997)
+++ grass/trunk/gui/wxpython/vnet/vnet_data.py	2013-07-03 12:38:12 UTC (rev 56998)
@@ -60,6 +60,9 @@
         self.pointsChanged = self.an_points.pointsChanged
         self.parametersChanged = self.an_params.parametersChanged
 
+    def CleanUp(self):
+        self.an_points.CleanUp()
+
     def GetAnalyses(self):
         return self.an_props.used_an
 
@@ -220,6 +223,7 @@
         self.an_data = an_data
         self.an_params = an_params
 
+        # information, whether mouse event handler is registered in map window
         self.handlerRegistered = False
 
         self.pointsChanged = Signal('VNETPointsData.pointsChanged')
@@ -250,7 +254,9 @@
         self.selected = 0
 
     def  __del__(self):
+        self.CleanUp()
 
+    def CleanUp(self):
         self.mapWin.UnregisterGraphicsToDraw(self.pointsToDraw)
 
         if self.handlerRegistered:



More information about the grass-commit mailing list