Browse Source

wxGUI/iclass: allow space in class name

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54487 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 years ago
parent
commit
b43bd72d9f
2 changed files with 8 additions and 0 deletions
  1. 7 0
      gui/wxpython/iclass/dialogs.py
  2. 1 0
      gui/wxpython/iclass/statistics.py

+ 7 - 0
gui/wxpython/iclass/dialogs.py

@@ -26,6 +26,7 @@ import wx.lib.scrolledpanel as scrolled
 
 from core               import globalvar
 from core.settings      import UserSettings
+from core.gcmd          import GMessage
 from gui_core.dialogs   import ElementDialog, GroupDialog
 from gui_core           import gselect
 from iclass.statistics  import Statistics, BandStatistics
@@ -243,6 +244,12 @@ class CategoryListCtrl(wx.ListCtrl,
         
     def SetVirtualData(self, row, column, text):
         attr = self.columns[column][1]
+        if attr == 'name':
+            try:
+                text.encode('ascii')
+            except UnicodeEncodeError:
+                GMessage(parent = self, message = _("Please use only ASCII characters."))
+                return
         setattr(self.statisticsDict[self.statisticsList[row]], attr, text)
         
         self.UpdateChoice()

+ 1 - 0
gui/wxpython/iclass/statistics.py

@@ -64,6 +64,7 @@ class Statistics:
         self.color = color
         
         rasterPath = grass.tempfile(create = False)
+        name = name.replace(' ', '_')
         self.rasterName = name + '_' + os.path.basename(rasterPath)
         
     def SetStatistics(self, cStatistics):