super(CuraApp, self).__init__(redirect=False)
self.mainWindow = None
- self.splash = None
self.loadFiles = files
if platform.system() == "Darwin":
socketListener.daemon = True
socketListener.start()
- if sys.platform.startswith('darwin'):
- #Do not show a splashscreen on OSX, as by Apple guidelines
- self.afterSplashCallback()
- else:
- from Cura.gui import splashScreen
- self.splash = splashScreen.splashScreen(self.afterSplashCallback)
+ self.afterSplashCallback()
def MacOpenFile(self, path):
try:
except:
pass
- def destroySplashScreen(self):
- if self.splash is not None:
- self.splash.Show(False)
- self.splash.Destroy()
- self.splash = None
-
def afterSplashCallback(self):
#These imports take most of the time and thus should be done after showing the splashscreen
import webbrowser
exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'Rocktopus.stl'))
self.loadFiles = [exampleFile]
- self.destroySplashScreen()
configWizard.ConfigWizard()
if profile.getPreference('check_for_updates') == 'True':
newVersion = version.checkForNewerVersion()
if newVersion is not None:
- self.destroySplashScreen()
if wx.MessageBox(_("A new version of Cura is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES:
webbrowser.open(newVersion)
return
profile.performVersionUpgrade()
self.mainWindow = mainWindow.mainWindow()
- self.destroySplashScreen()
self.SetTopWindow(self.mainWindow)
self.mainWindow.Show()
self.mainWindow.OnDropFiles(self.loadFiles)
+++ /dev/null
-__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
-
-import wx._core #We only need the core here, which speeds up the import. As we want to show the splashscreen ASAP.
-
-from Cura.util.resources import getPathForImage
-
-class splashScreen(wx.SplashScreen):
- def __init__(self, callback):
- self.callback = callback
- bitmap = wx.Bitmap(getPathForImage('splash.png'))
- super(splashScreen, self).__init__(bitmap, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 100, None)
- # Add a timeout and call the callback in the close event to avoid having the callback called
- # before the splashscreen paint events which could cause it not to appear or to appear as a grey
- # rectangle while the app is loading
- self.Bind(wx.EVT_CLOSE, self.OnClose)
-
-
- def OnClose(self, e):
- if self.callback:
- # Avoid calling the callback twice
- cb = self.callback
- self.callback = None
- # The callback will destroy us
- wx.CallAfter(cb)
-
- e.Skip()