[GRASS-SVN] r61357 - grass/branches/releasebranch_7_0/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 22 19:35:53 PDT 2014


Author: annakrat
Date: 2014-07-22 19:35:53 -0700 (Tue, 22 Jul 2014)
New Revision: 61357

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py
Log:
wxGUI: warning not to use illegal characters in named region, #1370 (merge from trunk, r61307, r61356)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py	2014-07-23 02:31:40 UTC (rev 61356)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py	2014-07-23 02:35:53 UTC (rev 61357)
@@ -500,16 +500,17 @@
         box.Add(item = label, proportion = 0, flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
         if loadsave == 'load':
             label.SetLabel(_("Load region:"))
-            selection = Select(parent = self, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
-                               type = 'windows')
+            self._selection = Select(parent=self, size=globalvar.DIALOG_GSELECT_SIZE,
+                                     type='windows')
         elif loadsave == 'save':
             label.SetLabel(_("Save region:"))
-            selection = Select(parent = self, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
-                               type = 'windows', mapsets = [grass.gisenv()['MAPSET']], fullyQualified = False)
+            self._selection = Select(parent=self, size=globalvar.DIALOG_GSELECT_SIZE,
+                                     type='windows', mapsets=[grass.gisenv()['MAPSET']], fullyQualified = False)
         
-        box.Add(item = selection, proportion = 0, flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
-        selection.SetFocus()
-        selection.Bind(wx.EVT_TEXT, self.OnRegion)
+        box.Add(item=self._selection, proportion=0, flag=wx.ALIGN_CENTRE | wx.ALL, border=5)
+        self._selection.SetFocus()
+        if self.loadsave == 'save':
+            self._selection.Bind(wx.EVT_TEXT, self.OnRegion)
         
         sizer.Add(item = box, proportion = 0, flag = wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                   border = 5)
@@ -533,9 +534,17 @@
         self.SetSizer(sizer)
         sizer.Fit(self)
         self.Layout()
-        
+
     def OnRegion(self, event):
-        self.wind = event.GetString()
+        value = self._selection.GetValue()
+        if not grass.legal_name(value):
+            GMessage(parent=self,
+                     message=_("Name cannot begin with '.' "
+                               "and must not contain space, quotes, "
+                               "'/', '\'', '@', ',', '=', '*', "
+                               "and all other non-alphanumeric characters."))
+        else:
+            self.wind = value
 
     def GetName(self):
         """!Return region name"""



More information about the grass-commit mailing list