chiark / gitweb /
Add some apple related stuff in wx.App.
authordaid <daid303@gmail.com>
Thu, 13 Feb 2014 13:12:39 +0000 (14:12 +0100)
committerdaid <daid303@gmail.com>
Thu, 13 Feb 2014 13:12:39 +0000 (14:12 +0100)
Cura/gui/app.py

index fd5fbc04097186e79f1b5d275e4026a56576dc92..3dd6cafd6e072d73d4370fc944420361d4e2fd5a 100644 (file)
@@ -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):