Browse Source

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

Fixed

CURA-9424
Joey de l'Arago 2 years ago
parent
commit
dd0411f171

+ 4 - 1
cura/Machines/Models/MachineListModel.py

@@ -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",
         })

+ 4 - 4
plugins/3MFReader/WorkspaceDialog.py

@@ -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:

+ 2 - 2
plugins/3MFReader/WorkspaceDialog.qml

@@ -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
                         }
                     }