Make Presentation.update() optional

This commit is contained in:
Arjan Molenaar 2021-03-16 21:06:17 +01:00
parent 5d2b063bc8
commit 297cf35da6
No known key found for this signature in database
GPG Key ID: BF977B918996CB13
4 changed files with 3 additions and 11 deletions

View File

@ -240,9 +240,6 @@ class ForkNodeItem(Presentation[UML.ForkNode], HandlePositionUpdate, Named):
def ports(self):
return self._ports
def update(self, context):
pass
def save(self, save_func):
save_func("matrix", tuple(self.matrix))
save_func("height", float(self._handles[1].pos.y))

View File

@ -100,9 +100,6 @@ class ExecutionSpecificationItem(
pt, pb = (h.pos for h in self._handles)
return Rectangle(pt.x - d / 2, pt.y, d, y1=pb.y)
def update(self, context):
pass
def draw(self, context):
self.shape.draw(context, self.dimensions())

View File

@ -370,8 +370,9 @@ class Diagram(PackageableElement):
def _update_items(self, items):
for item in items:
context = UpdateContext(style=self.style(StyledItem(item)))
item.update(context)
update = getattr(item, "update", None)
if update:
update(UpdateContext(style=self.style(StyledItem(item))))
def _on_constraint_solved(self, cinfo: gaphas.connections.Connection) -> None:
dirty_items = set()

View File

@ -221,9 +221,6 @@ class LinePresentation(gaphas.Line, HandlePositionUpdate, Presentation[S]):
self.remove_watch_handle(handle)
super().remove_handle(handle)
def update(self, context):
pass
def update_shape_bounds(self, context):
def shape_bounds(shape, align):
if shape: