[GRASS-SVN] r57114 - in grass/trunk/gui/wxpython: gcp gui_core mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 14 05:21:41 PDT 2013


Author: wenzeslaus
Date: 2013-07-14 05:21:41 -0700 (Sun, 14 Jul 2013)
New Revision: 57114

Modified:
   grass/trunk/gui/wxpython/gcp/mapdisplay.py
   grass/trunk/gui/wxpython/gui_core/mapdisp.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/mapdisp/mapwindow.py
Log:
wxGUI/mapwindow: introducing mouseEntered signal and removing gcp manager code

Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py	2013-07-14 12:13:34 UTC (rev 57113)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py	2013-07-14 12:21:41 UTC (rev 57114)
@@ -125,6 +125,12 @@
         self._setUpMapWindow(self.TgtMapWindow)
         self.SrcMapWindow.SetCursor(self.cursors["cross"])
         self.TgtMapWindow.SetCursor(self.cursors["cross"])
+        self.SrcMapWindow.mouseEntered.connect(
+            lambda:
+            self._setActiveMapWindow(self.SrcMapWindow))
+        self.TgtMapWindow.mouseEntered.connect(
+            lambda:
+            self._setActiveMapWindow(self.TgtMapWindow))
 
         #
         # initialize region values
@@ -637,3 +643,11 @@
     def GetMapToolbar(self):
         """!Returns toolbar with zooming tools"""
         return self.toolbars['gcpdisp']
+
+    def _setActiveMapWindow(self, mapWindow):
+        if not self.MapWindow == mapWindow:
+            self.MapWindow = mapWindow
+            self.Map = mapWindow.Map
+            self.UpdateActive(mapWindow)
+            # needed for wingrass
+            self.SetFocus()

Modified: grass/trunk/gui/wxpython/gui_core/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapdisp.py	2013-07-14 12:13:34 UTC (rev 57113)
+++ grass/trunk/gui/wxpython/gui_core/mapdisp.py	2013-07-14 12:21:41 UTC (rev 57114)
@@ -307,7 +307,6 @@
     def _setUpMapWindow(self, mapWindow):
         """Binds map windows' zoom history signals to map toolbar."""
         # enable or disable zoom history tool
-        import sys
         mapWindow.zoomHistoryAvailable.connect(
             lambda:
             self.GetMapToolbar().Enable('zoomBack', enable=True))

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2013-07-14 12:13:34 UTC (rev 57113)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2013-07-14 12:21:41 UTC (rev 57114)
@@ -391,12 +391,11 @@
         
     def AddToolbar(self, name, fixed = False):
         """!Add defined toolbar to the window
-        
-        Currently known toolbars are:
+
+        Currently recognized toolbars are:
          - 'map'     - basic map toolbar
          - 'vdigit'  - vector digitizer
-         - 'gcpdisp' - GCP Manager 
-         
+
         @param name toolbar to add
         @param fixed fixed toolbar
         """

Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py	2013-07-14 12:13:34 UTC (rev 57113)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py	2013-07-14 12:21:41 UTC (rev 57114)
@@ -95,6 +95,9 @@
         # Emitted when mouse event handler is unregistered
         self.mouseHandlerUnregistered = Signal('BufferedWindow.mouseHandlerUnregistered')
 
+        # Emitted when map enters the window
+        self.mouseEntered = Signal('BufferedWindow.mouseEntered')
+
         # event bindings
         self.Bind(wx.EVT_PAINT,           self.OnPaint)
         self.Bind(wx.EVT_SIZE,            self.OnSize)
@@ -1321,19 +1324,12 @@
 
     def OnMouseEnter(self, event):
         """!Mouse entered window and no mouse buttons were pressed
+
+        Emits the mouseEntered signal.
         """
-        if not self.frame.IsStandalone() and \
-                self.frame.GetLayerManager().gcpmanagement:
-            if self.frame.GetToolbar('gcpdisp'):
-                if not self.frame.MapWindow == self:
-                    self.frame.MapWindow = self
-                    self.frame.Map = self.Map
-                    self.frame.UpdateActive(self)
-                    # needed for wingrass
-                    self.SetFocus()
-        else:
-            event.Skip()
-        
+        self.mouseEntered.emit()
+        event.Skip()
+
     def OnMouseMoving(self, event):
         """!Motion event and no mouse buttons were pressed
         """



More information about the grass-commit mailing list