Override connect() rather than connecting to connection state signal

This is much more lean and a bit more semantic.

Contributes to issue CURA-5034.
This commit is contained in:
Ghostkeeper 2018-06-12 15:40:10 +02:00
parent a4171dd561
commit da5e4c11a4
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -62,8 +62,6 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
# See comments about this hack with the clusterPrintersChanged signal # See comments about this hack with the clusterPrintersChanged signal
self.printersChanged.connect(self.clusterPrintersChanged) self.printersChanged.connect(self.clusterPrintersChanged)
self.connectionStateChanged.connect(self._onConnectionStateChanged)
self._accepts_commands = True self._accepts_commands = True
# Cluster does not have authentication, so default to authenticated # Cluster does not have authentication, so default to authenticated
@ -371,8 +369,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
self._finished_jobs = finished_jobs self._finished_jobs = finished_jobs
## Called when the connection to the cluster changes. ## Called when the connection to the cluster changes.
def _onConnectionStateChanged(self) -> None: def connect(self) -> None:
if self.connectionState == ConnectionState.connected: super().connect()
self.sendMaterialProfiles() self.sendMaterialProfiles()
def _update(self) -> None: def _update(self) -> None: