Skip to content

Commit

Permalink
affects and affected by list fixing
Browse files Browse the repository at this point in the history
CURA-11002
  • Loading branch information
saumyaj3 committed Sep 25, 2023
1 parent c3b4900 commit 65d4b52
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions UM/Settings/Models/SettingDefinitionsModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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"""

Expand Down

0 comments on commit 65d4b52

Please sign in to comment.