chiark / gitweb /
Merge branch 'new-settings' into devel
[cura.git] / Cura / gui / splashScreen.py
1 __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
2
3 import wx._core #We only need the core here, which speeds up the import. As we want to show the splashscreen ASAP.
4
5 from Cura.util.resources import getPathForImage
6
7 class splashScreen(wx.SplashScreen):
8         def __init__(self, callback):
9                 self.callback = callback
10                 bitmap = wx.Bitmap(getPathForImage('splash.png'))
11                 super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 100, None)
12                 # Add a timeout and call the callback in the close event to avoid having the callback called
13                 # before the splashscreen paint events which could cause it not to appear or to appear as a grey
14                 # rectangle while the app is loading
15                 self.Bind(wx.EVT_CLOSE, self.OnClose)
16
17
18         def OnClose(self, e):
19                 if self.callback:
20                         # Avoid calling the callback twice
21                         cb = self.callback
22                         self.callback = None
23                         # The callback will destroy us
24                         wx.CallAfter(cb)
25
26                 e.Skip()