Skip to content

Commit

Permalink
Defer postload so parent items can properly update themselves
Browse files Browse the repository at this point in the history
  • Loading branch information
amolenaar committed May 13, 2020
1 parent 8ac464d commit 07d55b4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions gaphor/UML/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def update_shapes(self, event=None):
draw=draw_border
)

def postload(self):
self.update_shapes()
super().postload()


def draw_component_icon(box, context, bounding_box):
bar_width = 12
Expand Down
4 changes: 4 additions & 0 deletions gaphor/UML/components/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def update_shapes(self, event=None):
draw=draw_node
)

def postload(self):
self.update_shapes()
super().postload()


def draw_node(box, context, bounding_box):
cr = context.cairo
Expand Down
4 changes: 3 additions & 1 deletion gaphor/diagram/copypaste.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ def paste_presentation(copy_data: PresentationCopy, diagram, lookup):
for value in deserialize(ser, lookup):
item.load(name, value)
item.canvas.update_matrices([item])
item.postload()
return item


Expand Down Expand Up @@ -227,4 +226,7 @@ def item_lookup(ref: str):
continue
new_items[old_id] = paste(data, diagram, item_lookup)

for new_item in new_items.values():
new_item.postload()

return set(new_items.values())

0 comments on commit 07d55b4

Please sign in to comment.