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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 18 05:30:34 EST 2011


Author: mmetz
Date: 2011-01-18 02:30:34 -0800 (Tue, 18 Jan 2011)
New Revision: 45074

Modified:
   grass/trunk/gui/wxpython/gui_modules/gcpmanager.py
   grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py
Log:
wxGUI Georectifier: fix Mac issues and zoom

Modified: grass/trunk/gui/wxpython/gui_modules/gcpmanager.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcpmanager.py	2011-01-18 09:12:40 UTC (rev 45073)
+++ grass/trunk/gui/wxpython/gui_modules/gcpmanager.py	2011-01-18 10:30:34 UTC (rev 45074)
@@ -1676,7 +1676,7 @@
         self.bkw_rmserror = round((sumsq_bkw_err/GCPcount)**0.5,4)
         self.list.ResizeColumns()
 
-    def GetNewExtend(self, region, map = None):
+    def GetNewExtent(self, region, map = None):
 
         coord_file = utils.GetTempfile()
         newreg = { 'n' : 0.0, 's' : 0.0, 'e' : 0.0, 'w' : 0.0,}
@@ -1844,8 +1844,9 @@
             self.UpdateActive(self.TgtMapWindow)
 
         # get new N, S, E, W for target
-        newreg = self.GetNewExtend(self.SrcMap.region, 'source')
-        self.AdjustMap(newreg)
+        newreg = self.GetNewExtent(self.SrcMap.region, 'source')
+        if newreg:
+            self.AdjustMap(newreg)
 
     def OnZoomToTarget(self, event):
         """!Set source map window to match extents of target map window
@@ -1857,8 +1858,9 @@
             self.UpdateActive(self.SrcMapWindow)
 
         # get new N, S, E, W for target
-        newreg = self.GetNewExtend(self.TgtMap.region, 'target')
-        self.AdjustMap(newreg)
+        newreg = self.GetNewExtent(self.TgtMap.region, 'target')
+        if newreg:
+            self.AdjustMap(newreg)
 
     def OnZoomMenuGCP(self, event):
         """!Popup Zoom menu
@@ -1886,11 +1888,11 @@
         if self.toolbars['gcpdisp']:
             srcwidth, srcheight = self.SrcMapWindow.GetSize()
             tgtwidth, tgtheight = self.TgtMapWindow.GetSize()
-            tgtwidth = (srcwidth + tgtwidth) / 2
+            srcwidth = (srcwidth + tgtwidth) / 2
             self._mgr.GetPane("target").Hide()
             self._mgr.Update()
-            self._mgr.GetPane("source").BestSize((tgtwidth, srcheight))
-            self._mgr.GetPane("target").BestSize((tgtwidth, tgtheight))
+            self._mgr.GetPane("source").BestSize((srcwidth, srcheight))
+            self._mgr.GetPane("target").BestSize((srcwidth, tgtheight))
             if self.show_target:
                 self._mgr.GetPane("target").Show()
             self._mgr.Update()
@@ -2739,18 +2741,18 @@
                 if self.parent.show_target == False:
                     self.parent.show_target = True
                     self.parent._mgr.GetPane("target").Show()
+                    self.parent._mgr.Update()
                     self.parent.toolbars['gcpdisp'].Enable('zoommenu', enable = True)
                     self.parent.activemap.Enable()
                     self.parent.TgtMapWindow.ZoomToMap(layers = self.parent.TgtMap.GetListOfLayers())
-                    self.parent._mgr.Update()
             else: # tgt_map == ''
                 if self.parent.show_target == True:
                     self.parent.show_target = False
                     self.parent._mgr.GetPane("target").Hide()
+                    self.parent._mgr.Update()
                     self.parent.activemap.SetSelection(0)
                     self.parent.activemap.Enable(False)
                     self.parent.toolbars['gcpdisp'].Enable('zoommenu', enable = False)
-                    self.parent._mgr.Update()
 
         self.parent.UpdateColours(srcrender, srcrenderVector, tgtrender, tgtrenderVector)
 

Modified: grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py	2011-01-18 09:12:40 UTC (rev 45073)
+++ grass/trunk/gui/wxpython/gui_modules/gcpmapdisp.py	2011-01-18 10:30:34 UTC (rev 45074)
@@ -23,6 +23,7 @@
 import math
 import tempfile
 import copy
+import platform
 
 import globalvar
 if not os.getenv("GRASS_WXBUNDLED"):
@@ -296,17 +297,18 @@
 
         srcwidth, srcheight = self.SrcMapWindow.GetSize()
         tgtwidth, tgtheight = self.TgtMapWindow.GetSize()
-        tgtwidth = (srcwidth + tgtwidth) / 2
+        srcwidth = (srcwidth + tgtwidth) / 2
         self._mgr.GetPane("target").Hide()
         self._mgr.Update()
-        self._mgr.GetPane("source").BestSize((tgtwidth, tgtheight))
-        self._mgr.GetPane("target").BestSize((tgtwidth, tgtheight))
+        self._mgr.GetPane("source").BestSize((srcwidth, srcheight))
+        self._mgr.GetPane("target").BestSize((srcwidth, srcheight))
         if self.show_target:
             self._mgr.GetPane("target").Show()
         else:
             self.activemap.Enable(False)
-        # called by GCPWizard
-        #self._mgr.Update()
+        # needed by Mac OS, does not harm on Linux, breaks display on Windows
+        if platform.system() != 'Windows':
+            self._mgr.Update()
 
         #
         # Init print module and classes
@@ -321,20 +323,8 @@
         # set active map
         self.MapWindow = self.SrcMapWindow
         self.Map = self.SrcMap
-        #
-        # Init zoom history for TgtMapWindow
-        #
-        self.TgtMapWindow.ZoomHistory(self.Map.region['n'],
-                                   self.Map.region['s'],
-                                   self.Map.region['e'],
-                                   self.Map.region['w'])
-        #
-        # Init zoom history
-        #
-        self.MapWindow.ZoomHistory(self.Map.region['n'],
-                                   self.Map.region['s'],
-                                   self.Map.region['e'],
-                                   self.Map.region['w'])
+        
+        # do not init zoom history here, that happens when zooming to map(s)
 
         #
         # Re-use dialogs
@@ -456,8 +446,8 @@
             self.Map.DeleteLayer(layer)
 
         self.SrcMapWindow.UpdateMap(render=True)
-        self.TgtMapWindow.UpdateMap(render=True)
-        self._mgr.Update()
+        if self.show_target:
+            self.TgtMapWindow.UpdateMap(render=True)
         
         # update statusbar
         self.StatusbarUpdate()



More information about the grass-commit mailing list