Refactored the "connection_type" metadata entry so it can support multiple types.

After a lot of discussion and finding out what the hell was going on,
we figured out we made a pretty big derp by only setting a single connection_type
in the metadata of the machine. What it's actually doing is describing what connection types
have been configured (and not just randomly displaying whatever output device set the value last)
This commit is contained in:
Jaime van Kessel 2019-01-28 14:29:41 +01:00
parent 72b98285b1
commit 3774fdbd02
5 changed files with 75 additions and 37 deletions

View file

@ -528,8 +528,12 @@ class MachineManager(QObject):
@pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineHasRemoteConnection(self) -> bool:
if self._global_container_stack:
connection_type = int(self._global_container_stack.getMetaDataEntry("connection_type", ConnectionType.NotConnected.value))
return connection_type in [ConnectionType.NetworkConnection.value, ConnectionType.CloudConnection.value]
has_remote_connection = False
for connection_type in self._global_container_stack.configuredConnectionTypes:
has_remote_connection |= connection_type in [ConnectionType.NetworkConnection.value,
ConnectionType.CloudConnection.value]
return has_remote_connection
return False
@pyqtProperty(bool, notify = printerConnectedStatusChanged)