LGTM: various fixes for using string operator instead of numeric
This commit is contained in:
@@ -101,7 +101,7 @@ class Hole():
|
||||
|
||||
def onChanged(self, fp, prop):
|
||||
#self.App.Console.PrintMessage("Change property: " + str(prop) + "\n")
|
||||
if fp == None or fp.Support == None:
|
||||
if fp is None or fp.Support is None:
|
||||
return
|
||||
|
||||
if (prop == "HoleType" or prop == "Threaded" or prop == "Counterbore" or prop == "Countersink"
|
||||
@@ -116,7 +116,7 @@ class Hole():
|
||||
|
||||
def executePositionChanged(self, fp):
|
||||
"Change the position of the hole"
|
||||
if fp.Support == None:
|
||||
if fp.Support is None:
|
||||
return
|
||||
plane = self.feature.HoleGroove.Sketch.Support[0]
|
||||
# Get support (face)
|
||||
@@ -134,7 +134,7 @@ class Hole():
|
||||
firstLine = None
|
||||
for e in wire.Edges:
|
||||
if type(e.Curve) == Part.LineSegment:
|
||||
if firstLine == None:
|
||||
if firstLine is None:
|
||||
firstLine = e
|
||||
firstDirection = e.Curve.EndPoint - e.Curve.StartPoint
|
||||
else:
|
||||
@@ -274,7 +274,7 @@ class Hole():
|
||||
|
||||
def executeSketchChanged(self, fp):
|
||||
"Change the sketch shape of the hole"
|
||||
if self.feature.HoleGroove == None:
|
||||
if self.feature.HoleGroove is None:
|
||||
return
|
||||
if fp.HoleType == "Thru":
|
||||
# TODO: Make this more stable
|
||||
|
||||
@@ -46,7 +46,7 @@ class HoleGui:
|
||||
|
||||
# Get active document
|
||||
doc = FreeCAD.activeDocument()
|
||||
if doc == None:
|
||||
if doc is None:
|
||||
QtGui.QMessageBox.critical(mw, "No document", "A document must be open in order to create a hole feature")
|
||||
return
|
||||
|
||||
@@ -62,7 +62,7 @@ class HoleGui:
|
||||
|
||||
# Show feature preview
|
||||
body = FreeCADGui.activeView().getActiveObject("pdbody");
|
||||
if body == None:
|
||||
if body is None:
|
||||
QtGui.QMessageBox.critical(mw, "No active body", "Please create a body or make a body active")
|
||||
|
||||
feature = doc.addObject("Part::FeaturePython","Hole")
|
||||
|
||||
@@ -94,7 +94,7 @@ class TaskHole:
|
||||
def setupUi(self):
|
||||
mw = self.getMainWindow()
|
||||
form = mw.findChild(QtGui.QWidget, "TaskHole")
|
||||
if form == None:
|
||||
if form is None:
|
||||
return
|
||||
form.tabWidget = form.findChild(QtGui.QTabWidget, "tabWidget")
|
||||
# Type
|
||||
@@ -367,7 +367,7 @@ class TaskHole:
|
||||
self.form.spinThreadLength.setValue(self.feature.ThreadLength)
|
||||
# Position
|
||||
self.form.buttonSupport.setText("Face")
|
||||
if self.feature.Support == None:
|
||||
if self.feature.Support is None:
|
||||
# First-time initialization
|
||||
selection = FreeCADGui.Selection.getSelectionEx()
|
||||
self.feature.Support = (selection[0].Object, selection[0].SubElementNames)
|
||||
|
||||
@@ -56,10 +56,9 @@ class DistanceBolt:
|
||||
|
||||
def makeDistanceBolt():
|
||||
doc = FreeCAD.activeDocument()
|
||||
if doc == None:
|
||||
if doc is None:
|
||||
doc = FreeCAD.newDocument()
|
||||
bolt=doc.addObject("Part::FeaturePython","Distance_Bolt")
|
||||
bolt.Label = "Distance bolt"
|
||||
DistanceBolt(bolt)
|
||||
bolt.ViewObject.Proxy=0
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class Epitrochoid:
|
||||
|
||||
def makeEpitrochoid():
|
||||
doc = FreeCAD.activeDocument()
|
||||
if doc == None:
|
||||
if doc is None:
|
||||
doc = FreeCAD.newDocument()
|
||||
epitrochoid=doc.addObject("Part::FeaturePython","Epitrochoid") #add object to document
|
||||
epitrochoid.Label = "Epitrochoid"
|
||||
|
||||
@@ -17,8 +17,8 @@ def proceed():
|
||||
|
||||
def compute():
|
||||
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
|
||||
|
||||
if FreeCAD.ActiveDocument==None:
|
||||
|
||||
if FreeCAD.ActiveDocument is None:
|
||||
FreeCAD.newDocument("Gear")
|
||||
|
||||
oldDocumentObjects=App.ActiveDocument.Objects
|
||||
|
||||
@@ -64,7 +64,7 @@ class BoxCylinder:
|
||||
|
||||
def makeParallelepiped():
|
||||
doc = FreeCAD.activeDocument()
|
||||
if doc == None:
|
||||
if doc is None:
|
||||
doc = FreeCAD.newDocument()
|
||||
obj=doc.addObject("Part::FeaturePython","Parallelepiped")
|
||||
obj.Label = "Parallelepiped"
|
||||
@@ -74,7 +74,7 @@ def makeParallelepiped():
|
||||
|
||||
def makeBoxCylinder():
|
||||
doc = FreeCAD.activeDocument()
|
||||
if doc == None:
|
||||
if doc is None:
|
||||
doc = FreeCAD.newDocument()
|
||||
cyl=doc.addObject("Part::Cylinder","Cylinder")
|
||||
cyl.Radius=16.0
|
||||
|
||||
@@ -39,7 +39,7 @@ class MySpring:
|
||||
|
||||
def makeMySpring():
|
||||
doc = FreeCAD.activeDocument()
|
||||
if doc == None:
|
||||
if doc is None:
|
||||
doc = FreeCAD.newDocument()
|
||||
spring=doc.addObject("Part::FeaturePython","My_Spring")
|
||||
spring.Label = "My Spring"
|
||||
|
||||
@@ -213,7 +213,7 @@ class Shaft:
|
||||
if which in self.Fstr:
|
||||
ax = self.Fstr.index(which)
|
||||
text = self.Qstrings[ax]
|
||||
if self.F[ax] == None:
|
||||
if self.F[ax] is None:
|
||||
# No data
|
||||
return
|
||||
if self.F[ax].name in self.diagrams:
|
||||
@@ -226,7 +226,7 @@ class Shaft:
|
||||
elif which in self.Mstr:
|
||||
ax = self.Mstr.index(which)
|
||||
text = self.Mstrings[ax]
|
||||
if self.M[ax] == None:
|
||||
if self.M[ax] is None:
|
||||
# No data
|
||||
return
|
||||
if self.M[ax].name in self.diagrams:
|
||||
@@ -239,7 +239,7 @@ class Shaft:
|
||||
elif which in self.wstr:
|
||||
ax = self.wstr.index(which)
|
||||
text = self.wstrings[ax]
|
||||
if self.w[ax] == None:
|
||||
if self.w[ax] is None:
|
||||
# No data
|
||||
return
|
||||
if self.w[ax].name in self.diagrams:
|
||||
@@ -252,7 +252,7 @@ class Shaft:
|
||||
elif which in self.sigmaNstr:
|
||||
ax = self.sigmaNstr.index(which)
|
||||
text = self.sigmaNstrings[ax]
|
||||
if self.sigmaN[ax] == None:
|
||||
if self.sigmaN[ax] is None:
|
||||
# No data
|
||||
return
|
||||
if self.sigmaN[ax].name in self.diagrams:
|
||||
@@ -265,7 +265,7 @@ class Shaft:
|
||||
elif which in self.sigmaBstr:
|
||||
ax = self.sigmaBstr.index(which)
|
||||
text = self.sigmaBstrings[ax]
|
||||
if self.sigmaB[ax] == None:
|
||||
if self.sigmaB[ax] is None:
|
||||
# No data
|
||||
return
|
||||
if self.sigmaB[ax].name in self.diagrams:
|
||||
|
||||
@@ -39,7 +39,7 @@ class TaskWizardShaft:
|
||||
# Get active document or create a new one
|
||||
# Important because when setting the default data in WizardShaftTable() the
|
||||
# updateSketch() slot will be activated and it relies on finding a valid document
|
||||
if self.doc == None:
|
||||
if self.doc is None:
|
||||
self.Gui.activateWorkbench("PartDesignWorkbench")
|
||||
self.doc = self.App.newDocument()
|
||||
# Grab the newly created feature window
|
||||
|
||||
@@ -198,7 +198,7 @@ class WizardShaftTable:
|
||||
self.editedValue = value
|
||||
|
||||
def slotEditingFinished(self):
|
||||
if self.editedRow == None:
|
||||
if self.editedRow is None:
|
||||
return
|
||||
rowName = self.rowDictReverse[self.editedRow]
|
||||
if rowName is None:
|
||||
|
||||
Reference in New Issue
Block a user