[GRASS-SVN] r62269 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 16 15:25:43 PDT 2014


Author: annakrat
Date: 2014-10-16 15:25:43 -0700 (Thu, 16 Oct 2014)
New Revision: 62269

Modified:
   grass/trunk/gui/wxpython/gui_core/preferences.py
Log:
fix #2451 - pass string instead of unicode to environment

Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py	2014-10-16 09:43:08 UTC (rev 62268)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py	2014-10-16 22:25:43 UTC (rev 62269)
@@ -45,7 +45,7 @@
 from grass.script import core as grass
 
 from core          import globalvar
-from core.gcmd     import RunCommand
+from core.gcmd     import RunCommand, GError
 from core.utils    import ListOfMapsets, GetColorTables, ReadEpsgCodes, _
 from core.settings import UserSettings
 from gui_core.dialogs import SymbolDialog
@@ -1441,9 +1441,16 @@
         if dlg.ShowModal() == wx.ID_OK:
             # set default font and encoding environmental variables
             if dlg.font:
-                os.environ["GRASS_FONT"] = dlg.font
-                self.settings.Set(group = 'display', value = dlg.font,
-                                  key = 'font', subkey = 'type')
+                try:
+                    os.environ["GRASS_FONT"] = str(dlg.font)
+                    self.settings.Set(group='display', value=dlg.font,
+                                      key='font', subkey='type')
+                except UnicodeEncodeError:
+                    GError(parent=self, message=_("Failed to set default display font. "
+                                                  "Try different font."),
+                           showTraceback=True)
+                    dlg.Destroy()
+                    return
 
             if dlg.encoding and \
                     dlg.encoding != "ISO-8859-1":



More information about the grass-commit mailing list