[GRASS-SVN] r62270 - in grass/branches/releasebranch_7_0: . gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 16 15:32:19 PDT 2014


Author: annakrat
Date: 2014-10-16 15:32:19 -0700 (Thu, 16 Oct 2014)
New Revision: 62270

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/preferences.py
Log:
fix #2451 - pass string instead of unicode to environment (merge from trunk, r62269)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:61280,62144
   + /grass/trunk:61280,62144,62269

Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/preferences.py	2014-10-16 22:25:43 UTC (rev 62269)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/preferences.py	2014-10-16 22:32:19 UTC (rev 62270)
@@ -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