Skip to content

Commit

Permalink
Remove parentheses, replace signal
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Nov 21, 2024
1 parent 9aff76c commit c946b5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/ert/gui/simulation/run_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ def __init__(self, snapshot_model: SnapshotModel, parent: QWidget | None) -> Non
# Only last section should be stretch
horizontal_header.setSectionResizeMode(
section,
(
QHeaderView.Stretch
if section == horizontal_header.count() - 1
else QHeaderView.Interactive
),
QHeaderView.Stretch
if section == horizontal_header.count() - 1
else QHeaderView.Interactive,
)

vertical_header = self.verticalHeader()
Expand Down Expand Up @@ -313,8 +311,8 @@ def on_snapshot_new_iteration(

widget = RealizationWidget(iter_row)
widget.setSnapshotModel(self._snapshot_model)
widget.currentChanged.connect(self._select_real)
widget.currentChanged.emit(widget._real_list_model.index(0, 0))
widget.itemClicked.connect(self._select_real)
widget.itemClicked.emit(widget._real_list_model.index(0, 0))
tab_index = self._tab_widget.addTab(
widget, f"Realizations for iteration {index.internalPointer().id_}"
)
Expand Down
3 changes: 2 additions & 1 deletion src/ert/gui/simulation/view/realization.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def setSnapshotModel(self, model: QAbstractItemModel) -> None:

first_real = self._real_list_model.index(0, 0)
selection_model = self._real_view.selectionModel()
selection_model.select(first_real, QItemSelectionModel.SelectionFlag.Select)
if first_real.isValid():
selection_model.select(first_real, QItemSelectionModel.SelectionFlag.Select)

def clearSelection(self) -> None:
self._real_view.clearSelection()
Expand Down

0 comments on commit c946b5d

Please sign in to comment.