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.get_nodes())
"components": [(str(c.__class__.__name__), c.get_pos(),, 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:
def set_property(self, property, value):[property] = value
if isinstance([property], flow_graph.Variable) and (isinstance(value, int) or isinstance(value, float)):[property].set_value(value)
elif isinstance([property], flow_graph.Variable) and isinstance(value, flow_graph.Variable):[property].set_value(value.get_value())
else:[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