瀏覽代碼

wxGUI: modify CheckForWx() to enable selection of wxPython version (eg. 2.8 over 3.0)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64148 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 年之前
父節點
當前提交
90b8913c10
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      gui/wxpython/core/globalvar.py

+ 7 - 3
gui/wxpython/core/globalvar.py

@@ -49,8 +49,11 @@ def CheckWxVersion(version = [2, 8, 11, 0]):
 
     return True
 
-def CheckForWx():
-    """Try to import wx module and check its version"""
+def CheckForWx(forceVersion = None):
+    """Try to import wx module and check its version
+
+    :param forceVersion: force wxPython version, eg. '2.8'
+    """
     if 'wx' in sys.modules.keys():
         return
 
@@ -60,7 +63,8 @@ def CheckForWx():
             import wxversion
         except ImportError as e:
             raise ImportError(e)
-        # wxversion.select(str(minVersion[0]) + '.' + str(minVersion[1]))
+        if forceVersion:
+            wxversion.select(forceVersion)
         wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1]))
         import wx
         version = wx.version().split(' ')[0]