[GRASS-SVN] r57417 - in grass/trunk/gui/wxpython: gui_core mapdisp nviz
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 5 10:18:34 PDT 2013
Author: annakrat
Date: 2013-08-05 10:18:34 -0700 (Mon, 05 Aug 2013)
New Revision: 57417
Modified:
grass/trunk/gui/wxpython/gui_core/mapwindow.py
grass/trunk/gui/wxpython/mapdisp/frame.py
grass/trunk/gui/wxpython/mapdisp/mapwindow.py
grass/trunk/gui/wxpython/nviz/mapwindow.py
Log:
wxGUI: move launching decoration dialogs to frame
Modified: grass/trunk/gui/wxpython/gui_core/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapwindow.py 2013-08-05 15:10:55 UTC (rev 57416)
+++ grass/trunk/gui/wxpython/gui_core/mapwindow.py 2013-08-05 17:18:34 UTC (rev 57417)
@@ -109,9 +109,11 @@
self._giface = giface
# Emitted when someone registers as mouse event handler
- self.mouseHandlerRegistered = Signal('BufferedWindow.mouseHandlerRegistered')
+ self.mouseHandlerRegistered = Signal('MapWindow.mouseHandlerRegistered')
# Emitted when mouse event handler is unregistered
- self.mouseHandlerUnregistered = Signal('BufferedWindow.mouseHandlerUnregistered')
+ self.mouseHandlerUnregistered = Signal('MapWindow.mouseHandlerUnregistered')
+ # emitted after double click in pointer mode on legend, text, scalebar
+ self.overlayActivated = Signal('MapWindow.overlayActivated')
# mouse attributes -- position on the screen, begin and end of
# dragging, and type of drawing
Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py 2013-08-05 15:10:55 UTC (rev 57416)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py 2013-08-05 17:18:34 UTC (rev 57417)
@@ -159,6 +159,7 @@
properties=self.mapWindowProperties,
overlays=self.decorations)
self.MapWindow2D.mapQueried.connect(self.Query)
+ self.MapWindow2D.overlayActivated.connect(self._activateOverlay)
self._setUpMapWindow(self.MapWindow2D)
# manage the state of toolbars connected to mouse cursor
self.MapWindow2D.mouseHandlerRegistered.connect(
@@ -247,7 +248,8 @@
id = wx.ID_ANY, frame = self,
Map = self.Map, tree = self.tree,
properties=self.mapWindowProperties,
- lmgr = self._layerManager)
+ lmgr = self._layerManager,
+ overlays=self.decorations)
self._setUpMapWindow(self.MapWindowVDigit)
self.MapWindowVDigit.digitizingInfo.connect(
lambda text:
@@ -346,6 +348,7 @@
self.MapWindow3D.Show()
self.MapWindow3D.ResetViewHistory()
self.MapWindow3D.UpdateView(None)
+ self.MapWindow3D.overlayActivated.connect(self._activateOverlay)
else:
self.MapWindow = self.MapWindow3D
os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True, windres3 = True)
@@ -921,7 +924,19 @@
win.Show()
win.Refresh()
win.Update()
-
+
+ def _activateOverlay(self, overlayId):
+ """!Launch decoratio dialog according to overlay id.
+
+ @param overlayId id of overlay
+ """
+ if overlayId > 100:
+ self.OnAddText(None)
+ elif overlayId == 0:
+ self.AddBarscale()
+ elif overlayId == 1:
+ self.AddLegend()
+
def AddBarscale(self, cmd = None, showDialog = True):
"""!Handler for scale/arrow map decoration menu selection.
"""
Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2013-08-05 15:10:55 UTC (rev 57416)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py 2013-08-05 17:18:34 UTC (rev 57417)
@@ -138,7 +138,6 @@
self.imagedict = {}
self.select = {} # selecting/unselecting decorations for dragging
self.textdict = {} # text, font, and color indexed by id
- self.currtxtid = None # PseudoDC id for currently selected text
# zoom objects
self.zoomhistory = [] # list of past zoom extents
@@ -1184,7 +1183,6 @@
else:
pass
self.dragid = None
- self.currtxtid = None
self.mouseLeftUpPointer.emit(x=coordinates[0], y=coordinates[1])
@@ -1199,21 +1197,12 @@
screenCoords = event.GetPosition()
- if self.mouse['use'] != 'pointer' and \
- hasattr(self, "digit"):
- # select overlay decoration options dialog
+ if self.mouse['use'] == 'pointer':
+ # select overlay decoration options dialog
idlist = self.pdc.FindObjects(screenCoords[0], screenCoords[1], self.hitradius)
if idlist:
self.dragid = idlist[0]
-
- # self.ovlcoords[self.dragid] = self.pdc.GetIdBounds(self.dragid)
- if self.dragid > 100:
- self.currtxtid = self.dragid
- self.frame.OnAddText(None)
- elif self.dragid == 0:
- self.frame.AddBarscale()
- elif self.dragid == 1:
- self.frame.AddLegend()
+ self.overlayActivated.emit(overlayId=self.dragid)
coords = self.Pixel2Cell(screenCoords)
self.mouseDClick.emit(x=coords[0], y=coords[1])
Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py 2013-08-05 15:10:55 UTC (rev 57416)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py 2013-08-05 17:18:34 UTC (rev 57417)
@@ -889,13 +889,7 @@
if self.mouse['use'] != 'pointer': return
pos = event.GetPositionTuple()
self.dragid = self.FindObjects(pos[0], pos[1], self.hitradius)
-
- if self.dragid == 1:
- self.parent.AddLegend()
- elif self.dragid > 100:
- self.parent.OnAddText(None)
- else:
- return
+ self.overlayActivated.emit(overlayId=self.dragid)
def FocusPanning(self, event):
"""!Simulation of panning using focus"""
More information about the grass-commit
mailing list