isOnline was incorrectly being used instead of isNetworked. This caused offline printers not to show an Icon.

Fixed

CURA-9424
This commit is contained in:
Joey de l'Arago 2022-11-15 14:56:25 +01:00
parent 7254c8ac78
commit dd0411f171
3 changed files with 10 additions and 7 deletions

View file

@ -5,7 +5,7 @@
# online cloud connected printers are represented within this ListModel. Additional information such as the number of
# connected printers for each printer type is gathered.
from typing import Optional, List
from typing import Optional, List, cast
from PyQt6.QtCore import Qt, QTimer, QObject, pyqtSlot, pyqtProperty, pyqtSignal
@ -28,6 +28,7 @@ class MachineListModel(ListModel):
MachineCountRole = Qt.ItemDataRole.UserRole + 6
IsAbstractMachineRole = Qt.ItemDataRole.UserRole + 7
ComponentTypeRole = Qt.ItemDataRole.UserRole + 8
IsNetworkedMachineRole = Qt.ItemDataRole.UserRole + 9
def __init__(self, parent: Optional[QObject] = None, machines_filter: List[GlobalStack] = None, listenToChanges: bool = True) -> None:
super().__init__(parent)
@ -45,6 +46,7 @@ class MachineListModel(ListModel):
self.addRoleName(self.MachineCountRole, "machineCount")
self.addRoleName(self.IsAbstractMachineRole, "isAbstractMachine")
self.addRoleName(self.ComponentTypeRole, "componentType")
self.addRoleName(self.IsNetworkedMachineRole, "isNetworked")
self._change_timer = QTimer()
self._change_timer.setInterval(200)
@ -151,6 +153,7 @@ class MachineListModel(ListModel):
"metadata": container_stack.getMetaData().copy(),
"isOnline": is_online,
"isAbstractMachine": parseBool(container_stack.getMetaDataEntry("is_abstract_machine", False)),
"isNetworked": cast(GlobalStack, container_stack).hasNetworkedConnection() if isinstance(container_stack, GlobalStack) else False,
"machineCount": machine_count,
"catergory": "connected" if is_online else "other",
})

View file

@ -82,7 +82,7 @@ class WorkspaceDialog(QObject):
machineNameChanged = pyqtSignal()
updatableMachinesChanged = pyqtSignal()
isAbstractMachineChanged = pyqtSignal()
isOnlineChanged = pyqtSignal()
isNetworkedChanged = pyqtSignal()
materialLabelsChanged = pyqtSignal()
objectsOnPlateChanged = pyqtSignal()
numUserSettingsChanged = pyqtSignal()
@ -180,14 +180,14 @@ class WorkspaceDialog(QObject):
self._is_abstract_machine = is_abstract_machine
self.isAbstractMachineChanged.emit()
@pyqtProperty(bool, notify = isOnlineChanged)
def isOnline(self) -> bool:
@pyqtProperty(bool, notify = isNetworkedChanged)
def isNetworked(self) -> bool:
return self._is_online_machine
@pyqtSlot(bool)
def setIsNetworkedMachine(self, is_online_machine: bool) -> None:
self._is_online_machine = is_online_machine
self.isOnlineChanged.emit()
self.isNetworkedChanged.emit()
@pyqtProperty(str, notify=qualityTypeChanged)
def qualityType(self) -> str:

View file

@ -114,7 +114,7 @@ UM.Dialog
isConnectedCloudPrinter: false
isCloudRegistered: false
isNetworkPrinter: manager.isOnline
isNetworkPrinter: manager.isNetworked
isGroup: manager.isAbstractMachine
minDropDownWidth: machineSelector.width
@ -144,7 +144,7 @@ UM.Dialog
manager.setResolveStrategy("machine", "override")
manager.setMachineToOverride(machine.id)
manager.setIsAbstractMachine(machine.isAbstractMachine)
manager.setIsNetworkedMachine(machine.isOnline)
manager.setIsNetworkedMachine(machine.isNetworked)
machineSelector.machineName = machine.name
}
}