From: Youness Alaoui Date: Wed, 21 Oct 2015 18:26:33 +0000 (-0400) Subject: Do not execute a statement without catching the return value in global namespace X-Git-Tag: lulzbot-17.11~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=abd004245f8a5974693a00423cda817d5622ab89;p=cura.git Do not execute a statement without catching the return value in global namespace The issue is that any statement without a variable to catch the returned value will cause that value to be stored in the _ variable and when that happens in the global namespace, it will cause issues such as the gettext _ variable being overwritten --- diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index fe5f4893..b21b79e1 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -37,8 +37,8 @@ elif sys.platform.startswith('darwin'): frameworkIdentifier="com.apple.iokit", 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")]) + foo = objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionCreateWithName", b"i@I@o^I")]) + foo = objc.loadBundleFunctions(bundle, globals(), [("IOPMAssertionRelease", b"iI")]) def preventComputerFromSleeping(frame, prevent): if prevent: success, preventComputerFromSleeping.assertionID = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, "Cura is printing", None) diff --git a/Cura/gui/util/openglHelpers.py b/Cura/gui/util/openglHelpers.py index 0c1e9cb6..3880c364 100644 --- a/Cura/gui/util/openglHelpers.py +++ b/Cura/gui/util/openglHelpers.py @@ -14,7 +14,8 @@ from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * from OpenGL.GL import shaders -glutInit() #Hack; required before glut can be called. Not required for all OS. + +foo = glutInit() #Hack; required before glut can be called. Not required for all OS. class GLReferenceCounter(object): def __init__(self): diff --git a/Cura/gui/util/taskbar.py b/Cura/gui/util/taskbar.py index e78fc0f2..a59f73dd 100644 --- a/Cura/gui/util/taskbar.py +++ b/Cura/gui/util/taskbar.py @@ -5,11 +5,11 @@ __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AG try: import comtypes.client as cc - cc.GetModule('taskbarlib.tlb') + foo = cc.GetModule('taskbarlib.tlb') import comtypes.gen.TaskbarLib as tbl ITaskbarList3 = cc.CreateObject("{56FDF344-FD6D-11d0-958A-006097C9A090}", interface=tbl.ITaskbarList3) - ITaskbarList3.HrInit() + foo = ITaskbarList3.HrInit() #Stops displaying progress and returns the button to its normal state. Call this method with this flag to dismiss the progress bar when the operation is complete or canceled. TBPF_NOPROGRESS = 0x00000000