From e2299c31d2515e113a5ffbdf5ffc147797d586ce Mon Sep 17 00:00:00 2001 From: Daid Date: Thu, 29 Aug 2013 14:07:00 +0200 Subject: [PATCH] Solve issue when objc fails for the 10.000 time on stupid MacOS. --- Cura/gui/app.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Cura/gui/app.py b/Cura/gui/app.py index f3c8b90e..5ab0e28d 100644 --- a/Cura/gui/app.py +++ b/Cura/gui/app.py @@ -91,20 +91,24 @@ class CuraApp(wx.App): setFullScreenCapable(self.mainWindow) if platform.system() == "Darwin": - import ctypes, objc - _objc = ctypes.PyDLL(objc._objc.__file__) - - # PyObject *PyObjCObject_New(id objc_object, int flags, int retain) - _objc.PyObjCObject_New.restype = ctypes.py_object - _objc.PyObjCObject_New.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int] - - def setFullScreenCapable(frame): - frameobj = _objc.PyObjCObject_New(frame.GetHandle(), 0, 1) - - NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7 - window = frameobj.window() - newBehavior = window.collectionBehavior() | NSWindowCollectionBehaviorFullScreenPrimary - window.setCollectionBehavior_(newBehavior) + try: + import ctypes, objc + _objc = ctypes.PyDLL(objc._objc.__file__) + + # PyObject *PyObjCObject_New(id objc_object, int flags, int retain) + _objc.PyObjCObject_New.restype = ctypes.py_object + _objc.PyObjCObject_New.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int] + + def setFullScreenCapable(frame): + frameobj = _objc.PyObjCObject_New(frame.GetHandle(), 0, 1) + + NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7 + window = frameobj.window() + newBehavior = window.collectionBehavior() | NSWindowCollectionBehaviorFullScreenPrimary + window.setCollectionBehavior_(newBehavior) + except: + def setFullScreenCapable(frame): + pass else: def setFullScreenCapable(frame): -- 2.30.2