Changeset 32339


Ignore:
Timestamp:
Jul 27, 2008, 10:12:01 AM (16 years ago)
Author:
martinl
Message:

wxGUI: check for wxPython version, code simplified (merged from trunk, r32338)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py

    r32314 r32339  
    11"""
    2 MODULE:    global.py
     2@package global.py
    33
    4 PURPOSE:  Global variables
     4@brief Global variables
    55
    6            This module provide the space for global variables
    7            used in the code.
     6This module provide the space for global variables
     7used in the code.
    88
    9 AUTHOR(S): GRASS Development Team
    10            Martin Landa <landa.martin gmail.com>
     9(C) 2007 by the GRASS Development Team
    1110
    12 COPYRIGHT: (C) 2007 by the GRASS Development Team
     11This program is free software under the GNU General Public
     12License (>=v2). Read the file COPYING that comes with GRASS
     13for details.
    1314
    14            This program is free software under the GNU General Public
    15            License (>=v2). Read the file COPYING that comes with GRASS
    16            for details.
     15@author Martin Landa <landa.martin gmail.com>
    1716"""
    1817
     
    2726def CheckForWx():
    2827    """Try to import wx module and check its version"""
    29     majorVersion = 2.8
    30     minorVersion = 1.1
    31 
     28    minVersion = [2, 8, 1, 1]
    3229    try:
    3330        import wxversion
    34         wxversion.select(str(majorVersion))
     31        wxversion.select(str(minVersion[0]) + '.' + str(minVersion[1]))
    3532        import wx
    3633        version = wx.version().split(' ')[0]
    37         if float(version[:3]) < majorVersion:
    38             raise ValueError('You are using wxPython version %s' % str(version))
    39         if float(version[:3]) == 2.8 and \
    40                 float(version[4:]) < minorVersion:
    41             raise ValueError('You are using wxPython version %s' % str(version))
     34        if map(int, version.split('.')) < minVersion:
     35            raise ValueError('Your wxPython version is %s.%s.%s.%s' % tuple(version.split('.')))
    4236
    4337    except (ImportError, ValueError, wxversion.VersionError), e:
    44         print >> sys.stderr, 'ERROR: ' + str(e) + \
    45             '. wxPython >= %s.%s is required. Detailed information in README file.' % \
    46             (str(majorVersion), str(minorVersion))
     38        print >> sys.stderr, 'ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(minVersion) + \
     39            '%s. Detailed information in README file.' % (str(e))
    4740        sys.exit(1)
    4841    except locale.Error, e:
Note: See TracChangeset for help on using the changeset viewer.