gecos-lab / PZero

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

crash when changing point size and opacity in legend with cross section window open #64

Open andrea-bistacchi opened 4 months ago

andrea-bistacchi commented 4 months ago

With a cross section window open, changing the point size for any PolyData results in a crash.

Traceback (most recent call last):
  File "D:\REPOS\PZero\pzero\windows_factory.py", line 218, in <lambda>
    lambda updated_list: self.geology_legend_point_size_modified_update_views(
  File "D:\REPOS\PZero\pzero\windows_factory.py", line 4810, in geology_legend_point_size_modified_update_views
    self.change_actor_point_size(uid=uid, collection="geol_coll")
  File "D:\REPOS\PZero\pzero\windows_factory.py", line 6415, in change_actor_point_size
    self.actors_df.loc[self.actors_df["uid"] == uid, "actor"].values[
IndexError: index 0 is out of bounds for axis 0 with size 0
andrea-bistacchi commented 4 months ago

The same bug affects changing actor opacity.

andrea-bistacchi commented 4 months ago

The bug was due to some entities not being shown as actors in cross sections (oly entities belonging to the section are shown as actors).

This was already captured by a condition when changing line thickness and color, but not for opacity and point size (*):

sec_uid = self.this_x_section_uid
attr = getattr(self.parent, collection)
    if attr.get_uid_x_section(uid=uid) == sec_uid:

I solved by adding the condition

if uid in self.actors_df.uid:

in:

change_actor_color
change_actor_opacity
change_actor_line_thick
change_actor_point_size

in the BaseViewclass. It is possible that the condition above (*) on the section could be removed now, but...

PZero does not crash anymore when changing point size or opacity, however for some strange reason if color is changed in legend, it does not change in cross sections.