# HG changeset patch # User Andrey Skvortsov # Date 1461161735 -10800 # Node ID 9c22ff9c8c06ddba8f0d2c2ee483362f6399aaee # Parent 00fb79aba7acebfe8f14bb0f2b029523990e2cbc fix splash loading with wx3.0 Previously only gray square was shown. Apparently to show splash screen several calls of wx.Yield() are necessary. Unfortunately splash.IsShowOnScreen() returns always 1 regardless of whether splash is on the screen or not. this fix is a dirty hack. It just process all events after splash is created during 0.3 seconds. diff -r 00fb79aba7ac -r 9c22ff9c8c06 Beremiz.py --- a/Beremiz.py Wed Apr 20 16:20:53 2016 +0300 +++ b/Beremiz.py Wed Apr 20 17:15:35 2016 +0300 @@ -43,6 +43,18 @@ def Bpath(*args): return os.path.join(beremiz_dir,*args) +def ShowSplashScreen(): + bmp = wx.Image(Bpath("images", "splash.png")).ConvertToBitmap() + #splash=AdvancedSplash(None, bitmap=bmp, style=wx.SPLASH_CENTRE_ON_SCREEN, timeout=4000) + splash = AdvancedSplash(None, bitmap=bmp) + + # process all events + # even the events generated by splash themself during showing + for i in range(0,30): + wx.Yield() + time.sleep(0.01); + return splash + if __name__ == '__main__': def usage(): print "\nUsage of Beremiz.py :" @@ -94,11 +106,8 @@ wx.InitAllImageHandlers() # popup splash - bmp = wx.Image(Bpath("images", "splash.png")).ConvertToBitmap() - #splash=AdvancedSplash(None, bitmap=bmp, style=wx.SPLASH_CENTRE_ON_SCREEN, timeout=4000) - splash=AdvancedSplash(None, bitmap=bmp) - wx.Yield() - + splash = ShowSplashScreen() + if updateinfo_url is not None: updateinfo = "Fetching %s" % updateinfo_url # warn for possible updates