diff options
author | Justin Nesselrotte <jnesselr@harding.edu> | 2015-08-25 22:37:45 +0300 |
---|---|---|
committer | Justin Nesselrotte <jnesselr@harding.edu> | 2015-08-25 22:38:35 +0300 |
commit | b61027daf0f6c95071e7c853432a40fd99a419fd (patch) | |
tree | 05d3df2b8915ee20d3f4a0c33614d72b4ac9eeb3 | |
parent | 87588dd663c148f42b2156f8ff5b492f09ce1df3 (diff) |
Fixes T45: Sleep function fixed so window can close
-rw-r--r-- | Cura/gui/printWindow.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index a9c79dd38a..434d2c0c14 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -37,15 +37,17 @@ elif sys.platform.startswith('darwin'): frameworkPath=objc.pathForFramework("/System/Library/Frameworks/IOKit.framework"), globals=globals()) objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionCreateWithName", b"i@I@o^I")]) + objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionRelease", b"iI")]) def preventComputerFromSleeping(frame, prevent): if prevent: success, preventComputerFromSleeping.assertionID = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, "Cura is printing", None) if success != kIOReturnSuccess: preventComputerFromSleeping.assertionID = None else: - if preventComputerFromSleeping.assertionID is not None: - IOPMAssertionRelease(preventComputerFromSleeping.assertionID) - preventComputerFromSleeping.assertionID = None + if hasattr(preventComputerFromSleeping, "assertionID"): + if preventComputerFromSleeping.assertionID is not None: + IOPMAssertionRelease(preventComputerFromSleeping.assertionID) + preventComputerFromSleeping.assertionID = None else: def preventComputerFromSleeping(frame, prevent): if os.path.isfile("/usr/bin/xdg-screensaver"): |