[GRASS-SVN] r71332 - in grass/trunk/gui/wxpython: . core

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 6 14:56:32 PDT 2017


Author: annakrat
Date: 2017-08-06 14:56:32 -0700 (Sun, 06 Aug 2017)
New Revision: 71332

Modified:
   grass/trunk/gui/wxpython/core/globalvar.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: fix launching with Phoenix on Mac (splash screen), more robust version parsing

Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py	2017-08-06 06:21:44 UTC (rev 71331)
+++ grass/trunk/gui/wxpython/core/globalvar.py	2017-08-06 21:56:32 UTC (rev 71332)
@@ -55,10 +55,17 @@
 def CheckWxVersion(version):
     """Check wx version"""
     ver = wx.__version__
-    # don't fail on wxPython 4.0.0aX
-    if 'a' in ver: # can be removed when 4.0.0 will be out
-        ver = ver[0:ver.find('a')]
-    if list(map(int, ver.split('.'))) < version:
+    try:
+        split_ver = ver.split('.')
+        parsed_version = list(map(int, split_ver))
+    except ValueError:
+        # wxPython 4.0.0aX
+        for i, c in enumerate(split_ver[-1]):
+            if not c.isdigit():
+                break
+        parsed_version = list(map(int, split_ver[:-1])) + [int(split_ver[-1][:i])]
+
+    if parsed_version < version:
         return False
 
     return True

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2017-08-06 06:21:44 UTC (rev 71331)
+++ grass/trunk/gui/wxpython/wxgui.py	2017-08-06 21:56:32 UTC (rev 71332)
@@ -77,12 +77,21 @@
                     weight=wx.BOLD))
             splash.SetTextPosition((150, 430))
         else:
-            wx.SplashScreen(
-                bitmap=introBmp,
-                splashStyle=wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
-                milliseconds=2000,
-                parent=None,
-                id=wx.ID_ANY)
+            if globalvar.wxPythonPhoenix:
+                import wx.adv
+                wx.adv.SplashScreen(
+                    bitmap=introBmp,
+                    splashStyle=wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT,
+                    milliseconds=2000,
+                    parent=None,
+                    id=wx.ID_ANY)
+            else:
+                wx.SplashScreen(
+                    bitmap=introBmp,
+                    splashStyle=wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
+                    milliseconds=2000,
+                    parent=None,
+                    id=wx.ID_ANY)
 
         wx.Yield()
 



More information about the grass-commit mailing list