[GRASS-SVN] r54513 - in grass/trunk/gui/wxpython: gui_core iclass mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 3 04:13:54 PST 2013


Author: martinl
Date: 2013-01-03 04:13:51 -0800 (Thu, 03 Jan 2013)
New Revision: 54513

Modified:
   grass/trunk/gui/wxpython/gui_core/mapdisp.py
   grass/trunk/gui/wxpython/iclass/digit.py
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/mapdisp/statusbar.py
Log:
wxGUI/iclass: show computation region box (fix r54512)
              toogle computation region box for both windows
              show the box by default


Modified: grass/trunk/gui/wxpython/gui_core/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapdisp.py	2013-01-03 11:51:26 UTC (rev 54512)
+++ grass/trunk/gui/wxpython/gui_core/mapdisp.py	2013-01-03 12:13:51 UTC (rev 54513)
@@ -220,6 +220,10 @@
     def GetWindow(self):
         """!Returns current map window"""
         raise NotImplementedError("GetWindow")
+
+    def GetWindows(self):
+        """!Returns list of map windows"""
+        raise NotImplementedError("GetWindows")
         
     def GetMapToolbar(self):
         """!Returns toolbar with zooming tools"""
@@ -416,6 +420,10 @@
         """!Returns map window"""
         return self.MapWindow
         
+    def GetWindows(self):
+        """!Returns list of map windows"""
+        return [self.MapWindow]
+
     def OnRender(self, event):
         """!Re-render map composition (each map layer)
         """
@@ -515,6 +523,10 @@
         """
         return self.MapWindow
     
+    def GetWindows(self):
+        """!Return list of all windows"""
+        return [self.firstMapWindow, self.secondMapWindow]
+    
     def ActivateFirstMap(self, event = None):
         """!Make first Map and MapWindow active and (un)bind regions of the two Maps."""
         self.Map = self.firstMap

Modified: grass/trunk/gui/wxpython/iclass/digit.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/digit.py	2013-01-03 11:51:26 UTC (rev 54512)
+++ grass/trunk/gui/wxpython/iclass/digit.py	2013-01-03 12:13:51 UTC (rev 54513)
@@ -39,7 +39,6 @@
         @param map map renderer instance
         """
         VDigitWindow.__init__(self, parent = parent, giface = giface, Map = map, frame = frame)
-        self.regionCoords = [] # show computation extent box
 
     def _onLeftDown(self, event):
         action = self.toolbar.GetAction()

Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2013-01-03 11:51:26 UTC (rev 54512)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2013-01-03 12:13:51 UTC (rev 54513)
@@ -135,7 +135,8 @@
         self.statusbarManager.AddStatusbarItem(sb.SbRender(self, statusbar = statusbar, position = 3))
         
         self.statusbarManager.Update()
-        
+        self.SetProperty('region', True) # show computation region by defaut
+
         self.trainingMapManager = MapManager(self, mapWindow = self.GetFirstWindow(),
                                              Map = self.GetFirstMap())
         self.previewMapManager = MapManager(self, mapWindow = self.GetSecondWindow(),
@@ -151,9 +152,8 @@
         self.dialogs['classManager'] = None
         # just to make digitizer happy
         self.dialogs['attributes'] = None
-        self.dialogs['category'] = None
+        self.dialogs['category']   = None
         
-        
         # PyPlot init
         self.plotPanel = PlotPanel(self, statDict = self.statisticsDict,
                                    statList = self.statisticsList)
@@ -169,17 +169,12 @@
         
         wx.CallAfter(self.AddTrainingAreaMap)
         
-        #self.dialogs['category'] = None
-        
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
 
         self.SendSizeEvent()
         
     def OnCloseWindow(self, event):
-        verbosity = os.getenv('GRASS_VERBOSE', '2')
-        os.environ['GRASS_VERBOSE'] = '0' # be silent
         self.GetFirstWindow().digit.GetDisplay().CloseMap()
-        os.environ['GRASS_VERBOSE'] = verbosity
         self.Destroy()
         
     def __del__(self):

Modified: grass/trunk/gui/wxpython/mapdisp/statusbar.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/statusbar.py	2013-01-03 11:51:26 UTC (rev 54512)
+++ grass/trunk/gui/wxpython/mapdisp/statusbar.py	2013-01-03 12:13:51 UTC (rev 54513)
@@ -418,12 +418,16 @@
         """!Shows/Hides extent (comp. region) in map canvas.
         
         Shows or hides according to checkbox value.
+
+        @todo needs refactoring
         """
         if self.widget.GetValue():
             # show extent
-            self.mapFrame.GetWindow().regionCoords = []
+            for mapWindow in self.mapFrame.GetWindows():
+                mapWindow.regionCoords = []
         elif hasattr(self.mapFrame.GetWindow(), 'regionCoords'):
-            del self.mapFrame.GetWindow().regionCoords
+            for mapWindow in self.mapFrame.GetWindows():
+                del mapWindow.regionCoords
 
         # redraw map if auto-rendering is enabled
         if self.mapFrame.IsAutoRendered():
@@ -432,10 +436,12 @@
     def SetValue(self, value):
         SbItem.SetValue(self, value)
         if value:
-            self.mapFrame.GetWindow().regionCoords = []
+            for mapWindow in self.mapFrame.GetWindows():
+                mapWindow.regionCoords = []
         elif hasattr(self.mapFrame.GetWindow(), 'regionCoords'):
-            del self.mapFrame.GetWindow().regionCoords
-            
+            for mapWindow in self.mapFrame.GetWindows():
+                mapWindow.regionCoords
+        
 class SbAlignExtent(SbItem):
     """!Checkbox to select zoom behavior.
     



More information about the grass-commit mailing list