diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 3eed82ec76..468cf64fb6 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -102,15 +102,14 @@ def selectObject(arg): FreeCAD.activeDraftCommand.proceed() def getPoint(target,args,mobile=False,sym=False,workingplane=True,noTracker=False): - ''' - Function used by the Draft Tools. + """Function used by the Draft Tools. returns a constrained 3d point and its original point. if mobile=True, the constraining occurs from the location of mouse cursor when Shift is pressed, otherwise from last entered point. If sym=True, x and y values stay always equal. If workingplane=False, the point won't be projected on the Working Plane. if noTracker is True, the tracking line will not be displayed - ''' + """ ui = FreeCADGui.draftToolBar @@ -144,7 +143,7 @@ def getPoint(target,args,mobile=False,sym=False,workingplane=True,noTracker=Fals return point,ctrlPoint,info def getSupport(mouseEvent=None): - "returns the supporting object and sets the working plane" + """returns the supporting object and sets the working plane""" plane.save() if mouseEvent: return setWorkingPlaneToObjectUnderCursor(mouseEvent) @@ -194,7 +193,7 @@ def setWorkingPlaneToSelectedObject(): return None def hasMod(args,mod): - "checks if args has a specific modifier" + """checks if args has a specific modifier""" if mod == "shift": return args["ShiftDown"] elif mod == "ctrl": @@ -203,7 +202,7 @@ def hasMod(args,mod): return args["AltDown"] def setMod(args,mod,state): - "sets a specific modifier state in args" + """sets a specific modifier state in args""" if mod == "shift": args["ShiftDown"] = state elif mod == "ctrl": @@ -219,7 +218,7 @@ def setMod(args,mod,state): #--------------------------------------------------------------------------- class DraftTool: - "The base class of all Draft Tools" + """The base class of all Draft Tools""" def __init__(self): self.commitList = [] @@ -291,11 +290,11 @@ class DraftTool: self.commitList = [] def commit(self,name,func): - "stores actions to be committed to the FreeCAD document" + """stores actions to be committed to the FreeCAD document""" self.commitList.append((name,func)) def getStrings(self,addrot=None): - "returns a couple of useful strings for building python commands" + """returns a couple of useful strings for building python commands""" # current plane rotation p = plane.getRotation() @@ -329,7 +328,7 @@ class DraftTool: #--------------------------------------------------------------------------- class SelectPlane(DraftTool): - "The Draft_SelectPlane FreeCAD command definition" + """The Draft_SelectPlane FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_SelectPlane', @@ -549,7 +548,7 @@ def redraw3DView(): pass class Creator(DraftTool): - "A generic Draft Creator Tool used by creation tools such as line or arc" + """A generic Draft Creator Tool used by creation tools such as line or arc""" def __init__(self): DraftTool.__init__(self) @@ -560,7 +559,7 @@ class Creator(DraftTool): self.support = getSupport() class Line(Creator): - "The Line FreeCAD command definition" + """The Line FreeCAD command definition""" def __init__(self, wiremode=False): Creator.__init__(self) @@ -592,7 +591,7 @@ class Line(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick first point")+"\n") def action(self, arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent" and arg["Key"] == "ESCAPE": self.finish() elif arg["Type"] == "SoLocation2Event": @@ -619,7 +618,7 @@ class Line(Creator): self.finish(True,cont=True) def finish(self,closed=False,cont=False): - "terminates the operation and closes the poly if asked" + """terminates the operation and closes the poly if asked""" self.removeTemporaryObject() if self.oldWP: FreeCAD.DraftWorkingPlane = self.oldWP @@ -670,7 +669,7 @@ class Line(Creator): self.obj = None def undolast(self): - "undoes last line segment" + """undoes last line segment""" if (len(self.node) > 1): self.node.pop() last = self.node[-1] @@ -686,7 +685,7 @@ class Line(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick next point")+"\n") def drawSegment(self,point): - "draws a new segment" + """draws a new segment""" if self.planetrack and self.node: self.planetrack.set(self.node[-1]) if (len(self.node) == 1): @@ -708,7 +707,7 @@ class Line(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick next point")+"\n") def wipe(self): - "removes all previous segments and starts from last point" + """removes all previous segments and starts from last point""" if len(self.node) > 1: # self.obj.Shape.nullify() - for some reason this fails self.obj.ViewObject.Visibility = False @@ -737,7 +736,7 @@ class Line(Creator): self.planetrack.set(self.node[-1]) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) self.node.append(self.point) self.drawSegment(self.point) @@ -746,7 +745,7 @@ class Line(Creator): self.ui.setNextFocus() class Wire(Line): - "a FreeCAD command for creating a wire" + """a FreeCAD command for creating a wire""" def __init__(self): Line.__init__(self,wiremode=True) @@ -787,7 +786,7 @@ class Wire(Line): class BSpline(Line): - "a FreeCAD command for creating a B-spline" + """a FreeCAD command for creating a B-spline""" def __init__(self): Line.__init__(self,wiremode=True) @@ -804,7 +803,7 @@ class BSpline(Line): self.bsplinetrack = bsplineTracker() def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -838,7 +837,7 @@ class BSpline(Line): FreeCAD.Console.PrintMessage(translate("draft", "Spline has been closed")+"\n") def undolast(self): - "undoes last line segment" + """undoes last line segment""" if (len(self.node) > 1): self.node.pop() self.bsplinetrack.update(self.node) @@ -860,7 +859,7 @@ class BSpline(Line): FreeCAD.Console.PrintMessage(translate("draft", "Pick next point, or Finish (shift-F) or close (o)")+"\n") def finish(self,closed=False,cont=False): - "terminates the operation and closes the poly if asked" + """terminates the operation and closes the poly if asked""" if self.ui: self.bsplinetrack.finalize() if not Draft.getParam("UiMode",1): @@ -887,7 +886,7 @@ class BSpline(Line): self.Activated() class BezCurve(Line): - "a FreeCAD command for creating a Bezier Curve" + """a FreeCAD command for creating a Bezier Curve""" def __init__(self): Line.__init__(self,wiremode=True) @@ -905,7 +904,7 @@ class BezCurve(Line): self.bezcurvetrack = bezcurveTracker() def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -940,7 +939,7 @@ class BezCurve(Line): FreeCAD.Console.PrintMessage(translate("draft", "Bezier curve has been closed")+"\n") def undolast(self): - "undoes last line segment" + """undoes last line segment""" if (len(self.node) > 1): self.node.pop() self.bezcurvetrack.update(self.node,degree=self.degree) @@ -979,7 +978,7 @@ class BezCurve(Line): return(w) def finish(self,closed=False,cont=False): - "terminates the operation and closes the poly if asked" + """terminates the operation and closes the poly if asked""" if self.ui: if hasattr(self,"bezcurvetrack"): self.bezcurvetrack.finalize() @@ -1006,7 +1005,7 @@ class BezCurve(Line): self.Activated() class CubicBezCurve(Line): - "a FreeCAD command for creating a 3rd degree Bezier Curve" + """a FreeCAD command for creating a 3rd degree Bezier Curve""" def __init__(self): Line.__init__(self,wiremode=True) @@ -1024,7 +1023,7 @@ class CubicBezCurve(Line): self.bezcurvetrack = bezcurveTracker() def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -1093,7 +1092,7 @@ class CubicBezCurve(Line): # old code has been to insensitive def undolast(self): - "undoes last line segment" + """undoes last line segment""" if (len(self.node) > 1): self.node.pop() self.bezcurvetrack.update(self.node,degree=self.degree) @@ -1138,7 +1137,7 @@ class CubicBezCurve(Line): return(w) def finish(self,closed=False,cont=False): - "terminates the operation and closes the poly if asked" + """terminates the operation and closes the poly if asked""" if self.ui: if hasattr(self,"bezcurvetrack"): self.bezcurvetrack.finalize() @@ -1171,7 +1170,7 @@ class CubicBezCurve(Line): class FinishLine: - "a FreeCAD command to finish any running Line drawing operation" + """a FreeCAD command to finish any running Line drawing operation""" def Activated(self): if (FreeCAD.activeDraftCommand != None): @@ -1191,7 +1190,7 @@ class FinishLine: class CloseLine: - "a FreeCAD command to close any running Line drawing operation" + """a FreeCAD command to close any running Line drawing operation""" def Activated(self): if (FreeCAD.activeDraftCommand != None): @@ -1211,7 +1210,7 @@ class CloseLine: class UndoLine: - "a FreeCAD command to undo last drawn segment of a line" + """a FreeCAD command to undo last drawn segment of a line""" def Activated(self): if (FreeCAD.activeDraftCommand != None): @@ -1231,7 +1230,7 @@ class UndoLine: class Rectangle(Creator): - "the Draft_Rectangle FreeCAD command definition" + """the Draft_Rectangle FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Rectangle', @@ -1254,7 +1253,7 @@ class Rectangle(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick first point")+"\n") def finish(self,closed=False,cont=False): - "terminates the operation and closes the poly if asked" + """terminates the operation and closes the poly if asked""" Creator.finish(self) if self.ui: if hasattr(self,"fillstate"): @@ -1266,7 +1265,7 @@ class Rectangle(Creator): self.Activated() def createObject(self): - "creates the final object in the current doc" + """creates the final object in the current doc""" p1 = self.node[0] p3 = self.node[-1] diagonal = p3.sub(p1) @@ -1312,7 +1311,7 @@ class Rectangle(Creator): self.finish(cont=True) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -1333,7 +1332,7 @@ class Rectangle(Creator): self.appendPoint(self.point) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) self.appendPoint(self.point) @@ -1352,7 +1351,7 @@ class Rectangle(Creator): class Arc(Creator): - "the Draft_Arc FreeCAD command definition" + """the Draft_Arc FreeCAD command definition""" def __init__(self): self.closedCircle=False @@ -1383,7 +1382,7 @@ class Arc(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick center point")+"\n") def finish(self,closed=False,cont=False): - "finishes the arc" + """finishes the arc""" Creator.finish(self) if self.ui: self.linetrack.finalize() @@ -1415,7 +1414,7 @@ class Arc(Creator): self.angle = newangle def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -1550,7 +1549,7 @@ class Arc(Creator): self.drawArc() def drawArc(self): - "actually draws the FreeCAD object" + """actually draws the FreeCAD object""" rot,sup,pts,fil = self.getStrings() if self.closedCircle: try: @@ -1618,7 +1617,7 @@ class Arc(Creator): self.finish(cont=True) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.center = Vector(numx,numy,numz) self.node = [self.center] self.arctrack.setCenter(self.center) @@ -1629,7 +1628,7 @@ class Arc(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick radius")+"\n") def numericRadius(self,rad): - "this function gets called by the toolbar when valid radius have been entered there" + """this function gets called by the toolbar when valid radius have been entered there""" if (self.step == 1): self.rad = rad if len(self.tangents) == 2: @@ -1674,7 +1673,7 @@ class Arc(Creator): class Circle(Arc): - "The Draft_Circle FreeCAD command definition" + """The Draft_Circle FreeCAD command definition""" def __init__(self): self.closedCircle=True @@ -1688,7 +1687,7 @@ class Circle(Arc): class Polygon(Creator): - "the Draft_Polygon FreeCAD command definition" + """the Draft_Polygon FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Polygon', @@ -1716,7 +1715,7 @@ class Polygon(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick center point")+"\n") def finish(self,closed=False,cont=False): - "finishes the arc" + """finishes the arc""" Creator.finish(self) if self.ui: self.arctrack.finalize() @@ -1725,7 +1724,7 @@ class Polygon(Creator): self.Activated() def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -1817,7 +1816,7 @@ class Polygon(Creator): self.drawPolygon() def drawPolygon(self): - "actually draws the FreeCAD object" + """actually draws the FreeCAD object""" rot,sup,pts,fil = self.getStrings() FreeCADGui.addModule("Draft") if Draft.getParam("UsePartPrimitives",False): @@ -1844,7 +1843,7 @@ class Polygon(Creator): self.finish(cont=True) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.center = Vector(numx,numy,numz) self.node = [self.center] self.arctrack.setCenter(self.center) @@ -1855,7 +1854,7 @@ class Polygon(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick radius")+"\n") def numericRadius(self,rad): - "this function gets called by the toolbar when valid radius have been entered there" + """this function gets called by the toolbar when valid radius have been entered there""" self.rad = rad if len(self.tangents) == 2: cir = DraftGeomUtils.circleFrom2tan1rad(self.tangents[0], self.tangents[1], rad) @@ -1873,7 +1872,7 @@ class Polygon(Creator): class Ellipse(Creator): - "the Draft_Ellipse FreeCAD command definition" + """the Draft_Ellipse FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Ellipse', @@ -1893,7 +1892,7 @@ class Ellipse(Creator): FreeCAD.Console.PrintMessage(translate("draft", "Pick first point")+"\n") def finish(self,closed=False,cont=False): - "terminates the operation and closes the poly if asked" + """terminates the operation and closes the poly if asked""" Creator.finish(self) if self.ui: self.rect.off() @@ -1903,7 +1902,7 @@ class Ellipse(Creator): self.Activated() def createObject(self): - "creates the final object in the current doc" + """creates the final object in the current doc""" p1 = self.node[0] p3 = self.node[-1] diagonal = p3.sub(p1) @@ -1952,7 +1951,7 @@ class Ellipse(Creator): self.finish(cont=True) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -1973,7 +1972,7 @@ class Ellipse(Creator): self.appendPoint(self.point) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) self.appendPoint(self.point) @@ -1992,7 +1991,7 @@ class Ellipse(Creator): class Text(Creator): - "This class creates an annotation feature." + """This class creates an annotation feature.""" def GetResources(self): return {'Pixmap' : 'Draft_Text', @@ -2016,7 +2015,7 @@ class Text(Creator): FreeCADGui.draftToolBar.show() def finish(self,closed=False,cont=False): - "terminates the operation" + """terminates the operation""" Creator.finish(self) if self.ui: del self.dialog @@ -2024,7 +2023,7 @@ class Text(Creator): self.Activated() def createObject(self): - "creates an object in the current doc" + """creates an object in the current doc""" tx = '[' for l in self.text: if len(tx) > 1: @@ -2045,7 +2044,7 @@ class Text(Creator): self.finish(cont=True) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -2072,7 +2071,7 @@ class Text(Creator): class Dimension(Creator): - "The Draft_Dimension FreeCAD command definition" + """The Draft_Dimension FreeCAD command definition""" def __init__(self): self.max=2 @@ -2121,7 +2120,7 @@ class Dimension(Creator): FreeCADGui.draftToolBar.show() def setFromSelection(self): - "If we already have selected geometry, fill the nodes accordingly" + """If we already have selected geometry, fill the nodes accordingly""" sel = FreeCADGui.Selection.getSelectionEx() import DraftGeomUtils if len(sel) == 1: @@ -2148,7 +2147,7 @@ class Dimension(Creator): self.link = [sel[0].Object,n] def hasMeasures(self): - "checks if only measurements objects are selected" + """checks if only measurements objects are selected""" sel = FreeCADGui.Selection.getSelection() if not sel: return False @@ -2158,7 +2157,7 @@ class Dimension(Creator): return True def finish(self,closed=False): - "terminates the operation" + """terminates the operation""" self.cont = None self.dir = None Creator.finish(self) @@ -2180,7 +2179,7 @@ class Dimension(Creator): 'FreeCAD.ActiveDocument.recompute()']) def createObject(self): - "creates an object in the current doc" + """creates an object in the current doc""" FreeCADGui.addModule("Draft") if self.angledata: normal = "None" @@ -2236,7 +2235,7 @@ class Dimension(Creator): self.selectmode = not(self.selectmode) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -2413,7 +2412,7 @@ class Dimension(Creator): self.finish() def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) self.node.append(self.point) self.dimtrack.update(self.node) @@ -2425,7 +2424,7 @@ class Dimension(Creator): self.finish() class ShapeString(Creator): - "This class creates a shapestring feature." + """This class creates a shapestring feature.""" def GetResources(self): return {'Pixmap' : 'Draft_ShapeString', @@ -2462,7 +2461,7 @@ class ShapeString(Creator): FreeCADGui.draftToolBar.show() def createObject(self): - "creates object in the current doc" + """creates object in the current doc""" #print("debug: D_T ShapeString.createObject type(self.SString): " str(type(self.SString))) dquote = '"' @@ -2493,7 +2492,7 @@ class ShapeString(Creator): self.finish() def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -2541,7 +2540,7 @@ class ShapeString(Creator): self.createObject() def finish(self, finishbool=False): - "terminates the operation" + """terminates the operation""" Creator.finish(self) if self.ui: # del self.dialog # what does this do?? @@ -2553,14 +2552,14 @@ class ShapeString(Creator): #--------------------------------------------------------------------------- class Modifier(DraftTool): - "A generic Modifier Tool, used by modification tools such as move" + """A generic Modifier Tool, used by modification tools such as move""" def __init__(self): DraftTool.__init__(self) self.copymode = False class Move(Modifier): - "The Draft_Move FreeCAD command definition" + """The Draft_Move FreeCAD command definition""" def __init__(self): Modifier.__init__(self) @@ -2610,7 +2609,7 @@ class Move(Modifier): Modifier.finish(self) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent" and arg["Key"] == "ESCAPE": self.finish() elif arg["Type"] == "SoLocation2Event": @@ -2728,7 +2727,7 @@ class Move(Modifier): ['Draft.move('+objects+','+DraftVecUtils.toString(self.vector)+',copy='+str(self.ui.isCopy.isChecked())+')', 'FreeCAD.ActiveDocument.recompute()']) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) if not self.node: self.node.append(self.point) @@ -2745,7 +2744,7 @@ class Move(Modifier): class ApplyStyle(Modifier): - "The Draft_ApplyStyle FreeCA command definition" + """The Draft_ApplyStyle FreeCA command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Apply', @@ -2782,7 +2781,7 @@ class ApplyStyle(Modifier): c.append('Draft.formatObject(FreeCAD.ActiveDocument.'+ob.Name+')') class Rotate(Modifier): - "The Draft_Rotate FreeCAD command definition" + """The Draft_Rotate FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Rotate', @@ -2821,7 +2820,7 @@ class Rotate(Modifier): FreeCAD.Console.PrintMessage(translate("draft", "Pick rotation center")+"\n") def action(self, arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent" and arg["Key"] == "ESCAPE": self.finish() elif arg["Type"] == "SoLocation2Event": @@ -2939,7 +2938,7 @@ class Rotate(Modifier): self.ghosts.append(ghostTracker(subelement)) def finish(self, closed=False, cont=False): - "finishes the arc" + """finishes the arc""" if self.arctrack: self.arctrack.finalize() for ghost in self.ghosts: @@ -3020,7 +3019,7 @@ class Rotate(Modifier): 'FreeCAD.ActiveDocument.recompute()']) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.center = Vector(numx,numy,numz) self.node = [self.center] self.arctrack.setCenter(self.center) @@ -3033,7 +3032,7 @@ class Rotate(Modifier): FreeCAD.Console.PrintMessage(translate("draft", "Pick base angle")+"\n") def numericRadius(self,rad): - "this function gets called by the toolbar when valid radius have been entered there" + """this function gets called by the toolbar when valid radius have been entered there""" if (self.step == 1): self.ui.labelRadius.setText(translate("draft","Rotation")) self.firstangle = math.radians(rad) @@ -3050,7 +3049,7 @@ class Rotate(Modifier): class Offset(Modifier): - "The Draft_Offset FreeCAD command definition" + """The Draft_Offset FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Offset', @@ -3125,7 +3124,7 @@ class Offset(Modifier): self.running = True def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -3241,7 +3240,7 @@ class Offset(Modifier): class Stretch(Modifier): - "The Draft_Stretch FreeCAD command definition" + """The Draft_Stretch FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Stretch', @@ -3302,7 +3301,7 @@ class Stretch(Modifier): FreeCAD.Console.PrintMessage(translate("draft", "Pick first point of selection rectangle")+"\n") def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -3408,7 +3407,7 @@ class Stretch(Modifier): self.ui.redraw() def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" point = Vector(numx,numy,numz) self.addPoint(point) @@ -3421,7 +3420,7 @@ class Stretch(Modifier): Modifier.finish(self) def doStretch(self): - "does the actual stretching" + """does the actual stretching""" commitops = [] if self.displacement: if self.displacement.Length > 0: @@ -3696,10 +3695,10 @@ class Downgrade(Modifier): self.finish() class Trimex(Modifier): - ''' The Draft_Trimex FreeCAD command definition. + """The Draft_Trimex FreeCAD command definition. This tool trims or extends lines, wires and arcs, or extrudes single faces. SHIFT constrains to the last point - or extrudes in direction to the face normal.''' + or extrudes in direction to the face normal.""" def GetResources(self): return {'Pixmap' : 'Draft_Trimex', @@ -3792,7 +3791,7 @@ class Trimex(Modifier): FreeCAD.Console.PrintMessage(translate("draft", "Pick distance")+"\n") def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -3828,7 +3827,7 @@ class Trimex(Modifier): self.finish() def extrude(self,shift=False,real=False): - "redraws the ghost in extrude mode" + """redraws the ghost in extrude mode""" self.newpoint = self.obj.Shape.Faces[0].CenterOfMass dvec = self.point.sub(self.newpoint) if not shift: delta = DraftVecUtils.project(dvec,self.normal) @@ -3845,7 +3844,7 @@ class Trimex(Modifier): return delta.Length def redraw(self,point,snapped=None,shift=False,alt=False,real=None): - "redraws the ghost" + """redraws the ghost""" # initializing reverse = False @@ -3964,7 +3963,7 @@ class Trimex(Modifier): else: return dist def trimObject(self): - "trims the actual object" + """trims the actual object""" if self.extrudeMode: delta = self.extrude(self.shift,real=True) #print("delta",delta) @@ -4025,7 +4024,7 @@ class Trimex(Modifier): for g in self.ghost: g.off() def trimObjects(self,objectslist): - "attempts to trim two objects together" + """attempts to trim two objects together""" import Part wires = [] for obj in objectslist: @@ -4109,7 +4108,7 @@ class Trimex(Modifier): Draft.select(self.obj) def numericRadius(self,dist): - "this function gets called by the toolbar when valid distance have been entered there" + """this function gets called by the toolbar when valid distance have been entered there""" self.force = dist self.trimObject() self.finish() @@ -4177,7 +4176,7 @@ class Scale(Modifier): self.call = self.view.addEventCallback("SoEvent",self.action) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent" and arg["Key"] == "ESCAPE": self.finish() elif arg["Type"] == "SoLocation2Event": @@ -4289,7 +4288,7 @@ class Scale(Modifier): ghost.on() def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when a valid base point has been entered" + """this function gets called by the toolbar when a valid base point has been entered""" self.point = Vector(numx,numy,numz) self.node.append(self.point) if not self.pickmode: @@ -4326,7 +4325,7 @@ class Scale(Modifier): ghost.finalize() class ToggleConstructionMode(): - "The Draft_ToggleConstructionMode FreeCAD command definition" + """The Draft_ToggleConstructionMode FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Construction', @@ -4339,7 +4338,7 @@ class ToggleConstructionMode(): class ToggleContinueMode(): - "The Draft_ToggleContinueMode FreeCAD command definition" + """The Draft_ToggleContinueMode FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Rotate', @@ -4351,7 +4350,7 @@ class ToggleContinueMode(): class Drawing(Modifier): - "The Draft Drawing command definition" + """The Draft Drawing command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Drawing', @@ -4410,7 +4409,7 @@ class Drawing(Modifier): self.doc.recompute() def createDefaultPage(self): - "created a default page" + """created a default page""" template = Draft.getParam("template",FreeCAD.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg') page = self.doc.addObject('Drawing::FeaturePage','Page') page.ViewObject.HintOffsetX = 200 @@ -4422,7 +4421,7 @@ class Drawing(Modifier): class ToggleDisplayMode(): - "The ToggleDisplayMode FreeCAD command definition" + """The ToggleDisplayMode FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_SwitchMode', @@ -4446,7 +4445,7 @@ class ToggleDisplayMode(): obj.ViewObject.DisplayMode = "Flat Lines" class EditImproved(Modifier): - "The Draft_Edit_Improved FreeCAD command definition" + """The Draft_Edit_Improved FreeCAD command definition""" def __init__(self): self.is_running = False @@ -4531,7 +4530,7 @@ class EditImproved(Modifier): pass class AddToGroup(): - "The AddToGroup FreeCAD command definition" + """The AddToGroup FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_AddToGroup', @@ -4575,7 +4574,7 @@ class AddToGroup(): class AddPoint(Modifier): - "The Draft_AddPoint FreeCAD command definition" + """The Draft_AddPoint FreeCAD command definition""" def __init__(self): self.running = False @@ -4600,7 +4599,7 @@ class AddPoint(Modifier): class DelPoint(Modifier): - "The Draft_DelPoint FreeCAD command definition" + """The Draft_DelPoint FreeCAD command definition""" def __init__(self): self.running = False @@ -4625,7 +4624,7 @@ class DelPoint(Modifier): class WireToBSpline(Modifier): - "The Draft_Wire2BSpline FreeCAD command definition" + """The Draft_Wire2BSpline FreeCAD command definition""" def __init__(self): self.running = False @@ -4670,7 +4669,7 @@ class WireToBSpline(Modifier): class SelectGroup(): - "The SelectGroup FreeCAD command definition" + """The SelectGroup FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_SelectGroup', @@ -4702,7 +4701,7 @@ class SelectGroup(): class Shape2DView(Modifier): - "The Shape2DView FreeCAD command definition" + """The Shape2DView FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_2DShapeView', @@ -4746,7 +4745,7 @@ class Shape2DView(Modifier): class Draft2Sketch(Modifier): - "The Draft2Sketch FreeCAD command definition" + """The Draft2Sketch FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Draft2Sketch', @@ -4804,7 +4803,7 @@ class Draft2Sketch(Modifier): class Array(Modifier): - "The Shape2DView FreeCAD command definition" + """The Shape2DView FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Array', @@ -4834,7 +4833,7 @@ class Array(Modifier): self.finish() class PathArray(Modifier): - "The PathArray FreeCAD command definition" + """The PathArray FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_PathArray', @@ -4870,7 +4869,7 @@ class PathArray(Modifier): self.finish() class PointArray(Modifier): - "The PointArray FreeCAD command definition" + """The PointArray FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_PointArray', @@ -4901,7 +4900,7 @@ class PointArray(Modifier): self.finish() class Point(Creator): - "this class will create a vertex after the user clicks a point on the screen" + """this class will create a vertex after the user clicks a point on the screen""" def GetResources(self): return {'Pixmap' : 'Draft_Point', @@ -4938,7 +4937,7 @@ class Point(Creator): self.ui.displayPoint(self.point) def numericInput(self,numx,numy,numz): - "called when a numeric value is entered on the toolbar" + """called when a numeric value is entered on the toolbar""" self.point = FreeCAD.Vector(numx,numy,numz) self.click() @@ -4974,14 +4973,14 @@ class Point(Creator): self.finish() def finish(self,cont=False): - "terminates the operation and restarts if needed" + """terminates the operation and restarts if needed""" Creator.finish(self) if self.ui: if self.ui.continueMode: self.Activated() class ShowSnapBar(): - "The ShowSnapBar FreeCAD command definition" + """The ShowSnapBar FreeCAD command definition""" def GetResources(self): return {'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_ShowSnapBar", "Show Snap Bar"), @@ -4993,7 +4992,7 @@ class ShowSnapBar(): class Draft_Clone(Modifier): - "The Draft Clone command definition" + """The Draft Clone command definition""" def __init__(self): Modifier.__init__(self) @@ -5041,7 +5040,7 @@ class Draft_Clone(Modifier): class ToggleGrid(): - "The Draft ToggleGrid command definition" + """The Draft ToggleGrid command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Grid', @@ -5061,7 +5060,7 @@ class ToggleGrid(): FreeCADGui.Snapper.forceGridOff=False class Heal(): - "The Draft Heal command definition" + """The Draft Heal command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Heal', @@ -5079,7 +5078,7 @@ class Heal(): class Draft_Facebinder(Creator): - "The Draft Facebinder command definition" + """The Draft Facebinder command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Facebinder', @@ -5127,7 +5126,7 @@ class Draft_FlipDimension(): class Mirror(Modifier): - "The Draft_Mirror FreeCAD command definition" + """The Draft_Mirror FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Mirror', @@ -5169,7 +5168,7 @@ class Mirror(Modifier): self.Activated() def mirror(self,p1,p2,copy=False): - "mirroring the real shapes" + """mirroring the real shapes""" sel = '[' for o in self.sel: if len(sel) > 1: @@ -5182,7 +5181,7 @@ class Mirror(Modifier): 'FreeCAD.ActiveDocument.recompute()']) def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -5234,7 +5233,7 @@ class Mirror(Modifier): self.finish(cont=True) def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) if not self.node: self.node.append(self.point) @@ -5305,7 +5304,7 @@ class Draft_Slope(): class SetAutoGroup(): - "The SetAutoGroup FreeCAD command definition" + """The SetAutoGroup FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_AutoGroup', @@ -5361,7 +5360,7 @@ class SetAutoGroup(): class SetWorkingPlaneProxy(): - "The SetWorkingPlaneProxy FreeCAD command definition" + """The SetWorkingPlaneProxy FreeCAD command definition""" def GetResources(self): return {'Pixmap' : 'Draft_SelectPlane', @@ -5384,7 +5383,7 @@ class SetWorkingPlaneProxy(): class Draft_Label(Creator): - "The Draft_Label command definition" + """The Draft_Label command definition""" def GetResources(self): return {'Pixmap' : 'Draft_Label', @@ -5458,7 +5457,7 @@ class Draft_Label(Creator): self.finish() def action(self,arg): - "scene event handler" + """scene event handler""" if arg["Type"] == "SoKeyboardEvent": if arg["Key"] == "ESCAPE": self.finish() @@ -5494,7 +5493,7 @@ class Draft_Label(Creator): self.create() def numericInput(self,numx,numy,numz): - "this function gets called by the toolbar when valid x, y, and z have been entered there" + """this function gets called by the toolbar when valid x, y, and z have been entered there""" self.point = Vector(numx,numy,numz) if not self.node: # first click