[GRASS-SVN] r62123 - in grass/branches/releasebranch_7_0: . gui/wxpython/vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Sep 27 19:57:54 PDT 2014
Author: annakrat
Date: 2014-09-27 19:57:54 -0700 (Sat, 27 Sep 2014)
New Revision: 62123
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/gui/wxpython/vdigit/toolbars.py
Log:
wxGUI/digitizer: fix selecting area tools (merge from trunk, r62122)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
- /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61921,61938,61967-61968,61975,61980,61986,61993,62005,62095,62099,62114
+ /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61921,61938,61967-61968,61975,61980,61986,61993,62005,62095,62099,62114,62122
Modified: grass/branches/releasebranch_7_0/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/vdigit/toolbars.py 2014-09-28 02:53:26 UTC (rev 62122)
+++ grass/branches/releasebranch_7_0/gui/wxpython/vdigit/toolbars.py 2014-09-28 02:57:54 UTC (rev 62123)
@@ -73,6 +73,7 @@
self.action = { 'desc' : '',
'type' : '',
'id' : -1 }
+ self._currentAreaActionType = None
# list of available vector maps
self.UpdateListOfLayers(updateTool = True)
@@ -306,6 +307,9 @@
def OnAddBoundary(self, event):
"""!Add boundary to the vector map layer"""
Debug.msg (2, "VDigitToolbar.OnAddBoundary()")
+
+ self._toggleAreaIfNeeded()
+
# reset temp line
if self.action['desc'] != 'addLine' or \
self.action['type'] != 'boundary':
@@ -320,11 +324,14 @@
'type' : "boundary",
'id' : self.addArea }
self.MapWindow.mouse['box'] = 'line'
+ self._currentAreaActionType = 'boundary'
def OnAddCentroid(self, event):
"""!Add centroid to the vector map layer"""
Debug.msg (2, "VDigitToolbar.OnAddCentroid()")
+ self._toggleAreaIfNeeded()
+
# update icon and tooltip
self.SetToolNormalBitmap(self.addArea, self.icons['addCentroid'].GetBitmap())
self.SetToolShortHelp(self.addArea, self.icons['addCentroid'].GetLabel())
@@ -334,10 +341,15 @@
'type' : "centroid",
'id' : self.addArea }
self.MapWindow.mouse['box'] = 'point'
+ self._currentAreaActionType = 'centroid'
def OnAddArea(self, event):
"""!Add area to the vector map layer"""
+
Debug.msg (2, "VDigitToolbar.OnAddArea()")
+
+ self._toggleAreaIfNeeded()
+
# update icon and tooltip
self.SetToolNormalBitmap(self.addArea, self.icons['addArea'].GetBitmap())
self.SetToolShortHelp(self.addArea, self.icons['addArea'].GetLabel())
@@ -347,18 +359,24 @@
'type' : "area",
'id' : self.addArea }
self.MapWindow.mouse['box'] = 'line'
+ self._currentAreaActionType = 'area'
+ def _toggleAreaIfNeeded(self):
+ """In some cases, the area tool is not toggled, we have to do it manually."""
+ if not self.GetToolState(self.addArea):
+ self.ToggleTool(self.addArea, True)
+ self.toolSwitcher.ToolChanged(self.addArea)
+
def OnAddAreaTool(self, event):
"""!Area tool activated."""
Debug.msg (2, "VDigitToolbar.OnAddAreaTool()")
-
+
# we need the previous id
- if 'type' not in self.action or \
- self.action['type'] in ('area', ''): # default action
+ if not self._currentAreaActionType or self._currentAreaActionType == 'area': # default action
self.OnAddArea(event)
- elif self.action['type'] == 'boundary':
+ elif self._currentAreaActionType == 'boundary':
self.OnAddBoundary(event)
- elif self.action['type'] == 'centroid':
+ elif self._currentAreaActionType == 'centroid':
self.OnAddCentroid(event)
def OnAddAreaMenu(self, event):
More information about the grass-commit
mailing list