diff options
author | Jaime van Kessel <nallath@gmail.com> | 2021-12-06 11:43:53 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2021-12-06 11:43:53 +0300 |
commit | 8f92f049d166f17fa70f66f15bef4f556e81def0 (patch) | |
tree | a9786618bd699787618ad0ff512952ba45182a1f /cura/Machines/Models | |
parent | f0dc7a0eea918982f9a59f7d5d694716e88fc410 (diff) |
Emit signal when property changed
The signals weren't being emitted when the property was set.
CURA-8671
Diffstat (limited to 'cura/Machines/Models')
-rw-r--r-- | cura/Machines/Models/GlobalStacksModel.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cura/Machines/Models/GlobalStacksModel.py b/cura/Machines/Models/GlobalStacksModel.py index e0dd298b98..f27a1ec00b 100644 --- a/cura/Machines/Models/GlobalStacksModel.py +++ b/cura/Machines/Models/GlobalStacksModel.py @@ -52,8 +52,13 @@ class GlobalStacksModel(ListModel): self._updateDelayed() filterConnectionTypeChanged = pyqtSignal() + filterCapabilitiesChanged = pyqtSignal() + filterOnlineOnlyChanged = pyqtSignal() + def setFilterConnectionType(self, new_filter: Optional[ConnectionType]) -> None: - self._filter_connection_type = new_filter + if self._filter_connection_type != new_filter: + self._filter_connection_type = new_filter + self.filterConnectionTypeChanged.emit() @pyqtProperty(int, fset = setFilterConnectionType, notify = filterConnectionTypeChanged) def filterConnectionType(self) -> int: @@ -67,9 +72,10 @@ class GlobalStacksModel(ListModel): return -1 return self._filter_connection_type.value - filterOnlineOnlyChanged = pyqtSignal() def setFilterOnlineOnly(self, new_filter: bool) -> None: - self._filter_online_only = new_filter + if self._filter_online_only != new_filter: + self._filter_online_only = new_filter + self.filterOnlineOnlyChanged.emit() @pyqtProperty(bool, fset = setFilterOnlineOnly, notify = filterOnlineOnlyChanged) def filterOnlineOnly(self) -> bool: @@ -78,9 +84,10 @@ class GlobalStacksModel(ListModel): """ return self._filter_online_only - filterCapabilitiesChanged = pyqtSignal() def setFilterCapabilities(self, new_filter: List[str]) -> None: - self._filter_capabilities = new_filter + if self._filter_capabilities != new_filter: + self._filter_capabilities = new_filter + self.filterCapabilitiesChanged.emit() @pyqtProperty("QStringList", fset = setFilterCapabilities, notify = filterCapabilitiesChanged) def filterCapabilities(self) -> List[str]: |