- fixed the FlatCMAScript object saving when project is saved (loading a project with this script object is not working yet)
This commit is contained in:
parent
a75bdfb29d
commit
b9b0c8fee8
|
@ -6546,6 +6546,8 @@ class FlatCAMScript(FlatCAMObj):
|
|||
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):
|
||||
|
@ -6617,6 +6619,35 @@ class FlatCAMScript(FlatCAMObj):
|
|||
else:
|
||||
self.script_editor_tab.code_editor.completer_enable = False
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Returns a representation of the object as a dictionary.
|
||||
Attributes to include are listed in ``self.ser_attrs``.
|
||||
|
||||
:return: A dictionary-encoded copy of the object.
|
||||
:rtype: dict
|
||||
"""
|
||||
d = {}
|
||||
for attr in self.ser_attrs:
|
||||
d[attr] = getattr(self, attr)
|
||||
return d
|
||||
|
||||
def from_dict(self, d):
|
||||
"""
|
||||
Sets object's attributes from a dictionary.
|
||||
Attributes to include are listed in ``self.ser_attrs``.
|
||||
This method will look only for only and all the
|
||||
attributes in ``self.ser_attrs``. They must all
|
||||
be present. Use only for deserializing saved
|
||||
objects.
|
||||
|
||||
:param d: Dictionary of attributes to set in the object.
|
||||
:type d: dict
|
||||
:return: None
|
||||
"""
|
||||
for attr in self.ser_attrs:
|
||||
setattr(self, attr, d[attr])
|
||||
|
||||
|
||||
class FlatCAMDocument(FlatCAMObj):
|
||||
"""
|
||||
|
|
|
@ -20,7 +20,8 @@ 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 FlatCAM script 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)
|
||||
|
||||
1.10.2019
|
||||
|
||||
|
|
Loading…
Reference in New Issue