Merge branch 'main' into CURA-9365_fix_building_cura_main

This commit is contained in:
Jelle Spijker 2022-06-12 19:10:52 +02:00
commit 823e8f6347
8 changed files with 43 additions and 21 deletions

View File

@ -114,7 +114,7 @@ class ContainerManager(QObject):
for _ in range(len(entries)):
item = item.get(entries.pop(0), {})
if item[entry_name] != entry_value:
if entry_name not in item or item[entry_name] != entry_value:
sub_item_changed = True
item[entry_name] = entry_value

View File

@ -1255,8 +1255,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
try:
package_metadata = json.loads(archive.open("Metadata/packages.json").read().decode("utf-8"))
return package_metadata["packages"]
except KeyError:
Logger.warning("No package metadata was found in .3mf file.")
except Exception:
Logger.error("Failed to load packes metadata from .3mf file")
return []

View File

@ -1,19 +1,20 @@
# Copyright (c) 2020 Ultimaker B.V.
# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import List, Optional, Dict, cast
from PyQt6.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication, QUrl
from PyQt6.QtGui import QDesktopServices
from typing import List, Optional, Dict, cast
from UM.FlameProfiler import pyqtSlot
from UM.PluginRegistry import PluginRegistry
from UM.Application import Application
from UM.i18n import i18nCatalog
from UM.Settings.ContainerRegistry import ContainerRegistry
from cura.Settings.GlobalStack import GlobalStack
from plugins.Marketplace.InstallMissingPackagesDialog import InstallMissingPackageDialog
from .UpdatableMachinesModel import UpdatableMachinesModel
from UM.Application import Application
from UM.FlameProfiler import pyqtSlot
from UM.i18n import i18nCatalog
from UM.Logger import Logger
from UM.Message import Message
from UM.PluginRegistry import PluginRegistry
from UM.Settings.ContainerRegistry import ContainerRegistry
from .UpdatableMachinesModel import UpdatableMachinesModel
import os
import threading
@ -292,8 +293,10 @@ class WorkspaceDialog(QObject):
@pyqtSlot()
def installMissingPackages(self) -> None:
self._install_missing_package_dialog = InstallMissingPackageDialog(self._missing_package_metadata, self.showMissingMaterialsWarning)
self._install_missing_package_dialog.show()
marketplace_plugin = PluginRegistry.getInstance().getPluginObject("Marketplace")
if not marketplace_plugin:
Logger.warning("Could not show dialog to install missing plug-ins. Is Marketplace plug-in not available?")
marketplace_plugin.showInstallMissingPackageDialog(self._missing_package_metadata, self.showMissingMaterialsWarning) # type: ignore
def getResult(self) -> Dict[str, Optional[str]]:
if "machine" in self._result and self.updatableMachinesModel.count <= 1:

View File

@ -369,6 +369,9 @@ class StartSliceJob(Job):
result["material_name"] = stack.material.getMetaDataEntry("name", "")
result["material_brand"] = stack.material.getMetaDataEntry("brand", "")
result["quality_name"] = stack.quality.getMetaDataEntry("name", "")
result["quality_changes_name"] = stack.qualityChanges.getMetaDataEntry("name")
# Renamed settings.
result["print_bed_temperature"] = result["material_bed_temperature"]
result["print_temperature"] = result["material_print_temperature"]

View File

@ -1,16 +1,17 @@
# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os
from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty, QUrl
from PyQt6.QtGui import QDesktopServices
from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty
from typing import Optional, List, Dict, cast, Callable
from cura.CuraApplication import CuraApplication
from UM.PluginRegistry import PluginRegistry
from cura.CuraPackageManager import CuraPackageManager
from UM.Message import Message
from UM.i18n import i18nCatalog
from UM.FlameProfiler import pyqtSlot
from plugins.Marketplace.MissingPackageList import MissingPackageList
from .MissingPackageList import MissingPackageList
i18n_catalog = i18nCatalog("cura")

View File

@ -3,15 +3,15 @@
import os.path
from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from typing import Optional, cast
from typing import Callable, cast, Dict, List, Optional
from cura.CuraApplication import CuraApplication # Creating QML objects and managing packages.
from UM.Extension import Extension # We are implementing the main object of an extension here.
from UM.PluginRegistry import PluginRegistry # To find out where we are stored (the proper way).
from .RemotePackageList import RemotePackageList # To register this type with QML.
from .InstallMissingPackagesDialog import InstallMissingPackageDialog # To allow creating this dialogue from outside of the plug-in.
from .LocalPackageList import LocalPackageList # To register this type with QML.
from .RemotePackageList import RemotePackageList # To register this type with QML.
class Marketplace(Extension, QObject):
@ -41,6 +41,7 @@ class Marketplace(Extension, QObject):
self._tab_shown: int = 0
self._restart_needed = False
self.missingPackageDialog = None
def getTabShown(self) -> int:
return self._tab_shown
@ -118,3 +119,15 @@ class Marketplace(Extension, QObject):
@pyqtProperty(bool, notify=showRestartNotificationChanged)
def showRestartNotification(self) -> bool:
return self._restart_needed
def showInstallMissingPackageDialog(self, packages_metadata: List[Dict[str, str]], ignore_warning_callback: Callable[[], None]) -> None:
"""
Show a dialog that prompts the user to install certain packages.
The dialog is worded for packages that are missing and required for a certain operation.
:param packages_metadata: The metadata of the packages that are missing.
:param ignore_warning_callback: A callback that gets executed when the user ignores the pop-up, to show them a
warning.
"""
self.missingPackageDialog = InstallMissingPackageDialog(packages_metadata, ignore_warning_callback)
self.missingPackageDialog.show()

View File

@ -14,4 +14,4 @@ def register(app):
"""
Register the plug-in object with Uranium.
"""
return { "extension": [Marketplace(), SyncOrchestrator(app)] }
return { "extension": [SyncOrchestrator(app), Marketplace()] }

View File

@ -7654,7 +7654,6 @@
"default_value": 100,
"type": "float",
"minimum_value": "5",
"maximum_value": "100",
"minimum_value_warning": "20",
"maximum_value_warning": "100",
"enabled": "bridge_settings_enabled",