Refactor missing packages dialog into model (MissingPackageList) and controller (InstallMissingPackagesDialog.qml)

Rename classes and files to have unified naming.

CURA-6990
This commit is contained in:
j.delarago 2022-06-01 16:50:53 +02:00
parent 5a3836b841
commit 0df21e6073
6 changed files with 273 additions and 1 deletions

View file

@ -0,0 +1,32 @@
# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Optional, TYPE_CHECKING, Dict, List
from .Constants import PACKAGES_URL
from .PackageModel import PackageModel
from .RemotePackageList import RemotePackageList
from PyQt6.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication
from UM.TaskManagement.HttpRequestManager import HttpRequestManager # To request the package list from the API.
from UM.i18n import i18nCatalog
if TYPE_CHECKING:
from PyQt6.QtCore import QObject, pyqtProperty, pyqtSignal
catalog = i18nCatalog("cura")
class MissingPackageList(RemotePackageList):
def __init__(self, parent: Optional["QObject"] = None) -> None:
super().__init__(parent)
self._package_metadata: List[Dict[str, str]] = []
# self.packageTypeFilter = None # This will be our new filter
self._package_type_filter = "material"
def setPackageIds(self, packages: List[Dict[str, str]]) -> None:
self._package_metadata = packages
search_string = ", ".join(map(lambda package: package["id"], packages))
# self.setSearchString(search_string)
self.setSearchString("ABS")