Draft: Fix 'testing inequality to None' syntax (#7275)
* Draft: Fix 'testing inequality to None' syntax - Substitute `is not None` for `!= None` - Trim trailing whitespace on touched files
This commit is contained in:
@@ -819,7 +819,7 @@ class DraftToolBar:
|
||||
pb = []
|
||||
for i in range(self.layout.count()):
|
||||
w = self.layout.itemAt(i).widget()
|
||||
if w != None and w.inherits('QPushButton'):
|
||||
if w is not None and w.inherits('QPushButton'):
|
||||
pb.append(w)
|
||||
|
||||
for i in pb:
|
||||
@@ -1770,7 +1770,7 @@ class DraftToolBar:
|
||||
dp = None
|
||||
if point:
|
||||
dp = point
|
||||
if self.relativeMode: # and (last != None):
|
||||
if self.relativeMode: # and (last is not None):
|
||||
if self.globalMode:
|
||||
dp = point - last
|
||||
else:
|
||||
@@ -2206,7 +2206,7 @@ class DraftToolBar:
|
||||
"Draft_ShapeString","Draft_BezCurve"]
|
||||
self.title = "Create objects"
|
||||
def shouldShow(self):
|
||||
return (FreeCAD.ActiveDocument != None) and (not FreeCADGui.Selection.getSelection())
|
||||
return (FreeCAD.ActiveDocument is not None) and (not FreeCADGui.Selection.getSelection())
|
||||
|
||||
class DraftModifyWatcher:
|
||||
def __init__(self):
|
||||
@@ -2217,7 +2217,7 @@ class DraftToolBar:
|
||||
"Draft_Drawing"]
|
||||
self.title = "Modify objects"
|
||||
def shouldShow(self):
|
||||
return (FreeCAD.ActiveDocument != None) and (FreeCADGui.Selection.getSelection() != [])
|
||||
return (FreeCAD.ActiveDocument is not None) and (FreeCADGui.Selection.getSelection() != [])
|
||||
|
||||
# OBSOLETE
|
||||
#class DraftTrayWatcher:
|
||||
@@ -2254,7 +2254,7 @@ class DraftToolBar:
|
||||
self.draftWidget.toggleViewAction().setVisible(True)
|
||||
|
||||
def Deactivated(self):
|
||||
if (FreeCAD.activeDraftCommand != None):
|
||||
if (FreeCAD.activeDraftCommand is not None):
|
||||
self.continueMode = False
|
||||
FreeCAD.activeDraftCommand.finish()
|
||||
if self.taskmode:
|
||||
|
||||
@@ -153,7 +153,7 @@ class Dimension(gui_base_original.Creator):
|
||||
if v.Point == edge.Vertexes[1].Point:
|
||||
v2 = i
|
||||
|
||||
if v1 != None and v2 != None: # note that v1 or v2 can be zero
|
||||
if v1 is not None and v2 is not None: # note that v1 or v2 can be zero
|
||||
self.link = [sel_object.Object, v1, v2]
|
||||
elif DraftGeomUtils.geomType(edge) == "Circle":
|
||||
self.node.extend([edge.Curve.Center,
|
||||
|
||||
@@ -42,9 +42,9 @@ def make_bezcurve(pointslist,
|
||||
closed=False, placement=None, face=None, support=None,
|
||||
degree=None):
|
||||
"""make_bezcurve(pointslist, [closed], [placement])
|
||||
|
||||
|
||||
Creates a Bezier Curve object from the given list of vectors.
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
pointlist : [Base.Vector]
|
||||
@@ -53,19 +53,19 @@ def make_bezcurve(pointslist,
|
||||
TODO: Change the name so!
|
||||
|
||||
closed : bool
|
||||
If closed is True or first and last points are identical,
|
||||
If closed is True or first and last points are identical,
|
||||
the created BSpline will be closed.
|
||||
|
||||
placement : Base.Placement
|
||||
If a placement is given, it is used.
|
||||
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
TODO: Describe
|
||||
|
||||
|
||||
degree : int
|
||||
Degree of the BezCurve
|
||||
"""
|
||||
@@ -92,7 +92,7 @@ def make_bezcurve(pointslist,
|
||||
Part.BezierCurve().MaxDegree)
|
||||
obj.Closed = closed
|
||||
obj.Support = support
|
||||
if face != None:
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
obj.Proxy.resetcontinuity(obj)
|
||||
if placement: obj.Placement = placement
|
||||
|
||||
@@ -40,9 +40,9 @@ if App.GuiUp:
|
||||
|
||||
def make_bspline(pointslist, closed=False, placement=None, face=None, support=None):
|
||||
"""make_bspline(pointslist, [closed], [placement])
|
||||
|
||||
|
||||
Creates a B-Spline object from the given list of vectors.
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
pointlist : [Base.Vector]
|
||||
@@ -51,17 +51,17 @@ def make_bspline(pointslist, closed=False, placement=None, face=None, support=No
|
||||
TODO: Change the name so!
|
||||
|
||||
closed : bool
|
||||
If closed is True or first and last points are identical,
|
||||
If closed is True or first and last points are identical,
|
||||
the created BSpline will be closed.
|
||||
|
||||
placement : Base.Placement
|
||||
If a placement is given, it is used.
|
||||
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
TODO: Describe
|
||||
"""
|
||||
if not App.ActiveDocument:
|
||||
@@ -97,7 +97,7 @@ def make_bspline(pointslist, closed=False, placement=None, face=None, support=No
|
||||
obj.Closed = closed
|
||||
obj.Points = pointslist
|
||||
obj.Support = support
|
||||
if face != None:
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
if placement: obj.Placement = placement
|
||||
if App.GuiUp:
|
||||
|
||||
@@ -45,29 +45,29 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
|
||||
"""make_circle(radius, [placement, face, startangle, endangle])
|
||||
or make_circle(edge,[face]):
|
||||
|
||||
Creates a circle object with given parameters.
|
||||
Creates a circle object with given parameters.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
radius : the radius of the circle.
|
||||
|
||||
placement :
|
||||
If placement is given, it is used.
|
||||
|
||||
placement :
|
||||
If placement is given, it is used.
|
||||
|
||||
face : Bool
|
||||
If face is False, the circle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
If face is False, the circle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
startangle : start angle of the arc (in degrees)
|
||||
|
||||
endangle : end angle of the arc (in degrees)
|
||||
if startangle and endangle are equal, a circle is created,
|
||||
if startangle and endangle are equal, a circle is created,
|
||||
if they are different an arc is created
|
||||
|
||||
edge : edge.Curve must be a 'Part.Circle'
|
||||
the circle is created from the given edge
|
||||
|
||||
support :
|
||||
support :
|
||||
TODO: Describe
|
||||
"""
|
||||
|
||||
@@ -87,7 +87,7 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
|
||||
|
||||
Circle(obj)
|
||||
|
||||
if face != None:
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
|
||||
if isinstance(radius,Part.Edge):
|
||||
@@ -112,14 +112,14 @@ def make_circle(radius, placement=None, face=None, startangle=None, endangle=Non
|
||||
obj.LastAngle = a1
|
||||
else:
|
||||
obj.Radius = radius
|
||||
if (startangle != None) and (endangle != None):
|
||||
if (startangle is not None) and (endangle is not None):
|
||||
if startangle == -0: startangle = 0
|
||||
obj.FirstAngle = startangle
|
||||
obj.LastAngle = endangle
|
||||
|
||||
obj.Support = support
|
||||
|
||||
if placement:
|
||||
if placement:
|
||||
obj.Placement = placement
|
||||
|
||||
if App.GuiUp:
|
||||
|
||||
@@ -38,26 +38,26 @@ if App.GuiUp:
|
||||
|
||||
def make_ellipse(majradius, minradius, placement=None, face=None, support=None):
|
||||
"""make_ellipse(majradius, minradius, [placement], [face], [support])
|
||||
|
||||
|
||||
Makes an ellipse with the given major and minor radius, and optionally
|
||||
a placement.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
majradius :
|
||||
majradius :
|
||||
Major radius of the ellipse.
|
||||
|
||||
minradius :
|
||||
minradius :
|
||||
Minor radius of the ellipse.
|
||||
|
||||
placement : Base.Placement
|
||||
If a placement is given, it is used.
|
||||
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
TODO: Describe.
|
||||
"""
|
||||
|
||||
@@ -74,7 +74,7 @@ def make_ellipse(majradius, minradius, placement=None, face=None, support=None):
|
||||
obj.MinorRadius = minradius
|
||||
obj.Support = support
|
||||
|
||||
if face != None:
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
|
||||
if placement:
|
||||
|
||||
@@ -44,20 +44,20 @@ def make_polygon(nfaces, radius=1, inscribed=True, placement=None, face=None, su
|
||||
edges : int
|
||||
Number of edges of the polygon.
|
||||
|
||||
radius :
|
||||
radius :
|
||||
Radius of the control circle.
|
||||
|
||||
inscribed : bool
|
||||
Defines is the polygon is inscribed or not into the control circle.
|
||||
|
||||
placement : Base.Placement
|
||||
If placement is given, it is used.
|
||||
|
||||
If placement is given, it is used.
|
||||
|
||||
face : bool
|
||||
If face is True, the resulting shape is displayed as a face,
|
||||
If face is True, the resulting shape is displayed as a face,
|
||||
otherwise as a wireframe.
|
||||
|
||||
support :
|
||||
|
||||
support :
|
||||
TODO: Describe
|
||||
"""
|
||||
if not App.ActiveDocument:
|
||||
@@ -68,7 +68,7 @@ def make_polygon(nfaces, radius=1, inscribed=True, placement=None, face=None, su
|
||||
Polygon(obj)
|
||||
obj.FacesNumber = nfaces
|
||||
obj.Radius = radius
|
||||
if face != None:
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
if inscribed:
|
||||
obj.DrawMode = "inscribed"
|
||||
|
||||
@@ -84,7 +84,7 @@ def make_rectangle(length, height=0, placement=None, face=None, support=None):
|
||||
obj.Height = height
|
||||
obj.Support = support
|
||||
|
||||
if face != None:
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
|
||||
if placement: obj.Placement = placement
|
||||
|
||||
@@ -39,7 +39,7 @@ if App.GuiUp:
|
||||
|
||||
def make_wire(pointslist, closed=False, placement=None, face=None, support=None, bs2wire=False):
|
||||
"""make_wire(pointslist, [closed], [placement])
|
||||
|
||||
|
||||
Creates a Wire object from the given list of vectors. If face is
|
||||
true (and wire is closed), the wire will appear filled. Instead of
|
||||
a pointslist, you can also pass a Part Wire.
|
||||
@@ -50,19 +50,19 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
|
||||
List of points to create the polyline
|
||||
|
||||
closed : bool
|
||||
If closed is True or first and last points are identical,
|
||||
If closed is True or first and last points are identical,
|
||||
the created polyline will be closed.
|
||||
|
||||
placement : Base.Placement
|
||||
If a placement is given, it is used.
|
||||
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
face : Bool
|
||||
If face is False, the rectangle is shown as a wireframe,
|
||||
otherwise as a face.
|
||||
|
||||
support :
|
||||
TODO: Describe
|
||||
|
||||
|
||||
bs2wire : bool
|
||||
TODO: Describe
|
||||
"""
|
||||
@@ -96,16 +96,16 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
|
||||
|
||||
if len(pointslist) == 0:
|
||||
App.Console.PrintWarning("Draft Wire created with empty point list\n")
|
||||
|
||||
|
||||
if placement:
|
||||
utils.type_check([(placement, App.Placement)], "make_wire")
|
||||
ipl = placement.inverse()
|
||||
if not bs2wire:
|
||||
pointslist = [ipl.multVec(p) for p in pointslist]
|
||||
|
||||
if len(pointslist) == 2:
|
||||
if len(pointslist) == 2:
|
||||
fname = "Line"
|
||||
else:
|
||||
else:
|
||||
fname = "Wire"
|
||||
|
||||
obj = App.ActiveDocument.addObject("Part::Part2DObjectPython", fname)
|
||||
@@ -113,11 +113,11 @@ def make_wire(pointslist, closed=False, placement=None, face=None, support=None,
|
||||
obj.Points = pointslist
|
||||
obj.Closed = closed
|
||||
obj.Support = support
|
||||
|
||||
if face != None:
|
||||
|
||||
if face is not None:
|
||||
obj.MakeFace = face
|
||||
|
||||
if placement:
|
||||
if placement:
|
||||
obj.Placement = placement
|
||||
|
||||
if App.GuiUp:
|
||||
|
||||
@@ -718,7 +718,7 @@ class svgHandler(xml.sax.ContentHandler):
|
||||
inks_doc_name = attrs.getValue('sodipodi:docname')
|
||||
inks_full_ver = attrs.getValue('inkscape:version')
|
||||
inks_ver_pars = re.search("\d+\.\d+", inks_full_ver)
|
||||
if inks_ver_pars != None:
|
||||
if inks_ver_pars is not None:
|
||||
inks_ver_f = float(inks_ver_pars.group(0))
|
||||
else:
|
||||
inks_ver_f = 99.99
|
||||
|
||||
Reference in New Issue
Block a user