Skip to content

Commit

Permalink
Add more debugging prints
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Dec 20, 2024
1 parent f073d13 commit cce2001
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 20 additions & 6 deletions src/ert/gui/tools/manage_experiments/storage_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,27 @@ def row(self) -> int:
return self._parent._children.index(self)
return 0

@override
def hasChildren(self, index):

Check failure on line 113 in src/ert/gui/tools/manage_experiments/storage_model.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Function is missing a type annotation
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:

Check failure on line 126 in src/ert/gui/tools/manage_experiments/storage_model.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Return type "ItemFlag" of "flags" incompatible with return type "ItemFlags" in supertype "QAbstractItemModel"
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

Check failure on line 130 in src/ert/gui/tools/manage_experiments/storage_model.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Incompatible return value type (got "int", expected "ItemFlag")
print("FLAGS WAS VALID")
return default_flags

def data(
self, index: QModelIndex, role: Qt.ItemDataRole = Qt.ItemDataRole.DisplayRole

Check failure on line 135 in src/ert/gui/tools/manage_experiments/storage_model.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Argument 2 of "data" is incompatible with supertype "QAbstractItemModel"; supertype defines the argument type as "int"
Expand Down
5 changes: 4 additions & 1 deletion src/ert/gui/tools/manage_experiments/storage_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand All @@ -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)
Expand Down

0 comments on commit cce2001

Please sign in to comment.