Prechádzať zdrojové kódy

wxGUI/iclass: show computation region box (fix https://trac.osgeo.org/grass/changeset/54512)
toogle computation region box for both windows
show the box by default


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54513 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 12 rokov pred
rodič
commit
452942757b

+ 12 - 0
gui/wxpython/gui_core/mapdisp.py

@@ -220,6 +220,10 @@ class MapFrameBase(wx.Frame):
     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 @@ class SingleMapFrame(MapFrameBase):
         """!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 @@ class DoubleMapFrame(MapFrameBase):
         """
         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

+ 0 - 1
gui/wxpython/iclass/digit.py

@@ -39,7 +39,6 @@ class IClassVDigitWindow(VDigitWindow):
         @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()

+ 3 - 8
gui/wxpython/iclass/frame.py

@@ -135,7 +135,8 @@ class IClassMapFrame(DoubleMapFrame):
         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,8 +152,7 @@ class IClassMapFrame(DoubleMapFrame):
         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,
@@ -169,17 +169,12 @@ class IClassMapFrame(DoubleMapFrame):
         
         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):

+ 11 - 5
gui/wxpython/mapdisp/statusbar.py

@@ -418,12 +418,16 @@ class SbShowRegion(SbItem):
         """!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 @@ class SbShowRegion(SbItem):
     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.