gecos-lab / PZero

GNU Affero General Public License v3.0
22 stars 2 forks source link

remove entity method in views #68

Closed andrea-bistacchi closed 4 months ago

andrea-bistacchi commented 4 months ago

The remove_entity method in BaseView, as implemented now, should be moved to VTKView since it calls the PyVista plotter.

However, as it is implemented now, it: 1) removes the selected actor from plotter in the active view (but not all views) 2) calls the general entity_remove() method of the parent project and removes the entity from the whole project (*). 3) this in turns triggers a signal that removes all actors with the selected uid in all views, so (1) is not necessary

Problems to be corrected here seem to be:

a) (1) is not necessary, and removing it, the method could become general since it no more calls the PyVista plotter b) not clear how the general entity_remove() method works since it is called without argument

andrea-bistacchi commented 4 months ago

As far as I understand, the remove_entity method in BaseView works calling self.parent.entity_remove() in the main project, without any argument, since selected objects are synchronized between the project and active plotting window.

Code used to remove the actor in the active plotting window (see below) can and must be deleted since (i) this affects only the active window, but not all the other ones, and (ii) actors in all plotting windows are already removed by signals fired by each collection, when deleting an entity.

I remove the following lines and keep the method, that now is more general, in BaseView().

for sel_uid in self.selected_uids:
    self.plotter.remove_actor(f"{sel_uid}_silh")
andrea-bistacchi commented 4 months ago

I misunderstood. The code above removes the temporary yellow silhouette actor used to highlight selected objects.

I restored the code above and moved the method to VTKView()