chiark / gitweb /
Fix resources, imports and indentations.
[cura.git] / Cura / gui / splashScreen.py
index cfa4792b8a0fcb27a8781e82226c508ecfcfed96..c0ddee86ad68eec0fe41b4bb8725fc6413d5e03f 100644 (file)
@@ -1,39 +1,39 @@
-import sys, os
-#We only need the core here, which speeds up the import. As we want to show the splashscreen ASAP.
-import wx._core
+# coding=utf-8
+from __future__ import absolute_import
+
+import wx._core #We only need the core here, which speeds up the import. As we want to show the splashscreen ASAP.
+
+from util.resources import getPathForImage
 
-def getBitmapImage(filename):
-       #The frozen executable has the script files in a zip, so we need to exit another level to get to our images.
-       if hasattr(sys, 'frozen'):
-               return wx.Bitmap(os.path.normpath(os.path.join(os.path.split(__file__)[0], "../../images", filename)))
-       else:
-               return wx.Bitmap(os.path.normpath(os.path.join(os.path.split(__file__)[0], "../images", filename)))
 
 class splashScreen(wx.SplashScreen):
        def __init__(self, callback):
                self.callback = callback
-               bitmap = getBitmapImage("splash.png")
+               bitmap = wx.Bitmap(getPathForImage('splash.png'))
                super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN, 0, None)
                wx.CallAfter(self.DoCallback)
-       
+
        def DoCallback(self):
                self.callback(self)
                self.Destroy()
 
+
 def showSplash(callback):
        app = wx.App(False)
        splashScreen(callback)
        app.MainLoop()
 
+
 def testCallback(splashscreen):
        print "Callback!"
        import time
+
        time.sleep(2)
        print "!Callback"
 
+
 def main():
        showSplash(testCallback)
 
 if __name__ == u'__main__':
        main()
-