- 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
This commit is contained in:
Marius Stanciu
2022-01-18 00:30:10 +02:00
committed by Marius
parent 87f1b7e15e
commit 3363dd0fe8
4 changed files with 18 additions and 3 deletions

View File

@@ -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 17.01.2022
- fixed issues in the 'millslots' and 'milldrills' Tcl commands for the case when some parameters are not used - fixed issues in the 'millslots' and 'milldrills' Tcl commands for the case when some parameters are not used

View File

@@ -264,7 +264,12 @@ class ScriptObject(FlatCAMObj):
result = self.app.shell.tcl.eval(str(new_command)) result = self.app.shell.tcl.eval(str(new_command))
if result != 'None': if result != 'None':
self.app.shell.append_output(result + '\n') 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 = '' old_line = ''
except tk.TclError: except tk.TclError:
old_line = old_line + tcl_command_line + '\n' old_line = old_line + tcl_command_line + '\n'

View File

@@ -6426,7 +6426,8 @@ class App(QtCore.QObject):
:return: :return:
""" """
if self.abort_flag is False: 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.abort_flag = True
self.cleanup.emit() self.cleanup.emit()

View File

@@ -81,7 +81,11 @@ class TclCommandCutout(TclCommand):
dia_par = float(self.app.defaults["tools_cutout_tooldia"]) dia_par = float(self.app.defaults["tools_cutout_tooldia"])
if 'gaps' in args: 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: else:
gaps_par = str(self.app.defaults["tools_cutout_gaps_ff"]) gaps_par = str(self.app.defaults["tools_cutout_gaps_ff"])