chiark / gitweb /
2654980fa84de2afdb02b99d09e13243cbc0826b
[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         from Cura.cura import CuraApp
23         app = CuraApp(False)
24         splashScreen(callback)
25         app.MainLoop()
26
27
28 def testCallback(splashscreen):
29         print "Callback!"
30         import time
31
32         time.sleep(2)
33         print "!Callback"
34
35
36 def main():
37         showSplash(testCallback)
38
39 if __name__ == u'__main__':
40         main()