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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 27 07:54:24 EST 2010


Author: martinl
Date: 2010-02-27 07:54:23 -0500 (Sat, 27 Feb 2010)
New Revision: 41197

Modified:
   grass/trunk/gui/wxpython/gui_modules/georect.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
Log:
wxGUI: fix georect (#728)


Modified: grass/trunk/gui/wxpython/gui_modules/georect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/georect.py	2010-02-27 11:39:37 UTC (rev 41196)
+++ grass/trunk/gui/wxpython/gui_modules/georect.py	2010-02-27 12:54:23 UTC (rev 41197)
@@ -194,6 +194,7 @@
             self.xy_mapdisp.SetTitle(_("GRASS GIS Map Display: 1" +
                                        " - Location: " + self.newlocation +
                                        " (source location)"))
+            self.xy_mapdisp.SetName("GRMapWindow")
 
             self.gcpmgr.SetMapDisplay(self.xy_mapdisp)
             
@@ -209,6 +210,7 @@
             #
             # show new display & draw map
             #
+            self.xy_mapdisp.toolbars['georect'].OnZoomMap(None)
             self.xy_mapdisp.CenterOnScreen()
             self.xy_mapdisp.Show()
             self.gcpmgr.Centre()

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py	2010-02-27 11:39:37 UTC (rev 41196)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py	2010-02-27 12:54:23 UTC (rev 41197)
@@ -2561,7 +2561,10 @@
                       (self.zoomhistory))
         
         if len(self.zoomhistory) > 1:
-            self.parent.toolbars['map'].Enable('zoomback')
+            if self.parent.GetName() == 'MapWindow':
+                self.parent.toolbars['map'].Enable('zoomback')
+            else:
+                self.parent.toolbars['georect'].Enable('zoomback')
         
         return removed
 

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2010-02-27 11:39:37 UTC (rev 41196)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2010-02-27 12:54:23 UTC (rev 41197)
@@ -46,6 +46,8 @@
     def __init__(self, parent):
         self.parent = parent
         wx.ToolBar.__init__(self, parent = self.parent, id = wx.ID_ANY)
+    
+        self.action = dict()
         
         self.Bind(wx.EVT_TOOL, self.OnTool)
         
@@ -138,7 +140,20 @@
         if platform.system() == 'Windows':
             size = self.GetBestSize()
             self.SetSize((size[0] + width, size[1]))
+
+    def Enable(self, tool, enable = True):
+        """!Enable defined tool
         
+        @param tool name
+        @param enable True to enable otherwise disable tool
+        """
+        try:
+            id = getattr(self, tool)
+        except AttributeError:
+            return
+        
+        self.EnableTool(id, enable)
+        
 class MapToolbar(AbstractToolbar):
     """!Map Display toolbar
     """
@@ -168,10 +183,10 @@
         self.combo.Hide()
         self.combo.Show()
         
-        # default action
         self.action = { 'id' : self.pointer }
         self.defaultAction = { 'id' : self.pointer,
                                'bind' : self.parent.OnPointer }
+        
         self.OnTool(None)
         
         self.EnableTool(self.zoomback, False)
@@ -286,19 +301,6 @@
                      self.printmap):
             self.EnableTool(tool, enabled)
         
-    def Enable(self, tool, enable = True):
-        """!Enable defined tool
-        
-        @param tool name
-        @param enable True to enable otherwise disable tool
-        """
-        try:
-            id = getattr(self, tool)
-        except AttributeError:
-            return
-        
-        self.EnableTool(self.zoomback, enable)
-
 class GRToolbar(AbstractToolbar):
     """
     Georectification toolbar
@@ -310,7 +312,7 @@
         @param parent reference to MapFrame
         @param mapcontent reference to render.Map (registred by MapFrame)
         """
-        self.mapcontent = map
+        self.mapcontent = mapcontent
         AbstractToolbar.__init__(self, parent)
         
         self.InitToolbar(self.ToolbarData())
@@ -318,6 +320,14 @@
         # realize the toolbar
         self.Realize()
         
+        self.action = { 'id' : self.gcpset }
+        self.defaultAction = { 'id' : self.gcpset,
+                               'bind' : self.parent.OnPointer }
+        
+        self.OnTool(None)
+        
+        self.EnableTool(self.zoomback, False)
+        
     def ToolbarData(self):
         """!Toolbar data"""
         self.displaymap = wx.NewId()
@@ -365,9 +375,9 @@
     def OnZoomMap(self, event):
         """!Zoom to selected map"""
         self.parent.MapWindow.ZoomToMap(layers = self.mapcontent.GetListOfLayers())
+        if event:
+            event.Skip()
         
-        event.Skip()
-        
 class GCPToolbar(AbstractToolbar):
     """!
     Toolbar for managing ground control points during georectification



More information about the grass-commit mailing list