diff --git a/src/ert/gui/tools/manage_experiments/manage_experiments_panel.py b/src/ert/gui/tools/manage_experiments/manage_experiments_panel.py index 7e07dc268ed..9aca5fb0021 100644 --- a/src/ert/gui/tools/manage_experiments/manage_experiments_panel.py +++ b/src/ert/gui/tools/manage_experiments/manage_experiments_panel.py @@ -47,7 +47,7 @@ def __init__(self, config: ErtConfig, notifier: ErtNotifier, ensemble_size: int) def _add_create_new_ensemble_tab(self) -> None: panel = QWidget() panel.setObjectName("create_new_ensemble_tab") - + print(f"{self.ensemble_size=}") layout = QHBoxLayout() storage_widget = StorageWidget( self.notifier, self.ert_config, self.ensemble_size diff --git a/src/ert/gui/tools/manage_experiments/storage_model.py b/src/ert/gui/tools/manage_experiments/storage_model.py index b75d58cf674..38c3017736f 100644 --- a/src/ert/gui/tools/manage_experiments/storage_model.py +++ b/src/ert/gui/tools/manage_experiments/storage_model.py @@ -109,13 +109,27 @@ def row(self) -> int: return self._parent._children.index(self) return 0 + @override + def hasChildren(self, index): + print("CALLED HAS_CHILDREN") + if not index.isValid(): + return True + + flags = self.flags(index) + # hide children if disabled + if not (flags & Qt.ItemFlag.ItemIsEnabled): + return False + + return super().hasChildren(index) + + @override def flags(self, index: QModelIndex) -> Qt.ItemFlag: - print(f"2.{self=}") - return ( - Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable - if self._is_valid - else None - ) + default_flags = super().flags(index) + if not self._is_valid: + print("FLAGS WAS INVALID") + return default_flags & ~Qt.ItemFlag.ItemIsEnabled + print("FLAGS WAS VALID") + return default_flags def data( self, index: QModelIndex, role: Qt.ItemDataRole = Qt.ItemDataRole.DisplayRole diff --git a/src/ert/gui/tools/manage_experiments/storage_widget.py b/src/ert/gui/tools/manage_experiments/storage_widget.py index a062254607a..2fdfc826dde 100644 --- a/src/ert/gui/tools/manage_experiments/storage_widget.py +++ b/src/ert/gui/tools/manage_experiments/storage_widget.py @@ -100,6 +100,9 @@ def __init__( self._tree_view = QTreeView(self) storage_model = StorageModel(self._notifier.storage) notifier.storage_changed.connect(storage_model.reloadStorage) + notifier.storage_changed.connect( + lambda *args, **kwargs: print("Storage changed") + ) notifier.ertChanged.connect( lambda: storage_model.reloadStorage(self._notifier.storage) ) @@ -108,7 +111,7 @@ def __init__( search_bar.setPlaceholderText("Filter") proxy_model = _SortingProxyModel(storage_model) proxy_model.setFilterKeyColumn(-1) # Search all columns. - proxy_model.setSourceModel(storage_model) + proxy_model.setSourceModel(storage_model) # JONAK - CAN THIS BE REMOVED? proxy_model.sort(0, Qt.SortOrder.AscendingOrder) self._tree_view.setModel(proxy_model)