From 3ab2bb00a27d7a20778c9787de1cb26c9ca9c60b Mon Sep 17 00:00:00 2001 From: alexhroom Date: Mon, 11 Nov 2024 14:56:49 +0000 Subject: [PATCH] fixed domain contrast display --- rascal2/widgets/delegates.py | 7 +++---- rascal2/widgets/project/models.py | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rascal2/widgets/delegates.py b/rascal2/widgets/delegates.py index b776803..d0f204a 100644 --- a/rascal2/widgets/delegates.py +++ b/rascal2/widgets/delegates.py @@ -91,14 +91,13 @@ def createEditor(self, parent, option, index): layers = self.project_widget.draft_project["layers"] widget.addItems([layer.name for layer in layers]) - current_layers = index.data(QtCore.Qt.ItemDataRole.DisplayRole) - widget.select_indices([i for i, layer in enumerate(layers) if layer in current_layers]) - return widget def setEditorData(self, editor: MultiSelectComboBox, index): data = index.data(QtCore.Qt.ItemDataRole.DisplayRole) - editor.select_indices([i for i, layer in enumerate(data) if layer in data]) + layers = self.project_widget.draft_project["layers"] + + editor.select_indices([i for i, layer in enumerate(layers) if layer.name in data]) def setModelData(self, editor, model, index): data = editor.selected_items() diff --git a/rascal2/widgets/project/models.py b/rascal2/widgets/project/models.py index cad3320..78d7ded 100644 --- a/rascal2/widgets/project/models.py +++ b/rascal2/widgets/project/models.py @@ -54,6 +54,8 @@ def data(self, index, role=QtCore.Qt.ItemDataRole.DisplayRole): # pyqt can't automatically coerce enums to strings... if isinstance(data, Enum): return str(data) + if isinstance(data, list): + return ", ".join(data) return data elif role == QtCore.Qt.ItemDataRole.CheckStateRole and self.index_header(index) == "fit": return QtCore.Qt.CheckState.Checked if data else QtCore.Qt.CheckState.Unchecked