Commit 30dc5651 authored by Lars Kruse's avatar Lars Kruse

improved xml state representation slightly

* add a UUID to all interesting objects
* include models in dump
parent d37b4fc8
......@@ -20,7 +20,6 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
import uuid
# imported later (on demand)
#import gtk
......@@ -97,9 +96,11 @@ class Models(pycam.Plugins.ListPluginBase):
self.core.register_namespace("models",
pycam.Plugins.get_filter(self))
self.core.set("models", self)
self.register_state_item("models", self)
return True
def teardown(self):
self.clear_state_items()
self.core.unregister_namespace("models")
if self.gui:
self.core.unregister_ui_section("model_handling")
......@@ -210,6 +211,4 @@ class ModelEntity(pycam.Plugins.ObjectWithAttributes):
def __init__(self, model):
super(ModelEntity, self).__init__("model")
self.model = model
# this UUID is not connected with model.uuid
self["uuid"] = uuid.uuid4()
......@@ -115,7 +115,6 @@ class Processes(pycam.Plugins.ListPluginBase):
self.clear_state_items()
self.core.unregister_namespace("processes")
if self.gui:
self.core.unregister_chain("state_dump", self.dump_state)
self.core.unregister_ui("main", self.gui.get_object("ProcessBox"))
self.core.unregister_ui_section("process_path_parameters")
self.core.unregister_ui("process_parameters",
......
......@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import os
import imp
import inspect
import uuid
# TODO: load these modules only on demand
import gtk
import gobject
......@@ -502,9 +503,9 @@ class ListPluginBase(PluginBase, list):
class ObjectWithAttributes(dict):
def __init__(self, key, params=None):
if params is None:
params = {}
if not params is None:
self.update(params)
self["uuid"] = uuid.uuid4()
self.node_key = key
......
......@@ -42,7 +42,7 @@ def get_xml(item, name=None):
return leaf
else:
leaf = ET.Element(name)
leaf.text = repr(item)
leaf.text = str(item)
return leaf
def parse_xml_dict(item):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment