- multiple fixes in the Tcl commands (especially regarding the interchange between True/false and 1/0 values)

- updated the help for all Tcl Commands
- in Tcl Shell, the 'help' command will add also a brief description for each command in the list
This commit is contained in:
Marius Stanciu
2020-04-13 19:15:20 +03:00
committed by Marius
parent 5dcddb168e
commit 8a299e8fc8
66 changed files with 350 additions and 172 deletions

View File

@@ -12,6 +12,8 @@ class TclCommandWriteGCode(TclCommandSignaled):
# old names for backward compatibility (add_poly, add_polygon)
aliases = ['write_gcode']
description = '%s %s' % ("--", "Saves G-code of a CNC Job object to file.")
# Dictionary of types from Tcl command, needs to be ordered.
# For positional arguments
arg_names = collections.OrderedDict([
@@ -24,7 +26,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
option_types = collections.OrderedDict([
('preamble', str),
('postamble', str),
('muted', int)
('muted', str)
])
# array of mandatory options for current Tcl command: required = {'name','outname'}
@@ -38,7 +40,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
('filename', 'Output filename. Required.'),
('preamble', 'Text to append at the beginning.'),
('postamble', 'Text to append at the end.'),
('muted', 'It will not put errors in the Shell or status bar.')
('muted', 'It will not put errors in the Shell or status bar. True (1) or False (0)')
]),
'examples': ["write_gcode name c:\\\\gcode_repo"]
@@ -67,9 +69,9 @@ class TclCommandWriteGCode(TclCommandSignaled):
postamble = args['postamble'] if 'postamble' in args else ''
if 'muted' in args:
muted = args['muted']
muted = bool(eval(args['muted']))
else:
muted = 0
muted = False
# TODO: This is not needed any more? All targets should be present.
# If there are promised objects, wait until all promises have been fulfilled.
@@ -91,7 +93,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
try:
obj = self.app.collection.get_by_name(str(obj_name))
except Exception:
if muted == 0:
if muted is False:
return "Could not retrieve object: %s" % obj_name
else:
return "fail"
@@ -99,7 +101,7 @@ class TclCommandWriteGCode(TclCommandSignaled):
try:
obj.export_gcode(str(filename), str(preamble), str(postamble))
except Exception as e:
if not muted:
if muted is False:
return "Operation failed: %s" % str(e)
else:
return