[GRASS-SVN] r60325 - grass/trunk/gui/wxpython/mapswipe

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 18 11:20:34 PDT 2014


Author: annakrat
Date: 2014-05-18 11:20:34 -0700 (Sun, 18 May 2014)
New Revision: 60325

Modified:
   grass/trunk/gui/wxpython/mapswipe/frame.py
Log:
wxGUI/mapswipe: fix tracking cursor in mirror mode

Modified: grass/trunk/gui/wxpython/mapswipe/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/frame.py	2014-05-18 18:00:48 UTC (rev 60324)
+++ grass/trunk/gui/wxpython/mapswipe/frame.py	2014-05-18 18:20:34 UTC (rev 60325)
@@ -76,6 +76,10 @@
         self.firstMapWindow.mapQueried.connect(self.Query)
         self.secondMapWindow.mapQueried.connect(self.Query)
 
+        # bind tracking cursosr to mirror it
+        self.firstMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt))
+        self.secondMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt))
+
         self.MapWindow = self.firstMapWindow # current by default
         self.firstMapWindow.zoomhistory = self.secondMapWindow.zoomhistory
         self.SetBindRegions(True)
@@ -114,7 +118,7 @@
 
         wx.CallAfter(self.CallAfterInit)
 
-    def TrackCursor(self, event, showInFirst):
+    def TrackCursor(self, event):
         """!Track cursor in one window and show cross in the other.
 
         Only for mirror mode.
@@ -123,7 +127,7 @@
             event.Skip()
             return
         coords = event.GetPosition()
-        if showInFirst:
+        if event.GetId() == self.secondMapWindow.GetId():
             self.firstMapWindow.DrawMouseCursor(coords=coords)
         else:
             self.secondMapWindow.DrawMouseCursor(coords=coords)
@@ -134,8 +138,6 @@
         """!Switch tracking direction"""
         super(SwipeMapFrame, self).ActivateFirstMap(event)
 
-        self.firstMapWindow.Bind(wx.EVT_MOTION, lambda evt: self.TrackCursor(evt, showInFirst = False))
-        self.secondMapWindow.Unbind(wx.EVT_MOTION)
         self.firstMapWindow.ClearLines()
         self.firstMapWindow.Refresh()
 
@@ -143,8 +145,6 @@
         """!Switch tracking direction"""
         super(SwipeMapFrame, self).ActivateSecondMap(event)
 
-        self.secondMapWindow.Bind(wx.EVT_MOTION,  lambda evt: self.TrackCursor(evt, showInFirst = True))
-        self.firstMapWindow.Unbind(wx.EVT_MOTION)
         self.secondMapWindow.ClearLines()
         self.secondMapWindow.Refresh()
 



More information about the grass-commit mailing list