- finished the moving of all Tcl Shell stuff out of the FlatCAAMApp class to flatcamTools.ToolShell class

- updated the requirements.txt file to request that the Shapely package needs to be at least version 1.7.0 as it is needed in the latest versions of FlatCAM beta
- some TOOD cleanups
- minor changes
This commit is contained in:
Marius Stanciu
2020-04-27 06:55:08 +03:00
committed by Marius
parent c7bd395368
commit 61020e3624
9 changed files with 268 additions and 386 deletions

View File

@@ -71,7 +71,7 @@ class TclCommand(object):
:return: none
"""
self.app.raise_tcl_error(text)
self.app.shell.raise_tcl_error(text)
def get_current_command(self):
"""
@@ -275,7 +275,7 @@ class TclCommand(object):
# because of signaling we cannot call error to TCL from here but when task
# is finished also non-signaled are handled here to better exception
# handling and displayed after command is finished
raise self.app.TclErrorException(text)
raise self.app.shell.TclErrorException(text)
def execute_wrapper(self, *args):
"""
@@ -296,7 +296,7 @@ class TclCommand(object):
except Exception as unknown:
error_info = sys.exc_info()
self.log.error("TCL command '%s' failed. Error text: %s" % (str(self), str(unknown)))
self.app.display_tcl_error(unknown, error_info)
self.app.shell.display_tcl_error(unknown, error_info)
self.raise_tcl_unknown_error(unknown)
@abc.abstractmethod
@@ -400,9 +400,9 @@ class TclCommandSignaled(TclCommand):
raise ex[0]
if status['timed_out']:
self.app.raise_tcl_unknown_error("Operation timed outed! Consider increasing option "
"'-timeout <miliseconds>' for command or "
"'set_sys global_background_timeout <miliseconds>'.")
self.app.shell.raise_tcl_unknown_error("Operation timed outed! Consider increasing option "
"'-timeout <miliseconds>' for command or "
"'set_sys global_background_timeout <miliseconds>'.")
try:
self.log.debug("TCL command '%s' executed." % str(type(self).__name__))
@@ -439,5 +439,5 @@ class TclCommandSignaled(TclCommand):
else:
error_info = sys.exc_info()
self.log.error("TCL command '%s' failed." % str(self))
self.app.display_tcl_error(unknown, error_info)
self.app.shell.display_tcl_error(unknown, error_info)
self.raise_tcl_unknown_error(unknown)

View File

@@ -65,10 +65,10 @@ class TclCommandHelp(TclCommand):
if 'name' in args:
name = args['name']
if name not in self.app.tcl_commands_storage:
if name not in self.app.shell.tcl_commands_storage:
return "Unknown command: %s" % name
help_for_command = self.app.tcl_commands_storage[name]["help"] + '\n\n'
help_for_command = self.app.shell.tcl_commands_storage[name]["help"] + '\n\n'
self.app.shell.append_output(help_for_command)
else:
if not args:
@@ -78,19 +78,21 @@ class TclCommandHelp(TclCommand):
try:
# find the maximum length of a command name
max_len = 0
for cmd_name in self.app.tcl_commands_storage:
for cmd_name in self.app.shell.tcl_commands_storage:
curr_len = len(cmd_name)
if curr_len > max_len:
max_len = curr_len
h_space = "&nbsp;"
cnt = 0
for cmd_name in sorted(self.app.tcl_commands_storage):
cmd_description = "<span>%s</span>" % self.app.tcl_commands_storage[cmd_name]['description']
for cmd_name in sorted(self.app.shell.tcl_commands_storage):
cmd_description = "<span>%s</span>" % \
self.app.shell.tcl_commands_storage[cmd_name]['description']
curr_len = len(cmd_name)
cmd_name_colored = "<span style=\" font-weight: bold; color: red;\" >%s</span>" % str(cmd_name)
cmd_name_colored = "> <span style=\" font-weight: bold; color: red;\" >%s</span>" % \
str(cmd_name)
nr_chars = max_len - curr_len
@@ -105,8 +107,8 @@ class TclCommandHelp(TclCommand):
else:
cnt += 1
except Exception as err:
self.app.log.debug("App.setup_shell.shelp() when run as 'help' --> %s" % str(err))
displayed_text = ['> %s\n' % cmd for cmd in sorted(self.app.tcl_commands_storage)]
self.app.log.debug("tclCommands.TclCommandHelp() when run as 'help' --> %s" % str(err))
displayed_text = ['> %s' % cmd for cmd in sorted(self.app.shell.tcl_commands_storage)]
cmd_enum += '<br>'.join(displayed_text)
cmd_enum += '<br><br>%s<br>%s<br><br>' % (