Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supress_signals property to setName of instance container #969

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions UM/Settings/InstanceContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,18 @@ def getName(self) -> str:

return self._metadata["name"]

def setName(self, name: str) -> None:
def setName(self, name: str, *, supress_signals = False) -> None:
# In some cases you want to change the name of multiple containers and not yet want to trigger events.
# In thsoe cases you need to use supress_signals to make sure that no signals are sent. Be *very* carefull
# with using this!
if name != self.getName():
CachedMemberFunctions.clearInstanceCache(self)
self._metadata["name"] = name
self._dirty = True
self.nameChanged.emit()
self.pyqtNameChanged.emit()
self.metaDataChanged.emit(self)
if not supress_signals:
self.nameChanged.emit()
self.pyqtNameChanged.emit()
self.metaDataChanged.emit(self)


# Because we want to expose the properties of InstanceContainer as Qt properties for
Expand Down
Loading