[GRASS-SVN] r60327 - grass/branches/releasebranch_7_0/gui/wxpython/mapswipe

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 18 11:35:14 PDT 2014


Author: annakrat
Date: 2014-05-18 11:35:14 -0700 (Sun, 18 May 2014)
New Revision: 60327

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/mapswipe/frame.py
Log:
wxGUI/mapswipe: fix tracking cursor in mirror mode (merged from trunk, r60325)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/mapswipe/frame.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/mapswipe/frame.py	2014-05-18 18:30:16 UTC (rev 60326)
+++ grass/branches/releasebranch_7_0/gui/wxpython/mapswipe/frame.py	2014-05-18 18:35:14 UTC (rev 60327)
@@ -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