[GRASS-SVN] r59288 - in grass/trunk/gui/wxpython: lmgr mapdisp

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 22 02:47:21 PDT 2014


Author: martinl
Date: 2014-03-22 02:47:21 -0700 (Sat, 22 Mar 2014)
New Revision: 59288

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
Log:
wxGUI: don't fail if not possible to determine GRASS version


Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2014-03-21 03:52:45 UTC (rev 59287)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2014-03-22 09:47:21 UTC (rev 59288)
@@ -89,7 +89,13 @@
         if title:
             self.baseTitle = title
         else:
-            self.baseTitle = _("GRASS GIS %s Layer Manager") % grass.version()['version']
+            try:
+                grassVersion = grass.version()['version']
+            except KeyError:
+                sys.stderr.write(_("Unable to get GRASS version"))
+                grassVersion = "?"
+            self.baseTitle = _("GRASS GIS %s Layer Manager") % grassVersion
+
         self.iconsize  = (16, 16)
 
         self.displayIndex    = 0          # index value for map displays and layer trees

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2014-03-21 03:52:45 UTC (rev 59287)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2014-03-22 09:47:21 UTC (rev 59288)
@@ -244,8 +244,14 @@
 
     def SetTitle(self, displayId = 1):
         """!Set map display title"""
+        try:
+            grassVersion = grass.version()['version']
+        except KeyError:
+            sys.stderr.write(_("Unable to get GRASS version"))
+            grassVersion = "?"
+        
         title = _("GRASS GIS %(version)s Map Display: %(id)s  - Location: %(loc)s@%(mapset)s") % \
-            { 'version' : grass.version()['version'],
+            { 'version' : grassVersion,
               'id' : str(displayId),
               'loc' : grass.gisenv()["LOCATION_NAME"],
               'mapset' : grass.gisenv()["MAPSET"] }



More information about the grass-commit mailing list