chiark / gitweb /
Possible fix for #75 using appleScript
authorJustin Nesselrotte <jnesselr@harding.edu>
Wed, 7 Jan 2015 16:00:28 +0000 (10:00 -0600)
committerJustin Nesselrotte <jnesselr@harding.edu>
Wed, 7 Jan 2015 16:00:28 +0000 (10:00 -0600)
Cura/gui/aboutWindow.py
Cura/gui/app.py
Cura/gui/mainWindow.py
Cura/gui/preferencesDialog.py

index a930d87914e13f683992d513c9fa56f031d440fd..0db7352e8bb13c4e4e52a67aa9a356e57d637a54 100644 (file)
@@ -4,8 +4,8 @@ import wx
 import platform
 
 class aboutWindow(wx.Frame):
-       def __init__(self):
-               super(aboutWindow, self).__init__(None, title="About", style = wx.DEFAULT_DIALOG_STYLE)
+       def __init__(self, parent):
+               super(aboutWindow, self).__init__(parent, title="About", style = wx.DEFAULT_DIALOG_STYLE)
 
                wx.EVT_CLOSE(self, self.OnClose)
 
index a0bfd57a6f0f867106d7d4158d34c16a660afb8c..43f6bae51b3fa22b56a7bb89ce6b6cd1fad32efd 100644 (file)
@@ -5,6 +5,7 @@ import os
 import platform
 import shutil
 import glob
+import subprocess
 import warnings
 
 try:
@@ -162,14 +163,12 @@ class CuraApp(wx.App):
                        wx.CallAfter(self.StupidMacOSWorkaround)
 
        def StupidMacOSWorkaround(self):
-               """
-               On MacOS for some magical reason opening new frames does not work until you opened a new modal dialog and closed it.
-               If we do this from software, then, as if by magic, the bug which prevents opening extra frames is gone.
-               """
-               dlg = wx.Dialog(None)
-               wx.PostEvent(dlg, wx.CommandEvent(wx.EVT_CLOSE.typeId))
-               dlg.ShowModal()
-               dlg.Destroy()
+               subprocess.Popen(['osascript', '-e', '''\
+               tell application "System Events"
+               set procName to name of first process whose unix id is %s
+               end tell
+               tell application procName to activate
+               ''' % os.getpid()])
 
 if platform.system() == "Darwin": #Mac magic. Dragons live here. THis sets full screen options.
        try:
index c81edbf71429bf7b0a4a1ce594a0b5256de2515a..be24fe7dbdeabe75cf6a5474e7c1d9c8b5cfe7a4 100644 (file)
@@ -353,7 +353,6 @@ class mainWindow(wx.Frame):
                prefDialog.Centre()
                prefDialog.Show()
                prefDialog.Raise()
-               wx.CallAfter(prefDialog.Show)
 
        def OnMachineSettings(self, e):
                prefDialog = preferencesDialog.machineSettingsDialog(self)
@@ -572,9 +571,10 @@ class mainWindow(wx.Frame):
                        wx.MessageBox(_("You are running the latest version of Cura!"), _("Awesome!"), wx.ICON_INFORMATION)
 
        def OnAbout(self, e):
-               aboutBox = aboutWindow.aboutWindow()
+               aboutBox = aboutWindow.aboutWindow(self)
                aboutBox.Centre()
                aboutBox.Show()
+               aboutBox.Raise()
 
        def OnClose(self, e):
                profile.saveProfile(profile.getDefaultProfilePath(), True)
index fd4b209ef0a0bf2b3e7def55549fd15a6b5b8c2e..6148b3b65ed29feb4ae5c4813fbaa82e05ef89b7 100644 (file)
@@ -11,7 +11,7 @@ from Cura.util import resources
 
 class preferencesDialog(wx.Dialog):
        def __init__(self, parent):
-               super(preferencesDialog, self).__init__(None, title="Preferences")
+               super(preferencesDialog, self).__init__(parent, title="Preferences")
 
                wx.EVT_CLOSE(self, self.OnClose)
 
@@ -65,7 +65,7 @@ class preferencesDialog(wx.Dialog):
 
 class machineSettingsDialog(wx.Dialog):
        def __init__(self, parent):
-               super(machineSettingsDialog, self).__init__(None, title="Machine settings")
+               super(machineSettingsDialog, self).__init__(parent, title="Machine settings")
 
                wx.EVT_CLOSE(self, self.OnClose)