chiark / gitweb /
c0ddee86ad68eec0fe41b4bb8725fc6413d5e03f
[cura.git] / Cura / gui / splashScreen.py
1 # coding=utf-8
2 from __future__ import absolute_import
3
4 import wx._core #We only need the core here, which speeds up the import. As we want to show the splashscreen ASAP.
5
6 from util.resources import getPathForImage
7
8
9 class splashScreen(wx.SplashScreen):
10         def __init__(self, callback):
11                 self.callback = callback
12                 bitmap = wx.Bitmap(getPathForImage('splash.png'))
13                 super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN, 0, None)
14                 wx.CallAfter(self.DoCallback)
15
16         def DoCallback(self):
17                 self.callback(self)
18                 self.Destroy()
19
20
21 def showSplash(callback):
22         app = wx.App(False)
23         splashScreen(callback)
24         app.MainLoop()
25
26
27 def testCallback(splashscreen):
28         print "Callback!"
29         import time
30
31         time.sleep(2)
32         print "!Callback"
33
34
35 def main():
36         showSplash(testCallback)
37
38 if __name__ == u'__main__':
39         main()