From c08acc79eb0b174a88f2f2d0b7d7838201ff0b6f Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 17 Jan 2022 23:37:28 +0200 Subject: [PATCH] - fixed an issue with path conversion when using Windows-style of paths in the 'set_path' Tcl command --- CHANGELOG.md | 1 + appObjects/FlatCAMScript.py | 3 ++- tclCommands/TclCommand.py | 8 +++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a92006a..bdd63d4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ CHANGELOG for FlatCAM beta - fixing an issue with not building the UI for the generated objects when running a script and then trying to enable/disable the plots - attempting to add a feature in the text editors to autoselect all words in a document that are the same as the one that was clicked - all the colors set in Preferences now have to be in the 8digits format RGBA (including the alpha channel as a suffix) - it is required to delete the current preferences files +- fixed an issue with path conversion when using Windows-style of paths in the 'set_path' Tcl command 15.01.2022 diff --git a/appObjects/FlatCAMScript.py b/appObjects/FlatCAMScript.py index 0171c923..87b3687d 100644 --- a/appObjects/FlatCAMScript.py +++ b/appObjects/FlatCAMScript.py @@ -250,7 +250,8 @@ class ScriptObject(FlatCAMObj): # if FlatCAM is run in Windows then replace all the slashes with # the UNIX style slash that TCL understands if sys.platform == 'win32': - if "open" in tcl_command_line: + tcl_command_line_lowered = tcl_command_line.lower() + if "open" in tcl_command_line_lowered or "path" in tcl_command_line_lowered: tcl_command_line = tcl_command_line.replace('\\', '/') if old_line != '': diff --git a/tclCommands/TclCommand.py b/tclCommands/TclCommand.py index 68904b02..f27651eb 100644 --- a/tclCommands/TclCommand.py +++ b/tclCommands/TclCommand.py @@ -166,9 +166,6 @@ class TclCommand(object): Pre-processes arguments to detect '-keyword value' pairs into dictionary and standalone parameters into list. - This is copy from FlatCAMApp.setup_shell().h() just for accessibility, - original should be removed after all commands will be converted - :param args: arguments from tcl to parse :return: arguments, options """ @@ -189,10 +186,11 @@ class TclCommand(object): option_name = match.group(1) continue + init_arg = args[i] if option_name is None: - arguments.append(args[i]) + arguments.append(init_arg) else: - options[option_name] = args[i] + options[option_name] = init_arg option_name = None if option_name is not None: