[GRASS-SVN] r32339 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 27 13:12:01 EDT 2008


Author: martinl
Date: 2008-07-27 13:12:01 -0400 (Sun, 27 Jul 2008)
New Revision: 32339

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
Log:
wxGUI: check for wxPython version, code simplified (merged from trunk, r32338)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2008-07-27 17:09:08 UTC (rev 32338)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2008-07-27 17:12:01 UTC (rev 32339)
@@ -1,19 +1,18 @@
 """
-MODULE:    global.py
+ at package global.py
 
-PURPOSE:   Global variables
+ at brief Global variables
 
-           This module provide the space for global variables
-           used in the code.
+This module provide the space for global variables
+used in the code.
 
-AUTHOR(S): GRASS Development Team
-           Martin Landa <landa.martin gmail.com>
+(C) 2007 by the GRASS Development Team
 
-COPYRIGHT: (C) 2007 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.
 
-           This program is free software under the GNU General Public
-           License (>=v2). Read the file COPYING that comes with GRASS
-           for details.
+ at author Martin Landa <landa.martin gmail.com>
 """
 
 import os
@@ -26,24 +25,18 @@
 
 def CheckForWx():
     """Try to import wx module and check its version"""
-    majorVersion = 2.8
-    minorVersion = 1.1
-
+    minVersion = [2, 8, 1, 1]
     try:
         import wxversion
-        wxversion.select(str(majorVersion))
+        wxversion.select(str(minVersion[0]) + '.' + str(minVersion[1]))
         import wx
         version = wx.version().split(' ')[0]
-        if float(version[:3]) < majorVersion:
-            raise ValueError('You are using wxPython version %s' % str(version))
-        if float(version[:3]) == 2.8 and \
-                float(version[4:]) < minorVersion:
-            raise ValueError('You are using wxPython version %s' % str(version))
+        if map(int, version.split('.')) < minVersion:
+            raise ValueError('Your wxPython version is %s.%s.%s.%s' % tuple(version.split('.')))
 
     except (ImportError, ValueError, wxversion.VersionError), e:
-        print >> sys.stderr, 'ERROR: ' + str(e) + \
-            '. wxPython >= %s.%s is required. Detailed information in README file.' % \
-            (str(majorVersion), str(minorVersion))
+        print >> sys.stderr, 'ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(minVersion) + \
+            '%s. Detailed information in README file.' % (str(e))
         sys.exit(1)
     except locale.Error, e:
         print >> sys.stderr, "Unable to set locale:", e



More information about the grass-commit mailing list