[GRASS-SVN] r54487 - grass/trunk/gui/wxpython/iclass

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 1 13:13:30 PST 2013


Author: annakrat
Date: 2013-01-01 13:13:29 -0800 (Tue, 01 Jan 2013)
New Revision: 54487

Modified:
   grass/trunk/gui/wxpython/iclass/dialogs.py
   grass/trunk/gui/wxpython/iclass/statistics.py
Log:
wxGUI/iclass: allow space in class name

Modified: grass/trunk/gui/wxpython/iclass/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/dialogs.py	2013-01-01 20:59:21 UTC (rev 54486)
+++ grass/trunk/gui/wxpython/iclass/dialogs.py	2013-01-01 21:13:29 UTC (rev 54487)
@@ -26,6 +26,7 @@
 
 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 @@
         
     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()

Modified: grass/trunk/gui/wxpython/iclass/statistics.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/statistics.py	2013-01-01 20:59:21 UTC (rev 54486)
+++ grass/trunk/gui/wxpython/iclass/statistics.py	2013-01-01 21:13:29 UTC (rev 54487)
@@ -64,6 +64,7 @@
         self.color = color
         
         rasterPath = grass.tempfile(create = False)
+        name = name.replace(' ', '_')
         self.rasterName = name + '_' + os.path.basename(rasterPath)
         
     def SetStatistics(self, cStatistics):



More information about the grass-commit mailing list