- fixed the FlatCMAScript object when loading it from a project

This commit is contained in:
Marius Stanciu 2019-10-02 22:59:50 +03:00 committed by Marius
parent b9b0c8fee8
commit 5143cafc59
3 changed files with 20 additions and 4 deletions

View File

@ -3980,6 +3980,7 @@ class App(QtCore.QObject):
# object that is created, it will strip the name of the object and the underline (if the original key was
# let's say "excellon_toolchange", it will strip the excellon_) and to the obj.options the key will become
# "toolchange"
for option in self.options:
if option.find(kind + "_") == 0:
oname = option[len(kind) + 1:]

View File

@ -6492,6 +6492,21 @@ class FlatCAMScript(FlatCAMObj):
self.kind = "script"
self.options.update({
"plot": True,
"type": 'Script',
"source_file": '',
})
self.units = ''
self.decimals = 4
self.ser_attrs = ['options', 'kind', 'source_file']
self.source_file = ''
self.script_code = ''
self.script_editor_tab = None
def set_ui(self, ui):
FlatCAMObj.set_ui(self, ui)
FlatCAMApp.App.log.debug("FlatCAMScript.set_ui()")
@ -6542,12 +6557,11 @@ class FlatCAMScript(FlatCAMObj):
self.ui.autocomplete_cb.stateChanged.connect(self.on_autocomplete_changed)
# add the source file to the Code Editor
self.ser_attrs = ['options', 'kind', 'source_file']
for line in self.source_file.splitlines():
self.script_editor_tab.code_editor.append(line)
self.ser_attrs = ['options', 'kind', 'source_file']
self.build_ui()
def build_ui(self):

View File

@ -20,8 +20,9 @@ CAD program, and create G-Code for Isolation routing.
- reused the Multiprocessing Pool declared in the App for the ToolRulesCheck() class
- adapted the Project context menu for the new types of FLatCAM objects
- modified the setup_recent_files to accommodate the new FlatCAM objects
- made sure that when an FlatCAMscript object is deleted, it's associated Tab is closed
- made sure that when an FlatCAMScript object is deleted, it's associated Tab is closed
- fixed the FlatCMAScript object saving when project is saved (loading a project with this script object is not working yet)
- fixed the FlatCMAScript object when loading it from a project
1.10.2019