From 8eeb2a72f045f6ad3e59869f1095aa8026a1b50e Mon Sep 17 00:00:00 2001 From: luzpaz Date: Sun, 23 Apr 2023 10:34:29 +0000 Subject: [PATCH] Path: general linting and typo fixes --- src/Mod/Path/Path/Main/Gui/Job.py | 6 ++-- src/Mod/Path/Path/Post/scripts/dumper_post.py | 6 ++-- .../Path/Path/Post/scripts/example_post.py | 4 +-- .../Path/Path/Post/scripts/fangling_post.py | 34 +++++++++---------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/Mod/Path/Path/Main/Gui/Job.py b/src/Mod/Path/Path/Main/Gui/Job.py index 5f175c36af..c52ee62b0c 100644 --- a/src/Mod/Path/Path/Main/Gui/Job.py +++ b/src/Mod/Path/Path/Main/Gui/Job.py @@ -641,12 +641,12 @@ class TaskPanel: self.form.toolControllerList.horizontalHeaderItem(4).setToolTip( translate("Path", "spindle RPM ") ) - + # ensure correct ellisis behaviour on tool controller names. self.form.toolControllerList.setWordWrap(False) - + self.form.toolControllerList.resizeColumnsToContents() - + currentPostProcessor = self.obj.PostProcessor postProcessors = Path.Preferences.allEnabledPostProcessors( ["", currentPostProcessor] diff --git a/src/Mod/Path/Path/Post/scripts/dumper_post.py b/src/Mod/Path/Path/Post/scripts/dumper_post.py index e1d8919695..0681d1da66 100644 --- a/src/Mod/Path/Path/Post/scripts/dumper_post.py +++ b/src/Mod/Path/Path/Post/scripts/dumper_post.py @@ -21,6 +21,9 @@ # * * # *************************************************************************** +import datetime +import Path.Post.Utils as PostUtils +import PathScripts.PathUtils as PathUtils TOOLTIP = """ Dumper is an extremely simple postprocessor file for the Path workbench. It is used @@ -28,9 +31,6 @@ to dump the command list from one or more Path objects for simple inspection. Th doesn't do any manipulation of the path and doesn't write anything to disk. It just shows the dialog so you can see it. Useful for debugging, but not much else. """ -import datetime -import Path.Post.Utils as PostUtils -import PathScripts.PathUtils as PathUtils now = datetime.datetime.now() SHOW_EDITOR = True diff --git a/src/Mod/Path/Path/Post/scripts/example_post.py b/src/Mod/Path/Path/Post/scripts/example_post.py index 19b001ee9e..9f2d74dfe2 100644 --- a/src/Mod/Path/Path/Post/scripts/example_post.py +++ b/src/Mod/Path/Path/Post/scripts/example_post.py @@ -21,6 +21,7 @@ # * * # *************************************************************************** +import datetime TOOLTIP = """ This is an example postprocessor file for the Path workbench. It is used @@ -30,11 +31,8 @@ Read the Path Workbench documentation to know how to convert Path objects to GCode. """ -import datetime - now = datetime.datetime.now() - # to distinguish python built-in open function from the one declared below if open.__module__ in ["__builtin__", "io"]: pythonopen = open diff --git a/src/Mod/Path/Path/Post/scripts/fangling_post.py b/src/Mod/Path/Path/Post/scripts/fangling_post.py index e99b5fd66f..ac00633c28 100644 --- a/src/Mod/Path/Path/Post/scripts/fangling_post.py +++ b/src/Mod/Path/Path/Post/scripts/fangling_post.py @@ -92,7 +92,7 @@ PRECISION = 3 # Preamble text will appear at the beginning of the GCODE output file. #PREAMBLE = '''G17 G54 G40 G49 G80 G90''' -#Changed to matche preamble produced by Fusipn 360 +#Changed to match preamble produced by Fusion 360 PREAMBLE = '''G90 ''' @@ -199,7 +199,7 @@ def export(objectslist, filename, argstring): gcode += linenumber() + UNITS + "\n" gcode += linenumber() + "G92 X0 Y0\n" - + for obj in objectslist: # Skip inactive operations @@ -328,20 +328,20 @@ def parse(pathobj): command = c.Name if c.Name in ["G0", "G00"] and lastcommand in ["G1", "G2", "G3"]: - # A rapid move following a positioning move indicates the cut is complete - # print ("end of cut") - if OUTPUT_COMMENTS: - out += linenumber() + " (Torch Off)\n" - out += linenumber() + " M08\n" + # A rapid move following a positioning move indicates the cut is complete + # print ("end of cut") + if OUTPUT_COMMENTS: + out += linenumber() + " (Torch Off)\n" + out += linenumber() + " M08\n" if c.Name in ["G1", "G2", "G3"] and lastcommand in ["G0", "G00"]: - # A positioning move following a rapid move indicates a new cut is starting - # print ("new cut") - if OUTPUT_COMMENTS: - out += linenumber() + " (Torch On)\n" - out += linenumber() + " M07\n" - if OUTPUT_COMMENTS: - out += linenumber() + " (Pierce Delay)\n" - out += linenumber() + " G4 P1\n" + # A positioning move following a rapid move indicates a new cut is starting + # print ("new cut") + if OUTPUT_COMMENTS: + out += linenumber() + " (Torch On)\n" + out += linenumber() + " M07\n" + if OUTPUT_COMMENTS: + out += linenumber() + " (Pierce Delay)\n" + out += linenumber() + " G4 P1\n" if adaptiveOp and c.Name in ["G0", "G00"]: if opHorizRapid and opVertRapid: @@ -373,7 +373,7 @@ def parse(pathobj): # Now add the remaining parameters in order for param in params: if param in c.Parameters: - if (param == 'F'): + if param == 'F': continue elif param in ['T', 'H', 'D', 'S']: outstring.append(param + str(int(c.Parameters[param]))) @@ -431,5 +431,5 @@ def writeFile(filename, final): gfile = pythonopen(filename, "w") gfile.write(final) gfile.close() - + return