[GRASS-SVN] r38319 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 8 14:03:16 EDT 2009


Author: martinl
Date: 2009-07-08 14:03:16 -0400 (Wed, 08 Jul 2009)
New Revision: 38319

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
Log:
wrong coordinates after zoom to named region (trac #678)
      (merge from trunk, r38317)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2009-07-08 17:59:26 UTC (rev 38318)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2009-07-08 18:03:16 UTC (rev 38319)
@@ -230,6 +230,7 @@
             box.Add(item=label, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
             self.selection = gselect.Select(parent=self, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
                                             type='windows')
+            self.selection.SetFocus()
             box.Add(item=self.selection, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
             self.selection.Bind(wx.EVT_TEXT, self.OnSelection)
 
@@ -238,6 +239,7 @@
             box.Add(item=label, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
             self.textentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="",
                                          size=globalvar.DIALOG_TEXTCTRL_SIZE)
+            self.textentry.SetFocus()
             box.Add(item=self.textentry, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
             self.textentry.Bind(wx.EVT_TEXT, self.OnText)
 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-07-08 17:59:26 UTC (rev 38318)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-07-08 18:03:16 UTC (rev 38319)
@@ -600,7 +600,7 @@
         @param renderVector re-render vector map layer enabled for editing (used for digitizer)
         """
         start = time.clock()
-
+        
         self.resize = False
 
         # if len(self.Map.GetListOfLayers()) == 0:
@@ -2617,52 +2617,33 @@
             os.environ["GRASS_REGION"] = tmpreg
 
     def ZoomToSaved(self, event):
-        """!
-        Set display geometry to match extents in
+        """!Set display geometry to match extents in
         saved region file
         """
-
-        zoomreg = {}
-
-        dlg = gdialogs.SavedRegion(self, wx.ID_ANY, _("Zoom to saved region extents"),
+        dlg = gdialogs.SavedRegion(parent = self, id = wx.ID_ANY,
+                                   title = _("Zoom to saved region extents"),
                                    pos=wx.DefaultPosition, size=wx.DefaultSize,
                                    style=wx.DEFAULT_DIALOG_STYLE,
                                    loadsave='load')
-
+        
         if dlg.ShowModal() == wx.ID_CANCEL:
             dlg.Destroy()
             return
-
+        
         wind = dlg.wind
-
-        region = gcmd.RunCommand('g.region',
-                                 parent = self,
-                                 read = True,
-                                 flags = 'ugp',
-                                 region = wind)
         
-        if not region:
-            dlg.Destroy()
-            return
+        self.Map.GetRegion(regionName = wind,
+                           update = True)
         
-        for line in region.splitlines():
-            key, val = line.split('=')
-            zoomreg[key.strip()] = float(val.strip())
+        dlg.Destroy()
         
-        self.Map.region['n'] = zoomreg['n']
-        self.Map.region['s'] = zoomreg['s']
-        self.Map.region['e'] = zoomreg['e']
-        self.Map.region['w'] = zoomreg['w']
-
         self.ZoomHistory(self.Map.region['n'],
                          self.Map.region['s'],
                          self.Map.region['e'],
                          self.Map.region['w'])
         
         self.UpdateMap()
-        
-        dlg.Destroy()
-        
+                
     def SaveDisplayRegion(self, event):
         """!
         Save display extents to named region file.

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2009-07-08 17:59:26 UTC (rev 38318)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2009-07-08 18:03:16 UTC (rev 38319)
@@ -592,17 +592,17 @@
             self.height = 480
             return False
 
-    def GetRegion(self, rast = [], zoom = False, vect = [],
+    def GetRegion(self, rast = [], zoom = False, vect = [], regionName = None,
                   n = None, s = None, e = None, w = None, default = False,
                   update = False):
-        """
-        Get region settings (g.region -upgc)
+        """!Get region settings (g.region -upgc)
 
         Optionally extent, raster or vector map layer can be given.
-
-        @param rast raster name or None
-        @param vect vector name or None
-        @param zoom zoom to raster (ignore NULLs)
+        
+        @param rast list of raster maps
+        @param zoom zoom to raster map (ignore NULLs)
+        @param vect list of vector maps
+        @param regionName  named region or None
         @param n,s,e,w force extent
         @param default force default region settings
         @param update if True update current display region settings
@@ -610,7 +610,6 @@
         @return region settings as directory, e.g. {
         'n':'4928010', 's':'4913700', 'w':'589980',...}
         """
-
         region = {}
 
         tmpreg = os.getenv("GRASS_REGION")
@@ -628,7 +627,10 @@
 
         if default:
             cmd['flags'] += 'd'
-            
+        
+        if regionName:
+            cmd['region'] = regionName
+        
         if n:
             cmd['n'] = n
         if s:



More information about the grass-commit mailing list