[GRASS-SVN] r57132 - in grass/trunk/gui/wxpython: mapdisp nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 15 02:38:46 PDT 2013


Author: annakrat
Date: 2013-07-15 02:38:46 -0700 (Mon, 15 Jul 2013)
New Revision: 57132

Modified:
   grass/trunk/gui/wxpython/mapdisp/statusbar.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
   grass/trunk/gui/wxpython/nviz/wxnviz.py
Log:
wxNVIZ: fix crash accidentally introduced in r57082

Modified: grass/trunk/gui/wxpython/mapdisp/statusbar.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/statusbar.py	2013-07-15 09:34:49 UTC (rev 57131)
+++ grass/trunk/gui/wxpython/mapdisp/statusbar.py	2013-07-15 09:38:46 UTC (rev 57132)
@@ -1026,13 +1026,25 @@
         return self.widget.IsShown()
 
     def SetValue(self, value):
+        """!Sets value of progressbar.
+        
+        Calls wx.Yield which allows
+        to update gui for displaying progress.
+        """
+        self.SafeSetValue(self, value)
+        wx.Yield()
+
+    def SafeSetValue(self, value):
+        """! Thread save SetValue method.
+        
+        Needed for wxNVIZ.
+        """
         if value > self.GetRange():
             return
         self.widget.SetValue(value)
         if value == self.GetRange():
             self.Hide()
 
-        wx.Yield()
 
     def GetWidget(self):
         """!Returns underlaying winget.

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2013-07-15 09:34:49 UTC (rev 57131)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2013-07-15 09:38:46 UTC (rev 57132)
@@ -1158,10 +1158,10 @@
         if self.render['quick'] is False:
             self.parent.GetProgressBar().Show()
             self.parent.GetProgressBar().SetRange(2)
-            self.parent.GetProgressBar().SetValue(0)
+            self.parent.GetProgressBar().SafeSetValue(0)
         
         if self.render['quick'] is False:
-            self.parent.GetProgressBar().SetValue(1)
+            self.parent.GetProgressBar().SafeSetValue(1)
             self._display.Draw(False, -1)
             if self.saveHistory:
                 self.ViewHistory(view = self.view, iview = self.iview)
@@ -1197,7 +1197,7 @@
         stop = time.clock()
         
         if self.render['quick'] is False:
-            self.parent.GetProgressBar().SetValue(2)
+            self.parent.GetProgressBar().SafeSetValue(2)
             # hide process bar
             self.parent.GetProgressBar().Hide()
         

Modified: grass/trunk/gui/wxpython/nviz/wxnviz.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/wxnviz.py	2013-07-15 09:34:49 UTC (rev 57131)
+++ grass/trunk/gui/wxpython/nviz/wxnviz.py	2013-07-15 09:38:46 UTC (rev 57132)
@@ -69,7 +69,7 @@
     if progress:
         if not progress.GetRange() == 100:
             progress.SetRange(100)
-        progress.SetValue(value)
+        progress.SafeSetValue(value)
     else:
         print value
     



More information about the grass-commit mailing list