You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tree views are currently duplicated for geology, fluid and background collections, in order use a hierarchy based on geological vs topological type. This is obtained by two different methods of the BaseView() abstract class: create_geology_tree and create_topology_tree, create_fluid_tree and create_fluid_tree, and create_background_tree and create_background_tree.
On the other hand all other collections use single table views, with the exception of cross-sections that use a single tree view.
This complex system with a lot of code redundancy can be simplified with the following strategy.
Use tree views for all collections. Even with a simplified structure as for cross-sections, this allows activating o hiding all entities of a given collection with a single click. Hence table views must be converted to tree views.
Use a single tree for geology, fluid and background. The hierarchy can be generated using the functions we already have, that could be called by a signal (e.g. when clicking on the tree header), and should be modified to point to the same tree by using the same self.GeologyTreeWidget in both the create_geology_tree and create_topology_tree methods. TopologyTreeWidget should be simply removed from the GUI in Qt Designer.
def create_geology_tree(self):
"""Create geology tree with checkboxes and properties"""
self.GeologyTreeWidget.clear()
self.GeologyTreeWidget.setColumnCount(3)
self.GeologyTreeWidget.setHeaderLabels(
["Type > Feature > Scenario > Name", "uid", "property"]
)
# hide the uid column
self.GeologyTreeWidget.hideColumn(1)
self.GeologyTreeWidget.setItemsExpandable(True)
geo_types = pd_unique(self.parent.geol_coll.df.query(self.view_filter)["geological_type"])
for geo_type in geo_types:
# self.GeologyTreeWidget as parent -> top level
glevel_1 = QTreeWidgetItem(
self.GeologyTreeWidget, [geo_type]
)
def create_topology_tree(self):
"""Create topology tree with checkboxes and properties"""
self.TopologyTreeWidget.clear()
self.TopologyTreeWidget.setColumnCount(3)
self.TopologyTreeWidget.setHeaderLabels(
["Type > Scenario > Name", "uid", "property"]
)
# hide the uid column
self.TopologyTreeWidget.hideColumn(1)
self.TopologyTreeWidget.setItemsExpandable(True)
topo_types = pd_unique(self.parent.geol_coll.df.query(self.view_filter)["topological_type"])
for topo_type in topo_types:
# self.GeologyTreeWidget as parent -> top level
tlevel_1 = QTreeWidgetItem(
self.TopologyTreeWidget, [topo_type]
)
The state of tick boxes and property combo boxes in e.g. self.GeologyTreeWidget and self.TopologyTreeWidget is currently synchronized between the duplicated trees and with the self.actors_df (listing all actors by uid and whether they are shown or hidden, and if a particular property is shown) with a complex system of signals in methods: update_geology_checkboxes, update_topology_checkboxes, and toggle_geology_topology_visibility. By using a single tree all these could be probably removed. The state of each actor is in any case recorded in self.actors_df and this can be used to populate tick boxes and property combo boxes when switching from geology to topology ordering.
Note that this approach could be useful to add also other different hierarchies, if needed, and to add hierarchy in other collections that at the moment do not have this option.
Ideas? Opinions?
The text was updated successfully, but these errors were encountered:
Tree views are currently duplicated for geology, fluid and background collections, in order use a hierarchy based on geological vs topological type. This is obtained by two different methods of the
BaseView()
abstract class:create_geology_tree
andcreate_topology_tree
,create_fluid_tree
andcreate_fluid_tree
, andcreate_background_tree
andcreate_background_tree
.On the other hand all other collections use single table views, with the exception of cross-sections that use a single tree view.
This complex system with a lot of code redundancy can be simplified with the following strategy.
Use tree views for all collections. Even with a simplified structure as for cross-sections, this allows activating o hiding all entities of a given collection with a single click. Hence table views must be converted to tree views.
Use a single tree for geology, fluid and background. The hierarchy can be generated using the functions we already have, that could be called by a signal (e.g. when clicking on the tree header), and should be modified to point to the same tree by using the same self.
GeologyTreeWidget
in both thecreate_geology_tree
andcreate_topology_tree
methods. TopologyTreeWidget should be simply removed from the GUI in Qt Designer.self.GeologyTreeWidget
andself.TopologyTreeWidget
is currently synchronized between the duplicated trees and with theself.actors_df
(listing all actors byuid
and whether they are shown or hidden, and if a particular property is shown) with a complex system of signals in methods:update_geology_checkboxes
,update_topology_checkboxes
, andtoggle_geology_topology_visibility
. By using a single tree all these could be probably removed. The state of each actor is in any case recorded inself.actors_df
and this can be used to populate tick boxes and property combo boxes when switching from geology to topology ordering.Note that this approach could be useful to add also other different hierarchies, if needed, and to add hierarchy in other collections that at the moment do not have this option.
Ideas? Opinions?
The text was updated successfully, but these errors were encountered: