Commit 63689732 authored by joanna_hurnowicz99's avatar joanna_hurnowicz99
Browse files

bugs fixed

parent b1c0d843
......@@ -213,6 +213,7 @@ class NetworkCanvas(tk.Canvas):
new_components = []
for c_type, pos, prop, nodes in data["components"]:
c_type = eval("gui.network_components." + c_type)
new_component = self.add_component(c_type, pos[0], pos[1])
new_components.append([nodes, new_component])
for p, v in prop.items():
......@@ -237,9 +238,9 @@ class NetworkCanvas(tk.Canvas):
def save_project(self, filename):
with open(filename, "wb") as f:
data = {
"components": [(type(c), c.get_pos(), c.component.properties, c.component.get_nodes())
"components": [(str(c.__class__.__name__), c.get_pos(), c.component.properties, c.component.get_nodes())
for c in self.canvas_components if not isinstance(c, Edge)],
"edges": self.component_graph.get_edges()
"edges": list(self.component_graph.get_edges())
}
if self.background:
data["background"] = {"image": self.background.image_origin, "size": self.background.base_size}
......
......@@ -139,7 +139,12 @@ class Component:
return self.properties
def set_property(self, property, value):
self.properties[property] = value
if isinstance(self.properties[property], flow_graph.Variable) and (isinstance(value, int) or isinstance(value, float)):
self.properties[property].set_value(value)
elif isinstance(self.properties[property], flow_graph.Variable) and isinstance(value, flow_graph.Variable):
self.properties[property].set_value(value.get_value())
else:
self.properties[property] = value
def get_type(self):
return self.__class__.__name__
......
Supports Markdown
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