From: daid Date: Thu, 13 Feb 2014 13:12:39 +0000 (+0100) Subject: Add some apple related stuff in wx.App. X-Git-Tag: 14.02-RC2~19 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ce5b3e7650ab9139b2a1e74c461c6fc8dba92c13;p=cura.git Add some apple related stuff in wx.App. --- diff --git a/Cura/gui/app.py b/Cura/gui/app.py index fd5fbc04..3dd6cafd 100644 --- a/Cura/gui/app.py +++ b/Cura/gui/app.py @@ -22,6 +22,8 @@ class CuraApp(wx.App): self.splash = None self.loadFiles = files + self.Bind(wx.EVT_ACTIVATE_APP, self.OnActivate) + if sys.platform.startswith('win'): #Check for an already running instance, if another instance is running load files in there from Cura.util import version @@ -60,6 +62,23 @@ class CuraApp(wx.App): except Exception as e: warnings.warn("File at {p} cannot be read: {e}".format(p=path, e=str(e))) + def MacReopenApp(self, event): + self.GetTopWindow().Raise() + + def MacHideApp(self, event): + self.GetTopWindow().Show(False) + + def MacNewFile(self): + pass + + def MacPrintFile(self, file_path): + pass + + def OnActivate(self, e): + if e.GetActive(): + self.GetTopWindow().Raise() + e.Skip() + def Win32SocketListener(self, port): import socket try: @@ -127,6 +146,7 @@ class CuraApp(wx.App): self.mainWindow = mainWindow.mainWindow() if self.splash is not None: self.splash.Show(False) + self.SetTopWindow(self.mainWindow) self.mainWindow.Show() self.mainWindow.OnDropFiles(self.loadFiles) if profile.getPreference('last_run_version') != version.getVersion(False):