From ce5b3e7650ab9139b2a1e74c461c6fc8dba92c13 Mon Sep 17 00:00:00 2001 From: daid Date: Thu, 13 Feb 2014 14:12:39 +0100 Subject: [PATCH] Add some apple related stuff in wx.App. --- Cura/gui/app.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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): -- 2.30.2