瀏覽代碼

wxGUI/splashscreen: use standard one, try to show it before main app, increase timeout (#1718)

* remove testing code
Anna Petrasova 3 年之前
父節點
當前提交
f9f30f33f5
共有 1 個文件被更改,包括 15 次插入37 次删除
  1. 15 37
      gui/wxpython/wxgui.py

+ 15 - 37
gui/wxpython/wxgui.py

@@ -66,47 +66,25 @@ class GMApp(wx.App):
         introImagePath = os.path.join(globalvar.IMGDIR, "splash_screen.png")
         introImagePath = os.path.join(globalvar.IMGDIR, "splash_screen.png")
         introImage = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
         introImage = wx.Image(introImagePath, wx.BITMAP_TYPE_PNG)
         introBmp = introImage.ConvertToBitmap()
         introBmp = introImage.ConvertToBitmap()
-        if SC and sys.platform != 'darwin':
-            # AdvancedSplash is buggy on the Mac as of 2.8.12.1
-            # and raises annoying (though seemingly harmless) errors everytime
-            # the GUI is started
-            splash = SC.AdvancedSplash(bitmap=introBmp,
-                                       timeout=2000, parent=None, id=wx.ID_ANY)
-            splash.SetText(_('Starting GRASS GUI...'))
-            splash.SetTextColour(wx.Colour(45, 52, 27))
-            splash.SetTextFont(
-                wx.Font(
-                    pointSize=15,
-                    family=wx.DEFAULT,
-                    style=wx.NORMAL,
-                    weight=wx.BOLD))
-            splash.SetTextPosition((150, 430))
-        else:
-            if globalvar.wxPythonPhoenix:
-                import wx.adv as wxadv
-                wxadv.SplashScreen(
-                    bitmap=introBmp,
-                    splashStyle=wxadv.SPLASH_CENTRE_ON_SCREEN | wxadv.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.adv.SplashScreen(
+            bitmap=introBmp,
+            splashStyle=wx.adv.SPLASH_CENTRE_ON_SCREEN | wx.adv.SPLASH_TIMEOUT,
+            milliseconds=3000,
+            parent=None,
+            id=wx.ID_ANY,
+        )
 
 
         wx.GetApp().Yield()
         wx.GetApp().Yield()
 
 
-        # create and show main frame
-        from lmgr.frame import GMFrame
-        mainframe = GMFrame(parent=None, id=wx.ID_ANY,
-                            workspace=self.workspaceFile)
+        def show_main_gui():
+            # create and show main frame
+            from lmgr.frame import GMFrame
+
+            mainframe = GMFrame(parent=None, id=wx.ID_ANY, workspace=self.workspaceFile)
+            mainframe.Show()
+            self.SetTopWindow(mainframe)
 
 
-        mainframe.Show()
-        self.SetTopWindow(mainframe)
+        wx.CallAfter(show_main_gui)
 
 
         return True
         return True