From 65d4b52ac0d050f8982724021811898fb859bd18 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Mon, 25 Sep 2023 16:39:36 +0200 Subject: [PATCH] affects and affected by list fixing CURA-11002 --- UM/Settings/Models/SettingDefinitionsModel.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/UM/Settings/Models/SettingDefinitionsModel.py b/UM/Settings/Models/SettingDefinitionsModel.py index cf359a7d35..4bc18c7612 100644 --- a/UM/Settings/Models/SettingDefinitionsModel.py +++ b/UM/Settings/Models/SettingDefinitionsModel.py @@ -471,7 +471,8 @@ def getRequires(self, key: str, role: str = None) -> List[Dict[str, Any]]: if self._i18n_catalog: label = self._i18n_catalog.i18nc(relation.target.key + " label", label) - result.append({ "key": relation.target.key, "label": label}) + if not self.foundKeyInresult(relation.target.key, result) and (label !=""): + result.append({ "key": relation.target.key, "label": label}) return result @@ -493,7 +494,8 @@ def getRequiredBy(self, key: str, role: str = None) -> List[Dict[str, Any]]: if self._i18n_catalog: label = self._i18n_catalog.i18nc(relation.target.key + " label", label) - result.append({ "key": relation.target.key, "label": label}) + if not self.foundKeyInresult(relation.target.key, result) and (label !=""): + result.append({ "key": relation.target.key, "label": label}) return result @@ -526,6 +528,12 @@ def rowCount(self, parent = None) -> int: return self.count + def foundKeyInresult(self, key, result): + for key_i in result: + if key_i["key"] == key: + return True + return False + def data(self, index, role): """Reimplemented from QAbstractListModel"""