From 43621ddd9542fb59d8d64b2c514c641c9b1d50d0 Mon Sep 17 00:00:00 2001 From: daid303 Date: Wed, 9 Jan 2013 08:32:49 +0100 Subject: [PATCH] Should use "is None" instead of "== None" --- Cura/gui/projectPlanner.py | 2 +- Cura/gui/util/opengl.py | 4 ++-- Cura/gui/util/taskbar.py | 6 +++--- Cura/plugins/pauseAtZ.py | 2 +- Cura/util/mesh.py | 2 +- Cura/util/profile.py | 2 +- Cura/util/validators.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index 30412b79..bfd5e675 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -842,7 +842,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas): for item in self.parent.list: if item == self.parent.selection: seenSelected = True - if item.modelDisplayList == None: + if item.modelDisplayList is None: item.modelDisplayList = glGenLists(1); if item.modelDirty: item.modelDirty = False diff --git a/Cura/gui/util/opengl.py b/Cura/gui/util/opengl.py index 18234c58..41ff00cd 100644 --- a/Cura/gui/util/opengl.py +++ b/Cura/gui/util/opengl.py @@ -66,7 +66,7 @@ def DrawMachine(machineSize): glBlendFunc(GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR) global platformMesh - if platformMesh == None: + if platformMesh is None: platformMesh = meshLoader.loadMesh(getPathForMesh('ultimaker_platform.stl')) platformMesh.setRotateMirror(0, False, False, False, False, False) @@ -456,7 +456,7 @@ def DrawGCodeLayer(layer): glVertex3f(vv3.x, vv3.y, vv3.z - zOffset) glVertex3f(vv2.x, vv2.y, vv2.z - zOffset) glEnd() - if prevNormal != None: + if prevNormal is not None: n = (normal + prevNormal) n.normalize() vv4 = v0 + n * lineWidth diff --git a/Cura/gui/util/taskbar.py b/Cura/gui/util/taskbar.py index c3dc4f3d..31df78e3 100644 --- a/Cura/gui/util/taskbar.py +++ b/Cura/gui/util/taskbar.py @@ -23,20 +23,20 @@ except: ITaskbarList3 = None def setBusy(frame, busy): - if ITaskbarList3 != None: + if ITaskbarList3 is not None: if busy: ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_INDETERMINATE) else: ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_NOPROGRESS) def setPause(frame, pause): - if ITaskbarList3 != None: + if ITaskbarList3 is not None: if pause: ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_PAUSED) else: ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_NORMAL) def setProgress(frame, done, total): - if ITaskbarList3 != None: + if ITaskbarList3 is not None: ITaskbarList3.SetProgressState(frame.GetHandle(), TBPF_NORMAL) ITaskbarList3.SetProgressValue(frame.GetHandle(), done, total) diff --git a/Cura/plugins/pauseAtZ.py b/Cura/plugins/pauseAtZ.py index 4404884a..1771e03f 100644 --- a/Cura/plugins/pauseAtZ.py +++ b/Cura/plugins/pauseAtZ.py @@ -14,7 +14,7 @@ def getValue(line, key, default = None): return default subPart = line[line.find(key) + 1:] m = re.search('^[0-9]+\.?[0-9]*', subPart) - if m == None: + if m is None: return default try: return float(m.group(0)) diff --git a/Cura/util/mesh.py b/Cura/util/mesh.py index 6be227c6..857d6201 100644 --- a/Cura/util/mesh.py +++ b/Cura/util/mesh.py @@ -106,7 +106,7 @@ class mesh(object): tree.insert(e) else: removeDict[idx] = q[0].idx - if callback != None and (idx % 100) == 0: + if callback is not None and (idx % 100) == 0: callback(idx) #print "%f: " % (time.time() - t0), "Marked %d duplicate vertexes for removal." % (len(removeDict)) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 113c6cf1..6118720f 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -344,7 +344,7 @@ def getPreference(name): if name in tempOverride: return unicode(tempOverride[name]) global globalPreferenceParser - if globalPreferenceParser == None: + if globalPreferenceParser is None: globalPreferenceParser = ConfigParser.ConfigParser() globalPreferenceParser.read(getPreferencePath()) if not globalPreferenceParser.has_option('preference', name): diff --git a/Cura/util/validators.py b/Cura/util/validators.py index 18812cd9..d226c606 100644 --- a/Cura/util/validators.py +++ b/Cura/util/validators.py @@ -20,7 +20,7 @@ class validFloat(object): def validate(self): try: f = float(eval(self.setting.GetValue().replace(',','.'), {}, {})) - if self.minValue != None and f < self.minValue: + if self.minValue is not None and f < self.minValue: return ERROR, 'This setting should not be below ' + str(self.minValue) if self.maxValue != None and f > self.maxValue: return ERROR, 'This setting should not be above ' + str(self.maxValue) -- 2.30.2