[GRASS-SVN] r52424 - grass/trunk/gui/wxpython/mapdisp
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 20 07:08:48 PDT 2012
Author: annakrat
Date: 2012-07-20 07:08:48 -0700 (Fri, 20 Jul 2012)
New Revision: 52424
Modified:
grass/trunk/gui/wxpython/mapdisp/mapwindow.py
Log:
wxGUI: Map Display: context menu for copying coordinates to clipboard
Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2012-07-20 14:01:33 UTC (rev 52423)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2012-07-20 14:08:48 UTC (rev 52424)
@@ -134,7 +134,25 @@
def _bindMouseEvents(self):
self.Bind(wx.EVT_MOUSE_EVENTS, self.MouseActions)
self.Bind(wx.EVT_MOTION, self.OnMotion)
-
+ self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
+
+ def OnContextMenu(self, event):
+ """!Show Map Display context menu"""
+ if hasattr(self, "digit"):
+ event.Skip()
+ return
+
+ if not hasattr(self, "popupCopyCoordinates"):
+ self.popupCopyCoordinates = wx.NewId()
+ self.Bind(wx.EVT_MENU, self.OnCopyCoordinates, id = self.popupCopyCoordinates)
+
+ # generate popup-menu
+ menu = wx.Menu()
+ menu.Append(self.popupCopyCoordinates, _("Copy coordinates to clipboard"))
+
+ self.PopupMenu(menu)
+ menu.Destroy()
+
def Draw(self, pdc, img = None, drawid = None, pdctype = 'image', coords = [0, 0, 0, 0]):
"""!Draws map and overlay decorations
"""
@@ -1316,6 +1334,17 @@
self._onMouseMoving(event)
event.Skip()
+
+ def OnCopyCoordinates(self, event):
+ """!Copy coordinates to cliboard"""
+ e, n = self.GetLastEN()
+ if wx.TheClipboard.Open():
+ do = wx.TextDataObject()
+ # TODO: put delimiter in settings and apply also for Go to in statusbar
+ delim = ';'
+ do.SetText(str(e) + delim + str(n))
+ wx.TheClipboard.SetData(do)
+ wx.TheClipboard.Close()
def ClearLines(self, pdc = None):
"""!Clears temporary drawn lines from PseudoDC
More information about the grass-commit
mailing list