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

View file

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

View file

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