From 06f635a940b735dbddbabc445e334ceda862798e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Petter=20=C3=98ren=20Hauge?= Date: Thu, 6 Jun 2019 11:59:48 +0200 Subject: [PATCH] Leave parent default QAbstractItemModel The parent in the createIndex function from QAbstractItemModel refers to a datamodel, not a GUI component. Setting it incorrectly results in ASSERT failure in the QAbstractItemView::setModel. Fixed a minor bug with defaults for iteration number as well --- ert_gui/ertwidgets/models/all_cases_model.py | 2 +- ert_gui/tools/load_results/load_results_model.py | 2 +- ert_gui/tools/plot/data_type_keys_list_model.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ert_gui/ertwidgets/models/all_cases_model.py b/ert_gui/ertwidgets/models/all_cases_model.py index 298f8dcc479..ae4aeed7ebe 100644 --- a/ert_gui/ertwidgets/models/all_cases_model.py +++ b/ert_gui/ertwidgets/models/all_cases_model.py @@ -15,7 +15,7 @@ def __init__(self): self.__data = [] def index(self, row, column, parent=None, *args, **kwargs): - return self.createIndex(row, column, parent) + return self.createIndex(row, column) def parent(self, index=None): return QModelIndex() diff --git a/ert_gui/tools/load_results/load_results_model.py b/ert_gui/tools/load_results/load_results_model.py index 9e44939a802..7e5c45ec6d2 100644 --- a/ert_gui/tools/load_results/load_results_model.py +++ b/ert_gui/tools/load_results/load_results_model.py @@ -67,7 +67,7 @@ def getIterationCount(): iteration = 0 valid_directory = True while valid_directory: - formatted = run_path % (0, iteration) + formatted = run_path % (0, iteration + 1) valid_directory = os.path.exists(formatted) if valid_directory: iteration += 1 diff --git a/ert_gui/tools/plot/data_type_keys_list_model.py b/ert_gui/tools/plot/data_type_keys_list_model.py index 97361b8891e..dbb842f9352 100644 --- a/ert_gui/tools/plot/data_type_keys_list_model.py +++ b/ert_gui/tools/plot/data_type_keys_list_model.py @@ -27,7 +27,7 @@ def keyManager(self): return self.__ert.getKeyManager() def index(self, row, column, parent=None, *args, **kwargs): - return self.createIndex(row, column, parent) + return self.createIndex(row, column) def parent(self, index=None): return QModelIndex()