浏览代码

wxGUI: fix GetValidLayerName()
(merge https://trac.osgeo.org/grass/changeset/41962 from devbr6)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41963 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 15 年之前
父节点
当前提交
dca7f50195
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      gui/wxpython/gui_modules/utils.py

+ 8 - 6
gui/wxpython/gui_modules/utils.py

@@ -164,15 +164,17 @@ def GetValidLayerName(name):
         retName, mapset = retName.split('@')
     else:
         mapset = None
-        
-    for c in retName:
-        # c = toascii(c)
-        
+    
+    cIdx = 0
+    retNameList = list(retName)
+    for c in retNameList:
         if not (c >= 'A' and c <= 'Z') and \
                not (c >= 'a' and c <= 'z') and \
                not (c >= '0' and c <= '9'):
-            c = '_'
-        
+            retNameList[cIdx] = '_'
+        cIdx += 1
+    retName = ''.join(retNameList)
+    
     if not (retName[0] >= 'A' and retName[0] <= 'Z') and \
            not (retName[0] >= 'a' and retName[0] <= 'z'):
         retName = 'x' + retName[1:]