Skip to content

Commit

Permalink
fix issue where i try printing non-existent property on none in ensem…
Browse files Browse the repository at this point in the history
…bleselector

This raised an AttributeError which Qt swallowed
  • Loading branch information
jonathan-eq committed Dec 18, 2024
1 parent f1d779c commit d644aee
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/ert/gui/ertwidgets/ensembleselector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
update_ert: bool = True,
show_only_undefined: bool = False,
show_only_no_children: bool = False,
show_only_with_valid_experiment: bool = False,
# show_only_with_valid_experiment: bool = False,
):
super().__init__()
self.notifier = notifier
Expand All @@ -38,7 +38,7 @@ def __init__(
# if the ensemble has not been used in an update, as that would
# invalidate the result
self._show_only_no_children = show_only_no_children
self._show_only_with_valid_experiment = show_only_with_valid_experiment
self._show_only_with_valid_experiment = False
self.setSizeAdjustPolicy(QComboBox.AdjustToContents)

self.setEnabled(False)
Expand All @@ -61,15 +61,7 @@ def __init__(

@property
def selected_ensemble(self) -> Ensemble:
print("GETTING SELECTED_ENSEMBLE")
print(f"{self.count()=}")
try:
itemData: LocalEnsemble = self.itemData(self.currentIndex())
except Exception as e:
print(f"{e=}")
raise e

print(f"{itemData.experiment.is_valid()=}")
itemData: LocalEnsemble | None = self.itemData(self.currentIndex())
return itemData

Check failure on line 65 in src/ert/gui/ertwidgets/ensembleselector.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Incompatible return value type (got "LocalEnsemble | None", expected "LocalEnsemble")

def populate(self) -> None:
Expand Down

0 comments on commit d644aee

Please sign in to comment.