gecos-lab / PZero

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

mysterious cross-calling between wells and others collections #77

Open andrea-bistacchi opened 1 week ago

andrea-bistacchi commented 1 week ago

In the process of simplifying signals activated when the legend is modified, I found this mysterious code (and other similar in collections):

def geology_legend_color_modified_update_views(self, updated_list=None):
        """This is called when the color in the geological legend is modified.
        Disconnect signals to geology and topology tree, if they are set, to avoid a nasty loop
        that disrupts the trees, then they are reconnected when the trees are rebuilt"""
        self.GeologyTreeWidget.itemChanged.disconnect()
        self.TopologyTreeWidget.itemChanged.disconnect()
        for uid in updated_list:
            """Case for color changed"""
            wells_list = self.parent.well_coll.get_uids()
            if self.parent.geol_coll.get_uid_x_section(uid) in wells_list:
                self.change_actor_color(
                    uid=self.parent.geol_coll.get_uid_x_section(uid),
                    collection="well_coll",
                )
            self.change_actor_color(uid=uid, collection="geol_coll")

        """Re-connect signals."""
        self.GeologyTreeWidget.itemChanged.connect(
            self.toggle_geology_topology_visibility
        )
        self.TopologyTreeWidget.itemChanged.connect(
            self.toggle_geology_topology_visibility
        )

Why do we check if a well uid is in a column dedicated to cross sections? It should not be included there.

Similar code is also included in:

def fluid_legend_color_modified_update_views

def background_legend_color_modified_update_views

In any case, since I'm simplifying the functions used when the legend is modified, all this will disappear, unless there is some reason to keep it.

andrea-bistacchi commented 1 week ago

Is this for markers and annotations that belong to geology, fluid and background, but are associated to a particular well?

I think we must add a well column, similar to x_section, for clarity and because otherwise it would be impossible to have wells projected on cross sections.

gbene commented 1 week ago

Hi. Yes when discussing and developing wells we agreed to temporarily use the xsection column (with plans to add the proper well column) to assign well related objects to a given well.