Sfoglia il codice sorgente

wxGUI: don't fail when addon_path contains files with non-ascii characters (TODO: fix it, now the problem is just reported)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58255 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 anni fa
parent
commit
917356c722
1 ha cambiato i file con 8 aggiunte e 3 eliminazioni
  1. 8 3
      gui/wxpython/gui_core/prompt.py

+ 8 - 3
gui/wxpython/gui_core/prompt.py

@@ -20,6 +20,7 @@ This program is free software under the GNU General Public License
 import os
 import difflib
 import codecs
+import sys
 
 import wx
 import wx.stc
@@ -392,9 +393,13 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
             try:
                 if self.toComplete['entity'] == 'command': 
                     for command in globalvar.grassCmd:
-                        if command.find(self.toComplete['cmd']) == 0:
-                            dotNumber = list(self.toComplete['cmd']).count('.') 
-                            self.autoCompList.append(command.split('.',dotNumber)[-1])
+                        try:
+                            if command.find(self.toComplete['cmd']) == 0:
+                                dotNumber = list(self.toComplete['cmd']).count('.') 
+                                self.autoCompList.append(command.split('.',dotNumber)[-1])
+                        except UnicodeDecodeError, e: # TODO: fix it
+                            sys.stderr.write(DecodeString(command) + ": " + unicode(e))
+                            
             except (KeyError, TypeError):
                 return
             self.ShowList()