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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 22 03:01:49 PDT 2014


Author: martinl
Date: 2014-03-22 03:01:49 -0700 (Sat, 22 Mar 2014)
New Revision: 59289

Modified:
   grass/trunk/gui/wxpython/gui_core/ghelp.py
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
Log:
wxGUI: more fixes related to grass.version()


Modified: grass/trunk/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/ghelp.py	2014-03-22 09:47:21 UTC (rev 59288)
+++ grass/trunk/gui/wxpython/gui_core/ghelp.py	2014-03-22 10:01:49 UTC (rev 59289)
@@ -9,7 +9,7 @@
  - ghelp::HelpWindow
  - ghelp::HelpPanel
 
-(C) 2008-2012 by the GRASS Development Team
+(C) 2008-2014 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -22,6 +22,7 @@
 import platform
 import re
 import textwrap
+import sys
 
 import wx
 from wx.html import HtmlWindow
@@ -95,6 +96,8 @@
         """!Info page"""
         # get version and web site
         vInfo = grass.version()
+        if not vInfo:
+            sys.stderr.write(_("Unable to get GRASS version\n"))
         
         infoTxt = ScrolledPanel(self.aboutNotebook)
         infoTxt.SetBackgroundColour('WHITE')
@@ -109,7 +112,7 @@
                       flag = wx.ALL | wx.ALIGN_CENTER, border = 20)
         
         info = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
-                             label = 'GRASS GIS ' + vInfo['version'] + '\n')
+                             label = 'GRASS GIS ' + vInfo.get('version', _('unknown version')) + '\n')
         info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
         info.SetForegroundColour(wx.Colour(35, 142, 35))
         infoSizer.Add(item = info, proportion = 0,
@@ -137,7 +140,7 @@
                           flag = wx.ALIGN_RIGHT)
         
         infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
-                                               label = vInfo['revision']),
+                                               label = vInfo.get('revision', '?')),
                           pos = (row, 1),
                           flag = wx.ALIGN_LEFT)
         
@@ -148,7 +151,7 @@
                           flag = wx.ALIGN_RIGHT)
         
         infoGridSizer.Add(item = wx.StaticText(parent = infoTxt, id = wx.ID_ANY,
-                                               label = vInfo['build_date']),
+                                               label = vInfo.get('build_date', '?')),
                           pos = (row, 1),
                           flag = wx.ALIGN_LEFT)
         
@@ -798,5 +801,12 @@
     wx.AboutBox(info)
 
 def _grassDevTeam(start):
-    end = grass.version()['date']
+    try:
+        end = grass.version()['date']
+    except KeyError:
+        sys.stderr.write(_("Unable to get GRASS version\n"))
+        
+        from datetime import date
+        end = date.today().year
+    
     return '%(c)s %(start)s-%(end)s by the GRASS Development Team' % {'c': unichr(169), 'start': start, 'end': end}

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2014-03-22 09:47:21 UTC (rev 59288)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2014-03-22 10:01:49 UTC (rev 59289)
@@ -92,7 +92,7 @@
             try:
                 grassVersion = grass.version()['version']
             except KeyError:
-                sys.stderr.write(_("Unable to get GRASS version"))
+                sys.stderr.write(_("Unable to get GRASS version\n"))
                 grassVersion = "?"
             self.baseTitle = _("GRASS GIS %s Layer Manager") % grassVersion
 
@@ -979,7 +979,9 @@
     def OnSystemInfo(self, event):
         """!Print system information"""
         vInfo = grass.version()
-        
+        if not vInfo:
+            sys.stderr.write(_("Unable to get GRASS version\n"))
+
         # check also OSGeo4W on MS Windows
         if sys.platform == 'win32' and \
                 not os.path.exists(os.path.join(os.getenv("GISBASE"), "WinGRASS-README.url")):
@@ -1001,11 +1003,11 @@
                                 "SQLite: %s\n"
                                 "Python: %s\n"
                                 "wxPython: %s\n"
-                                "%s: %s%s\n"% (_("GRASS version"), vInfo['version'],
-                                               _("GRASS SVN Revision"), vInfo['revision'],
-                                               _("Build Date"), vInfo['build_date'],
-                                               # _("GIS Library Revision"), vInfo['libgis_revision'], vInfo['libgis_date'].split(' ', 1)[0],
-                                               vInfo['gdal'], vInfo['proj4'], vInfo['geos'], vInfo['sqlite'],
+                                "%s: %s%s\n"% (_("GRASS version"), vInfo.get('version', _('unknown version')),
+                                               _("GRASS SVN Revision"), vInfo.get('revision', '?'),
+                                               _("Build Date"), vInfo.get('build_date', '?'),
+                                               # _("GIS Library Revision"), vInfo.get('libgis_revision'], vInfo.get('libgis_date'].split(' ', 1)[0],
+                                               vInfo.get('gdal', '?'), vInfo.get('proj4', '?'), vInfo.get('geos', '?'), vInfo.get('sqlite', '?'),
                                                platform.python_version(),
                                                wx.__version__,
                                                _("Platform"), platform.platform().decode('utf8', 'replace'), osgeo4w),

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2014-03-22 09:47:21 UTC (rev 59288)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2014-03-22 10:01:49 UTC (rev 59289)
@@ -247,7 +247,7 @@
         try:
             grassVersion = grass.version()['version']
         except KeyError:
-            sys.stderr.write(_("Unable to get GRASS version"))
+            sys.stderr.write(_("Unable to get GRASS version\n"))
             grassVersion = "?"
         
         title = _("GRASS GIS %(version)s Map Display: %(id)s  - Location: %(loc)s@%(mapset)s") % \



More information about the grass-commit mailing list