Hook Beremiz Launcher AppStart to AdvancedSplash OnPaint event in order to ensure image is beeing displayed before loading.
authorEdouard Tisserant
Mon, 19 Feb 2018 13:24:57 +0100
changeset 1947 7c2cd9d33070
parent 1946 95fa4e05e30f
child 1948 b9a3f771aaab
Hook Beremiz Launcher AppStart to AdvancedSplash OnPaint event in order to ensure image is beeing displayed before loading.
Beremiz.py
--- a/Beremiz.py	Sun Feb 18 22:29:35 2018 +0100
+++ b/Beremiz.py	Mon Feb 19 13:24:57 2018 +0100
@@ -52,11 +52,6 @@
     def Bpath(self, *args):
         return os.path.join(self.app_dir, *args)
 
-    def ShowSplashScreen(self):
-        bmp = wx.Image(self.splashPath).ConvertToBitmap()
-        self.splash = AdvancedSplash(None, bitmap=bmp, agwStyle=AS_NOTIMEOUT | AS_CENTER_ON_SCREEN)
-
-
     def Usage(self):
         print("Usage:")
         print("%s [Options] [Projectpath] [Buildpath]" % sys.argv[0])
@@ -110,7 +105,6 @@
         class BeremizApp(BeremizAppType):
             def OnInit(_self):
                 self.ShowSplashScreen()
-                wx.CallAfter(self.AppStart)
                 return True
 
         self.app = BeremizApp(redirect=self.debug)
@@ -118,6 +112,17 @@
         if wx.VERSION < (3, 0, 0):
             wx.InitAllImageHandlers()
 
+    def ShowSplashScreen(self):
+        class Splash(AdvancedSplash):
+            def OnPaint(_self, event):
+                AdvancedSplash.OnPaint(_self, event)
+                wx.CallAfter(self.AppStart)
+        bmp = wx.Image(self.splashPath).ConvertToBitmap()
+        self.splash = Splash(None, 
+                             bitmap=bmp, 
+                             agwStyle=AS_NOTIMEOUT | AS_CENTER_ON_SCREEN)
+
+
     def BackgroundInitialization(self):
         self.InitI18n()
         self.CheckUpdates()