- made sure that in Tcl commands deleting argument keys will not raise an error

This commit is contained in:
Marius Stanciu
2022-01-17 12:57:28 +02:00
committed by Marius
parent e18690baf0
commit 0a9adcb82d
10 changed files with 14 additions and 23 deletions

View File

@@ -409,7 +409,7 @@ class TclCommandSignaled(TclCommand):
args, unnamed_args = self.check_args(args)
if 'timeout' in args:
passed_timeout = args['timeout']
del args['timeout']
args.pop('timeout', None)
else:
passed_timeout = self.app.defaults['global_background_timeout']

View File

@@ -87,7 +87,7 @@ class TclCommandBbox(TclCommand):
else:
rounded = bool(eval(self.app.defaults["gerber_bboxrounded"]))
del args['name']
args.pop('name', None)
try:
def geo_init(geo_obj, app_obj):

View File

@@ -211,7 +211,7 @@ class TclCommandCncjob(TclCommandSignaled):
self.raise_tcl_error("The entered value for 'toolchangexy' needs to have the format x,y or "
"in format (x, y) - no spaces allowed. But always two comma separated values.")
del args['name']
args.pop('name', None)
for arg in args:
if arg == "toolchange_xy" or arg == "spindlespeed" or arg == "startz":

View File

@@ -78,5 +78,5 @@ class TclCommandExportGcode(TclCommandSignaled):
if self.app.collection.has_promises():
self.raise_tcl_error('!!!Promises exists, but should not here!!!')
del args['name']
args.pop('name', None)
return obj.get_gcode(**args)

View File

@@ -58,7 +58,7 @@ class TclCommandFollow(TclCommandSignaled):
if obj.kind != 'gerber':
self.raise_tcl_error('Expected GerberObject, got %s %s.' % (name, type(obj)))
del args['name']
args.pop('name', None)
try:
obj.follow_geo(**args)
except Exception as e:

View File

@@ -93,5 +93,5 @@ class TclCommandIsolate(TclCommandSignaled):
if obj.kind != 'gerber':
self.raise_tcl_error('Expected GerberObject, got %s %s.' % (name, type(obj)))
del args['name']
args.pop('name', None)
obj.isolate(plot=False, **args)

View File

@@ -132,10 +132,8 @@ class TclCommandMillDrills(TclCommandSignaled):
args['tools'] = 'all'
# no longer needed
if 'milled_dias' in args:
del args['milled_dias']
if 'diatol' in args:
del args['diatol']
args.pop('milled_dias', None)
args.pop('diatol', None)
except Exception as e:
self.raise_tcl_error("Bad tools: %s" % str(e))
@@ -147,7 +145,7 @@ class TclCommandMillDrills(TclCommandSignaled):
try:
# 'name' is not an argument of obj.generate_milling()
del args['name']
args.pop('name', None)
# This runs in the background... Is blocking handled?
success, msg = obj.generate_milling_drills(plot=False, **args)

View File

@@ -126,22 +126,14 @@ class TclCommandMillSlots(TclCommandSignaled):
"TclCommand are not actual tool diameters in the Excellon object.")
args['tools'] = req_tools
# no longer needed
del args['milled_dias']
del args['diatol']
# Split and put back. We are passing the whole dictionary later.
# args['milled_dias'] = [x.strip() for x in args['tools'].split(",")]
else:
args['tools'] = 'all'
# no longer needed
if 'milled_dias' in args:
del args['milled_dias']
if 'diatol' in args:
del args['diatol']
args.pop('milled_dias', None)
args.pop('diatol', None)
except Exception as e:
self.raise_tcl_error("Bad tools: %s" % str(e))
@@ -153,7 +145,7 @@ class TclCommandMillSlots(TclCommandSignaled):
try:
# 'name' is not an argument of obj.generate_milling()
del args['name']
args.pop('name', None)
# This runs in the background... Is blocking handled?
success, msg = obj.generate_milling_slots(plot=False, **args)

View File

@@ -86,7 +86,7 @@ class TclCommandNregions(TclCommand):
else:
rounded = bool(eval(self.app.defaults["gerber_noncopperrounded"]))
del args['name']
args.pop('name', None)
try:
def geo_init(geo_obj, app_obj):