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 ...@@ -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/>. along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
""" """
import uuid
# imported later (on demand) # imported later (on demand)
#import gtk #import gtk
...@@ -97,9 +96,11 @@ class Models(pycam.Plugins.ListPluginBase): ...@@ -97,9 +96,11 @@ class Models(pycam.Plugins.ListPluginBase):
self.core.register_namespace("models", self.core.register_namespace("models",
pycam.Plugins.get_filter(self)) pycam.Plugins.get_filter(self))
self.core.set("models", self) self.core.set("models", self)
self.register_state_item("models", self)
return True return True
def teardown(self): def teardown(self):
self.clear_state_items()
self.core.unregister_namespace("models") self.core.unregister_namespace("models")
if self.gui: if self.gui:
self.core.unregister_ui_section("model_handling") self.core.unregister_ui_section("model_handling")
...@@ -210,6 +211,4 @@ class ModelEntity(pycam.Plugins.ObjectWithAttributes): ...@@ -210,6 +211,4 @@ class ModelEntity(pycam.Plugins.ObjectWithAttributes):
def __init__(self, model): def __init__(self, model):
super(ModelEntity, self).__init__("model") super(ModelEntity, self).__init__("model")
self.model = 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): ...@@ -115,7 +115,6 @@ class Processes(pycam.Plugins.ListPluginBase):
self.clear_state_items() self.clear_state_items()
self.core.unregister_namespace("processes") self.core.unregister_namespace("processes")
if self.gui: 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("main", self.gui.get_object("ProcessBox"))
self.core.unregister_ui_section("process_path_parameters") self.core.unregister_ui_section("process_path_parameters")
self.core.unregister_ui("process_parameters", self.core.unregister_ui("process_parameters",
......
...@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>. ...@@ -23,6 +23,7 @@ along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
import os import os
import imp import imp
import inspect import inspect
import uuid
# TODO: load these modules only on demand # TODO: load these modules only on demand
import gtk import gtk
import gobject import gobject
...@@ -502,9 +503,9 @@ class ListPluginBase(PluginBase, list): ...@@ -502,9 +503,9 @@ class ListPluginBase(PluginBase, list):
class ObjectWithAttributes(dict): class ObjectWithAttributes(dict):
def __init__(self, key, params=None): def __init__(self, key, params=None):
if params is None: if not params is None:
params = {}
self.update(params) self.update(params)
self["uuid"] = uuid.uuid4()
self.node_key = key self.node_key = key
......
...@@ -42,7 +42,7 @@ def get_xml(item, name=None): ...@@ -42,7 +42,7 @@ def get_xml(item, name=None):
return leaf return leaf
else: else:
leaf = ET.Element(name) leaf = ET.Element(name)
leaf.text = repr(item) leaf.text = str(item)
return leaf return leaf
def parse_xml_dict(item): 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