[GRASS-SVN] r54535 - grass/trunk/gui/wxpython/iclass
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 5 07:26:21 PST 2013
Author: annakrat
Date: 2013-01-05 07:26:21 -0800 (Sat, 05 Jan 2013)
New Revision: 54535
Modified:
grass/trunk/gui/wxpython/iclass/digit.py
Log:
wxGUI/iclass: do not allow the users to create training areas out of the region
Modified: grass/trunk/gui/wxpython/iclass/digit.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/digit.py 2013-01-05 14:19:16 UTC (rev 54534)
+++ grass/trunk/gui/wxpython/iclass/digit.py 2013-01-05 15:26:21 UTC (rev 54535)
@@ -21,6 +21,7 @@
from vdigit.mapwindow import VDigitWindow
from vdigit.wxdigit import IVDigit
from vdigit.wxdisplay import DisplayDriver, TYPE_AREA
+from core.gcmd import GWarning
try:
from grass.lib.gis import G_verbose, G_set_verbose
from grass.lib.vector import *
@@ -28,6 +29,8 @@
except ImportError:
pass
+import grass.script as grass
+
class IClassVDigitWindow(VDigitWindow):
"""! Class similar to VDigitWindow but specialized for wxIClass."""
def __init__(self, parent, giface, map, frame):
@@ -44,7 +47,16 @@
action = self.toolbar.GetAction()
if not action:
return
-
+
+ region = grass.region()
+ e, n = self.Pixel2Cell(event.GetPositionTuple())
+ if not ((region['s'] <= n <= region['n']) and (region['w'] <= e <= region['e'])):
+ GWarning(parent = self.parent,
+ message = _("You are trying to create a training area "
+ "outside the computational region. "
+ "Please, use g.region to set the appropriate region first."))
+ return
+
cat = self.GetCurrentCategory()
if cat is None and action == "addLine":
More information about the grass-commit
mailing list