Changeset 32338


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

wxGUI: check for wxPython version, code simplified, wx.version() enabled

File:
1 edited

Legend:

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

    r32328 r32338  
    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    
    30     majorVersion = 2.8
    31     minorVersion = 1.1
    32 
     28    minVersion = [2, 8, 1, 1]
    3329    try:
    34         #import wxversion
    35         #wxversion.select(str(majorVersion))
     30        import wxversion
     31        wxversion.select(str(minVersion[0]) + '.' + str(minVersion[1]))
    3632        import wx
    3733        version = wx.version().split(' ')[0]
    38         if float(version[:3]) < majorVersion:
    39             raise ValueError('You are using wxPython version %s' % str(version))
    40         if float(version[:3]) == 2.8 and \
    41                 float(version[4:]) < minorVersion:
    42             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('.')))
    4336
    4437    except (ImportError, ValueError, wxversion.VersionError), e:
    45         print >> sys.stderr, 'ERROR: ' + str(e) + \
    46             '. wxPython >= %s.%s is required. Detailed information in README file.' % \
    47             (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))
    4840        sys.exit(1)
    4941    except locale.Error, e:
Note: See TracChangeset for help on using the changeset viewer.