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)
import platform
import shutil
import glob
+import subprocess
import warnings
try:
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:
prefDialog.Centre()
prefDialog.Show()
prefDialog.Raise()
- wx.CallAfter(prefDialog.Show)
def OnMachineSettings(self, e):
prefDialog = preferencesDialog.machineSettingsDialog(self)
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)
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)
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)