From 0d3ce2cba22c4f48fec303345e2b0f550a75d774 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Wed, 12 Oct 2022 09:58:55 -0500 Subject: [PATCH 1/2] fix codespell warnings --- src/Mod/Path/Path/Base/Gui/GetPoint.py | 28 +++++++++---------- src/Mod/Path/Path/Base/Gui/PropertyBag.py | 16 +++++------ src/Mod/Path/Path/Op/Profile.py | 12 ++++---- .../Path/PathTests/TestPathDressupDogbone.py | 4 +-- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Mod/Path/Path/Base/Gui/GetPoint.py b/src/Mod/Path/Path/Base/Gui/GetPoint.py index 1018ffa489..dd9b144868 100644 --- a/src/Mod/Path/Path/Base/Gui/GetPoint.py +++ b/src/Mod/Path/Path/Base/Gui/GetPoint.py @@ -76,17 +76,17 @@ class TaskPanel: self.formPoint.buttonBox.accepted.connect(self.pointAccept) self.formPoint.buttonBox.rejected.connect(self.pointReject) - self.formPoint.globalX.editingFinished.connect(self.updatePoint) - self.formPoint.globalY.editingFinished.connect(self.updatePoint) - self.formPoint.globalZ.editingFinished.connect(self.updatePoint) + self.formPoint.XGlobal.editingFinished.connect(self.updatePoint) + self.formPoint.YGlobal.editingFinished.connect(self.updatePoint) + self.formPoint.ZGlobal.editingFinished.connect(self.updatePoint) - self.formPoint.globalX.setProperty( + self.formPoint.XGlobal.setProperty( "unit", FreeCAD.Units.MilliMetre.getUserPreferred()[2] ) - self.formPoint.globalY.setProperty( + self.formPoint.YGlobal.setProperty( "unit", FreeCAD.Units.MilliMetre.getUserPreferred()[2] ) - self.formPoint.globalZ.setProperty( + self.formPoint.ZGlobal.setProperty( "unit", FreeCAD.Units.MilliMetre.getUserPreferred()[2] ) @@ -123,11 +123,11 @@ class TaskPanel: def displayPoint(p): self.point = p - self.formPoint.globalX.setProperty("rawValue", p.x) - self.formPoint.globalY.setProperty("rawValue", p.y) - self.formPoint.globalZ.setProperty("rawValue", p.z) - self.formPoint.globalX.setFocus() - self.formPoint.globalX.selectAll() + self.formPoint.XGlobal.setProperty("rawValue", p.x) + self.formPoint.YGlobal.setProperty("rawValue", p.y) + self.formPoint.ZGlobal.setProperty("rawValue", p.z) + self.formPoint.XGlobal.setFocus() + self.formPoint.XGlobal.selectAll() def mouseMove(cb): p = None @@ -256,7 +256,7 @@ class TaskPanel: if usePoint and self.point: self.pt = self.point else: - x = FreeCAD.Units.Quantity(self.formPoint.globalX.text()).Value - y = FreeCAD.Units.Quantity(self.formPoint.globalY.text()).Value - z = FreeCAD.Units.Quantity(self.formPoint.globalZ.text()).Value + x = FreeCAD.Units.Quantity(self.formPoint.XGlobal.text()).Value + y = FreeCAD.Units.Quantity(self.formPoint.YGlobal.text()).Value + z = FreeCAD.Units.Quantity(self.formPoint.ZGlobal.text()).Value self.pt = FreeCAD.Vector(x, y, z) diff --git a/src/Mod/Path/Path/Base/Gui/PropertyBag.py b/src/Mod/Path/Path/Base/Gui/PropertyBag.py index 83e52290e0..0875aefd1c 100644 --- a/src/Mod/Path/Path/Base/Gui/PropertyBag.py +++ b/src/Mod/Path/Path/Base/Gui/PropertyBag.py @@ -367,21 +367,21 @@ class TaskPanel(object): row = index.row() obj = self.model.item(row, self.ColumnVal).data(Delegate.RoleObject) - nam = self.model.item(row, self.ColumnVal).data(Delegate.RoleProperty) - grp = obj.getGroupOfProperty(nam) - typ = obj.getTypeIdOfProperty(nam) + prop = self.model.item(row, self.ColumnVal).data(Delegate.RoleProperty) + grp = obj.getGroupOfProperty(prop) + typ = obj.getTypeIdOfProperty(prop) dialog = PropertyCreate(self.obj, grp, typ, False) - if dialog.exec_(nam): - val = getattr(obj, nam) - obj.removeProperty(nam) + if dialog.exec_(prop): + val = getattr(obj, prop) + obj.removeProperty(prop) name, info = self.addCustomProperty(self.obj, dialog) try: - setattr(obj, nam, val) + setattr(obj, prop, val) except Exception: # this can happen if the old enumeration value doesn't exist anymore pass - newVal = PathUtil.getPropertyValueString(obj, nam) + newVal = PathUtil.getPropertyValueString(obj, prop) self.model.setData( self.model.index(row, self.ColumnVal), newVal, QtCore.Qt.DisplayRole ) diff --git a/src/Mod/Path/Path/Op/Profile.py b/src/Mod/Path/Path/Op/Profile.py index 92e17606a3..4879f0a36f 100644 --- a/src/Mod/Path/Path/Op/Profile.py +++ b/src/Mod/Path/Path/Op/Profile.py @@ -1092,13 +1092,13 @@ class ObjectProfile(PathAreaOp.ObjectOp): V1 = FreeCAD.Vector(VV1.X, VV1.Y, VV1.Z) V2 = FreeCAD.Vector(VV2.X, VV2.Y, VV2.Z) - lenE = len(wire.Edges) + edgeCount = len(wire.Edges) FLGS = [] - for e in range(0, lenE): + for e in range(0, edgeCount): FLGS.append(0) chk4 = False - for e in range(0, lenE): + for e in range(0, edgeCount): v = 0 E = wire.Edges[e] fv0 = FreeCAD.Vector(E.Vertexes[0].X, E.Vertexes[0].Y, E.Vertexes[0].Z) @@ -1135,7 +1135,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): IDXS = [] IDX1 = [] IDX2 = [] - for e in range(0, lenE): + for e in range(0, edgeCount): f = FLGS[e] PRE.append(f) POST.append(f) @@ -1161,7 +1161,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): wireIdxs[0].append(i) break # find first 3 edge - for e in range(begIdx + 1, lenE + begIdx): + for e in range(begIdx + 1, edgeCount + begIdx): f = PRE[e] i = IDXS[e] grps[1].append(f) @@ -1180,7 +1180,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): break # find first 3 edge and group all first wire edges endIdx = None - for e in range(begIdx, lenE + begIdx): + for e in range(begIdx, edgeCount + begIdx): f = PRE[e] i = IDXS[e] if f == 3: diff --git a/src/Mod/Path/PathTests/TestPathDressupDogbone.py b/src/Mod/Path/PathTests/TestPathDressupDogbone.py index aea96e434c..2e05aeeb26 100644 --- a/src/Mod/Path/PathTests/TestPathDressupDogbone.py +++ b/src/Mod/Path/PathTests/TestPathDressupDogbone.py @@ -42,8 +42,8 @@ class TestFeature: def __init__(self): self.Path = Path.Path() - def addProperty(self, typ, nam, category, tip): - setattr(self, nam, None) + def addProperty(self, typ, name, category, tip): + setattr(self, name, None) def setEditorMode(self, prop, mode): pass From e058eb61733baac6499e41ab09819394800e30e7 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Thu, 13 Oct 2022 14:09:35 -0500 Subject: [PATCH 2/2] Typo in Adaptive test --- src/Mod/Path/PathTests/TestPathAdaptive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathTests/TestPathAdaptive.py b/src/Mod/Path/PathTests/TestPathAdaptive.py index 62b0322ca3..8d66517ea5 100644 --- a/src/Mod/Path/PathTests/TestPathAdaptive.py +++ b/src/Mod/Path/PathTests/TestPathAdaptive.py @@ -29,7 +29,7 @@ import Path.Main.Job as PathJob from PathTests.PathTestUtils import PathTestBase if FreeCAD.GuiUp: - import Path.Main.gui.Job as PathJobGui + import Path.Main.Gui.Job as PathJobGui import Path.Op.Gui.Adaptive as PathAdaptiveGui