commit
314591f85a
|
@ -2661,7 +2661,11 @@ class App(QtCore.QObject):
|
|||
self.ui.editgeo_btn.triggered.connect(self.object2editor)
|
||||
self.ui.update_obj_btn.triggered.connect(lambda: self.editor2object())
|
||||
self.ui.delete_btn.triggered.connect(self.on_delete)
|
||||
|
||||
self.ui.shell_btn.triggered.connect(self.on_toggle_shell)
|
||||
self.ui.new_script_btn.triggered.connect(self.on_filenewscript)
|
||||
self.ui.open_script_btn.triggered.connect(self.on_fileopenscript)
|
||||
self.ui.run_script_btn.triggered.connect(self.on_filerunscript)
|
||||
|
||||
# Tools Toolbar Signals
|
||||
self.ui.dblsided_btn.triggered.connect(lambda: self.dblsidedtool.run(toggle=True))
|
||||
|
@ -3028,7 +3032,7 @@ class App(QtCore.QObject):
|
|||
self.display_tcl_error(text)
|
||||
raise self.TclErrorException(text)
|
||||
|
||||
def exec_command(self, text):
|
||||
def exec_command(self, text, no_plot=None):
|
||||
"""
|
||||
Handles input from the shell. See FlatCAMApp.setup_shell for shell commands.
|
||||
Also handles execution in separated threads
|
||||
|
@ -3042,7 +3046,8 @@ class App(QtCore.QObject):
|
|||
result = self.exec_command_test(text, False)
|
||||
|
||||
# MS: added this method call so the geometry is updated once the TCL command is executed
|
||||
self.plot_all()
|
||||
if no_plot is None:
|
||||
self.plot_all()
|
||||
|
||||
return result
|
||||
|
||||
|
@ -3060,6 +3065,7 @@ class App(QtCore.QObject):
|
|||
|
||||
try:
|
||||
self.shell.open_proccessing() # Disables input box.
|
||||
|
||||
result = self.tcl.eval(str(tcl_command_string))
|
||||
if result != 'None':
|
||||
self.shell.append_output(result + '\n')
|
||||
|
@ -5758,6 +5764,9 @@ class App(QtCore.QObject):
|
|||
self.ui.shell_dock.show()
|
||||
|
||||
script_code = self.ui.code_editor.toPlainText()
|
||||
# self.shell._sysShell.exec_command(script_code)
|
||||
|
||||
old_line = ''
|
||||
for tcl_command_line in script_code.splitlines():
|
||||
# do not process lines starting with '#' = comment and empty lines
|
||||
if not tcl_command_line.startswith('#') and tcl_command_line != '':
|
||||
|
@ -5766,8 +5775,34 @@ class App(QtCore.QObject):
|
|||
if sys.platform == 'win32':
|
||||
if "open" in tcl_command_line:
|
||||
tcl_command_line = tcl_command_line.replace('\\', '/')
|
||||
|
||||
if old_line != '':
|
||||
new_command = old_line + tcl_command_line + '\n'
|
||||
else:
|
||||
new_command = tcl_command_line
|
||||
|
||||
# execute the actual Tcl command
|
||||
self.shell._sysShell.exec_command(tcl_command_line)
|
||||
try:
|
||||
self.shell.open_proccessing() # Disables input box.
|
||||
|
||||
result = self.tcl.eval(str(new_command))
|
||||
if result != 'None':
|
||||
self.shell.append_output(result + '\n')
|
||||
|
||||
old_line = ''
|
||||
except tk.TclError as e:
|
||||
old_line = old_line + tcl_command_line + '\n'
|
||||
|
||||
if old_line != '':
|
||||
# it means that the script finished with an error
|
||||
result = self.tcl.eval("set errorInfo")
|
||||
self.log.error("Exec command Exception: %s" % (result + '\n'))
|
||||
self.shell.append_error('ERROR: ' + result + '\n')
|
||||
else:
|
||||
# success! plot all objects
|
||||
self.plot_all()
|
||||
|
||||
self.shell.close_proccessing()
|
||||
|
||||
def on_tool_add_keypress(self):
|
||||
# ## Current application units in Upper Case
|
||||
|
|
|
@ -20,6 +20,9 @@ CAD program, and create G-Code for Isolation routing.
|
|||
- fixed some of the strings that were left in the old way
|
||||
- updated the POT file
|
||||
- updated Romanian language partially
|
||||
- added a new way to handle scripts with repeating Tcl commands
|
||||
- added new buttons in the Tools toolbar for running, opening and adding new scripts
|
||||
- finished the Romanian translation update and updated the POT file
|
||||
|
||||
12.09.2019
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
|||
self.menufilenewscript = QtWidgets.QAction(QtGui.QIcon('share/script_new16.png'), _('New Script ...'), self)
|
||||
self.menufileopenscript = QtWidgets.QAction(QtGui.QIcon('share/script_open16.png'), _('Open Script ...'), self)
|
||||
self.menufilerunscript = QtWidgets.QAction(QtGui.QIcon('share/script16.png'),
|
||||
_('Run Script ...\tSHIFT+S'), self)
|
||||
'%s\tSHIFT+S' % _('Run Script ...'), self)
|
||||
self.menufilerunscript.setToolTip(
|
||||
_("Will run the opened Tcl Script thus\n"
|
||||
"enabling the automation of certain\n"
|
||||
|
@ -653,6 +653,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
|||
|
||||
# ## Shell Toolbar ##
|
||||
self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
|
||||
self.new_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_new24.png'), _('New Script ...'))
|
||||
self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_open18.png'), _('Open Script ...'))
|
||||
self.run_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script16.png'), _('Run Script ...'))
|
||||
|
||||
# ## Tools Toolbar ##
|
||||
self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _("2Sided Tool"))
|
||||
|
@ -2079,6 +2082,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
|
|||
|
||||
# ## Shell Toolbar # ##
|
||||
self.shell_btn = self.toolbarshell.addAction(QtGui.QIcon('share/shell32.png'), _("&Command Line"))
|
||||
self.new_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_new24.png'), _('New Script ...'))
|
||||
self.open_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script_open18.png'), _('Open Script ...'))
|
||||
self.run_script_btn = self.toolbarshell.addAction(QtGui.QIcon('share/script16.png'), _('Run Script ...'))
|
||||
|
||||
# ## Tools Toolbar # ##
|
||||
self.dblsided_btn = self.toolbartools.addAction(QtGui.QIcon('share/doubleside32.png'), _("2Sided Tool"))
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 345 B |
Binary file not shown.
After Width: | Height: | Size: 247 B |
Binary file not shown.
After Width: | Height: | Size: 356 B |
Loading…
Reference in New Issue