(self, shapes)
| 383 | return self |
| 384 | |
| 385 | async def _clear(self, shapes): |
| 386 | |
| 387 | if len(shapes) == 0: |
| 388 | self.ren.RemoveAllViewProps() |
| 389 | |
| 390 | self.actors.clear() |
| 391 | self.shapes.clear() |
| 392 | |
| 393 | self.state.actors = [] |
| 394 | self.active = None |
| 395 | |
| 396 | for s in shapes: |
| 397 | # handle shapes |
| 398 | if instance_of(s, ShapeLike): |
| 399 | uuids = tuple(self.shapes.inv[s]) |
| 400 | for uuid in uuids: |
| 401 | for a in self.actors.pop(uuid): |
| 402 | self.ren.RemoveActor(a) |
| 403 | |
| 404 | del self.shapes[ |
| 405 | uuid |
| 406 | ] # NB this will remove all uuids pointing to the shape |
| 407 | |
| 408 | # handle other actors |
| 409 | else: |
| 410 | for uuid, acts in self.actors.items(): |
| 411 | if s in acts: |
| 412 | for el in self.actors.pop(uuid): |
| 413 | self.ren.RemoveActor(el) |
| 414 | |
| 415 | # store the uuid for state update |
| 416 | uuids = [uuid] |
| 417 | |
| 418 | break |
| 419 | |
| 420 | # remove the id==k rows from actors |
| 421 | new_state = [] |
| 422 | for el in self.state.actors: |
| 423 | if el["id"] not in uuids: |
| 424 | new_state.append(el) |
| 425 | |
| 426 | self.state.actors = new_state |
| 427 | |
| 428 | self._update_state("actors") |
| 429 | self.view.update() |
| 430 | |
| 431 | def clear(self, *shapes: Shape | vtkProp3D): |
| 432 | """ |
no test coverage detected