[GRASS-SVN] r57220 - in grass/trunk/gui/wxpython: . core

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 18 10:01:40 PDT 2013


Author: wenzeslaus
Date: 2013-07-18 10:01:39 -0700 (Thu, 18 Jul 2013)
New Revision: 57220

Modified:
   grass/trunk/gui/wxpython/core/gcmd.py
   grass/trunk/gui/wxpython/core/globalvar.py
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI/translations: fixing broken compilation and startup (caused by r57219)

Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py	2013-07-18 16:34:31 UTC (rev 57219)
+++ grass/trunk/gui/wxpython/core/gcmd.py	2013-07-18 17:01:39 UTC (rev 57220)
@@ -50,8 +50,15 @@
 from core.debug import Debug
 
 # cannot import from the core.utils module to avoid cross dependencies
-import gettext
-_ = gettext.translation('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale')).ugettext
+try:
+    # intended to be used also outside this module
+    import gettext
+    _ = gettext.translation('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale')).ugettext
+except IOError:
+    # using no translation silently
+    def null_gettext(string):
+        return string
+    _ = null_gettext
 
 def GetRealCmd(cmd):
     """!Return real command name - only for MS Windows

Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py	2013-07-18 16:34:31 UTC (rev 57219)
+++ grass/trunk/gui/wxpython/core/globalvar.py	2013-07-18 17:01:39 UTC (rev 57220)
@@ -28,8 +28,15 @@
 from core.debug import Debug
 
 # cannot import from the core.utils module to avoid cross dependencies
-import gettext
-_ = gettext.translation('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale')).ugettext
+try:
+    # intended to be used also outside this module
+    import gettext
+    _ = gettext.translation('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale')).ugettext
+except IOError:
+    # using no translation silently
+    def null_gettext(string):
+        return string
+    _ = null_gettext
 
 if os.path.join(ETCDIR, "python") not in sys.path:
     sys.path.append(os.path.join(ETCDIR, "python"))

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2013-07-18 16:34:31 UTC (rev 57219)
+++ grass/trunk/gui/wxpython/core/utils.py	2013-07-18 17:01:39 UTC (rev 57220)
@@ -32,11 +32,16 @@
 from core.debug import Debug
 # from core.settings import UserSettings
 
-# intended to be used also outside this module
-import gettext
-_ = gettext.translation('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale')).ugettext
+try:
+    # intended to be used also outside this module
+    import gettext
+    _ = gettext.translation('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale')).ugettext
+except IOError:
+    # using no translation silently
+    def null_gettext(string):
+        return string
+    _ = null_gettext
 
-
 def normalize_whitespace(text):
     """!Remove redundant whitespace from a string"""
     return string.join(string.split(text), ' ')

Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2013-07-18 16:34:31 UTC (rev 57219)
+++ grass/trunk/gui/wxpython/gis_set.py	2013-07-18 17:01:39 UTC (rev 57220)
@@ -28,15 +28,13 @@
 import codecs
 import getpass
 
-### i18N
-gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
-
 if __name__ == "__main__":
     gui_wx_path = os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython')
     if gui_wx_path not in sys.path:
         sys.path.append(gui_wx_path)
 
 from core import globalvar
+from core.utils import _
 import wx
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.scrolledpanel as scrolled



More information about the grass-commit mailing list