浏览代码

wxGUI: warning not to use illegal characters in named region, https://trac.osgeo.org/grass/ticket/1370

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61307 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 年之前
父节点
当前提交
72c6c2fa5a
共有 1 个文件被更改,包括 17 次插入9 次删除
  1. 17 9
      gui/wxpython/gui_core/dialogs.py

+ 17 - 9
gui/wxpython/gui_core/dialogs.py

@@ -500,16 +500,16 @@ class SavedRegion(wx.Dialog):
         box.Add(item = label, proportion = 0, flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
         box.Add(item = label, proportion = 0, flag = wx.ALIGN_CENTRE | wx.ALL, border = 5)
         if loadsave == 'load':
         if loadsave == 'load':
             label.SetLabel(_("Load region:"))
             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':
         elif loadsave == 'save':
             label.SetLabel(_("Save region:"))
             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()
+        self._selection.Bind(wx.EVT_TEXT, self.OnRegion)
         
         
         sizer.Add(item = box, proportion = 0, flag = wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
         sizer.Add(item = box, proportion = 0, flag = wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                   border = 5)
                   border = 5)
@@ -533,9 +533,17 @@ class SavedRegion(wx.Dialog):
         self.SetSizer(sizer)
         self.SetSizer(sizer)
         sizer.Fit(self)
         sizer.Fit(self)
         self.Layout()
         self.Layout()
-        
+
     def OnRegion(self, event):
     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):
     def GetName(self):
         """Return region name"""
         """Return region name"""