Swap out UpdatableMachinesModel for MachineListModel.

This has to be instantiated with the WorkspaceDialog but attaching the listeners throws an error because it is done too early. The listeners are not needed anyway, so they have been disabled.

Update WorkspaceDialog.qml to use MachineListModel

CURA-9424
This commit is contained in:
Joey de l'Arago 2022-11-04 16:44:04 +01:00
parent 1ebf5bb650
commit 088ea0a768
2 changed files with 47 additions and 48 deletions

View file

@ -5,6 +5,7 @@ from PyQt6.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication, QU
from PyQt6.QtGui import QDesktopServices
from typing import List, Optional, Dict, cast
from cura.Machines.Models.MachineListModel import MachineListModel
from cura.Settings.GlobalStack import GlobalStack
from UM.Application import Application
from UM.FlameProfiler import pyqtSlot
@ -14,8 +15,6 @@ from UM.Message import Message
from UM.PluginRegistry import PluginRegistry
from UM.Settings.ContainerRegistry import ContainerRegistry
from .UpdatableMachinesModel import UpdatableMachinesModel
import os
import threading
import time
@ -63,7 +62,7 @@ class WorkspaceDialog(QObject):
self._extruders = []
self._objects_on_plate = False
self._is_printer_group = False
self._updatable_machines_model = UpdatableMachinesModel(self)
self._updatable_machines_model = MachineListModel(self, listenToChanges=False)
self._missing_package_metadata: List[Dict[str, str]] = []
self._plugin_registry: PluginRegistry = CuraApplication.getInstance().getPluginRegistry()
self._install_missing_package_dialog: Optional[QObject] = None
@ -161,8 +160,8 @@ class WorkspaceDialog(QObject):
self.machineNameChanged.emit()
@pyqtProperty(QObject, notify = updatableMachinesChanged)
def updatableMachinesModel(self) -> UpdatableMachinesModel:
return cast(UpdatableMachinesModel, self._updatable_machines_model)
def updatableMachinesModel(self) -> MachineListModel:
return cast(MachineListModel, self._updatable_machines_model)
def setUpdatableMachines(self, updatable_machines: List[GlobalStack]) -> None:
self._updatable_machines_model.update(updatable_machines)