瀏覽代碼

wxGUI: color rules dialog: warning when loading invalid format

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47761 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 14 年之前
父節點
當前提交
b81f28da5b
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      gui/wxpython/gui_modules/colorrules.py

+ 7 - 1
gui/wxpython/gui_modules/colorrules.py

@@ -587,7 +587,13 @@ class ColorTable(wx.Frame):
         
         minim = maxim = count = 0
         for line in ctable.splitlines():
-            value, color = map(lambda x: x.strip(), line.split(' '))
+            try:
+                value, color = map(lambda x: x.strip(), line.split(' '))
+            except ValueError:
+                gcmd.GMessage(parent = self, message = _("Invalid color table format"))
+                self.rulesPanel.Clear()
+                return
+            
             self.rulesPanel.ruleslines[count]['value'] = value
             self.rulesPanel.ruleslines[count]['color'] = color
             self.rulesPanel.mainPanel.FindWindowById(count + 1000).SetValue(value)