From 3363dd0fe88107e94325117e03e714b43cdbc550 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 18 Jan 2022 00:30:10 +0200 Subject: [PATCH] - in the 'cutout' Tcl command made sure that when an error pop-up then it returns with a "fail" string - made sure when running scripts from the interface that if a command will generate an error then the script is aborted --- CHANGELOG.md | 5 +++++ appObjects/FlatCAMScript.py | 7 ++++++- app_Main.py | 3 ++- tclCommands/TclCommandCutout.py | 6 +++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af1d955..e9facba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta ================================================= +18.01.2022 + +- in the 'cutout' Tcl command made sure that when an error pop-up then it returns with a "fail" string +- made sure when running scripts from the interface that if a command will generate an error then the script is aborted + 17.01.2022 - fixed issues in the 'millslots' and 'milldrills' Tcl commands for the case when some parameters are not used diff --git a/appObjects/FlatCAMScript.py b/appObjects/FlatCAMScript.py index 87b3687d..b4c1ddd1 100644 --- a/appObjects/FlatCAMScript.py +++ b/appObjects/FlatCAMScript.py @@ -264,7 +264,12 @@ class ScriptObject(FlatCAMObj): result = self.app.shell.tcl.eval(str(new_command)) if result != 'None': self.app.shell.append_output(result + '\n') - + if result == 'fail': + self.app.ui.fcinfo.lock_pmaps = False + self.app.shell.close_processing() + self.app.inform.emit("[ERROR] %s: %s" % (_("Tcl Command failed"), str(new_command))) + self.app.inform.emit("[ERROR] %s" % _("Aborting.")) + return old_line = '' except tk.TclError: old_line = old_line + tcl_command_line + '\n' diff --git a/app_Main.py b/app_Main.py index 33889760..61829711 100644 --- a/app_Main.py +++ b/app_Main.py @@ -6426,7 +6426,8 @@ class App(QtCore.QObject): :return: """ if self.abort_flag is False: - self.inform.emit(_("Aborting. The current task will be gracefully closed as soon as possible...")) + msg = "%s %s" % (_("Aborting."), _("The current task will be gracefully closed as soon as possible...")) + self.inform.emit(msg) self.abort_flag = True self.cleanup.emit() diff --git a/tclCommands/TclCommandCutout.py b/tclCommands/TclCommandCutout.py index f758fe7e..4d837c94 100644 --- a/tclCommands/TclCommandCutout.py +++ b/tclCommands/TclCommandCutout.py @@ -81,7 +81,11 @@ class TclCommandCutout(TclCommand): dia_par = float(self.app.defaults["tools_cutout_tooldia"]) if 'gaps' in args: - gaps_par = args['gaps'] + if args['gaps'] not in ["tb", "lr", "4", 4]: + self.raise_tcl_error( + "Incorrect -gaps values. Can be only a string from: 'tb', 'lr' and '4'.") + return "fail" + gaps_par = str(args['gaps']) else: gaps_par = str(self.app.defaults["tools_cutout_gaps_ff"])