mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-10 05:59:02 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
f9433dba87
@ -34,7 +34,7 @@ class MaterialBrandsModel(BaseMaterialsModel):
|
|||||||
brand_item_list = []
|
brand_item_list = []
|
||||||
brand_group_dict = {}
|
brand_group_dict = {}
|
||||||
|
|
||||||
# Part 1: Generate the entire tree of brands -> material types -> spcific materials
|
# Part 1: Generate the entire tree of brands -> material types -> specific materials
|
||||||
for root_material_id, container_node in self._available_materials.items():
|
for root_material_id, container_node in self._available_materials.items():
|
||||||
# Do not include the materials from a to-be-removed package
|
# Do not include the materials from a to-be-removed package
|
||||||
if bool(container_node.getMetaDataEntry("removed", False)):
|
if bool(container_node.getMetaDataEntry("removed", False)):
|
||||||
|
@ -51,7 +51,7 @@ class VariantNode(ContainerNode):
|
|||||||
# Find all the materials for this variant's name.
|
# Find all the materials for this variant's name.
|
||||||
else: # Printer has its own material profiles. Look for material profiles with this printer's definition.
|
else: # Printer has its own material profiles. Look for material profiles with this printer's definition.
|
||||||
base_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = "fdmprinter")
|
base_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = "fdmprinter")
|
||||||
printer_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id, variant_name = None)
|
printer_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id)
|
||||||
variant_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id, variant_name = self.variant_name) # If empty_variant, this won't return anything.
|
variant_specific_materials = container_registry.findInstanceContainersMetadata(type = "material", definition = self.machine.container_id, variant_name = self.variant_name) # If empty_variant, this won't return anything.
|
||||||
materials_per_base_file = {material["base_file"]: material for material in base_materials}
|
materials_per_base_file = {material["base_file"]: material for material in base_materials}
|
||||||
materials_per_base_file.update({material["base_file"]: material for material in printer_specific_materials}) # Printer-specific profiles override global ones.
|
materials_per_base_file.update({material["base_file"]: material for material in printer_specific_materials}) # Printer-specific profiles override global ones.
|
||||||
|
@ -74,7 +74,7 @@ UM.Dialog{
|
|||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.display_name
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
anchors.left: packageIcon.right
|
anchors.left: packageIcon.right
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
@ -104,7 +104,7 @@ UM.Dialog{
|
|||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
property int lineHeight: 60
|
property int lineHeight: 60
|
||||||
visible: !model.is_compatible
|
visible: !model.is_compatible && !model.is_dismissed
|
||||||
height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the incompatible packages here
|
height: visible ? (lineHeight + UM.Theme.getSize("default_margin").height) : 0 // We only show the incompatible packages here
|
||||||
Image
|
Image
|
||||||
{
|
{
|
||||||
@ -117,7 +117,7 @@ UM.Dialog{
|
|||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.display_name
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
anchors.left: packageIcon.right
|
anchors.left: packageIcon.right
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
@ -125,6 +125,26 @@ UM.Dialog{
|
|||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
UM.TooltipArea
|
||||||
|
{
|
||||||
|
width: childrenRect.width;
|
||||||
|
height: childrenRect.height;
|
||||||
|
text: catalog.i18nc("@info:tooltip", "Dismisses the package and won't be shown in this dialog anymore")
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: packageIcon.verticalCenter
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: "(Dismiss)"
|
||||||
|
font: UM.Theme.getFont("small")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: toolbox.dismissIncompatiblePackage(model.package_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
from cura import ApplicationMetadata
|
from cura import ApplicationMetadata
|
||||||
|
from UM.Logger import Logger
|
||||||
|
from typing import List, Dict, Any
|
||||||
|
|
||||||
|
|
||||||
class SubscribedPackagesModel(ListModel):
|
class SubscribedPackagesModel(ListModel):
|
||||||
@ -15,25 +17,27 @@ class SubscribedPackagesModel(ListModel):
|
|||||||
self._discrepancies = None
|
self._discrepancies = None
|
||||||
self._sdk_version = ApplicationMetadata.CuraSDKVersion
|
self._sdk_version = ApplicationMetadata.CuraSDKVersion
|
||||||
|
|
||||||
self.addRoleName(Qt.UserRole + 1, "name")
|
self.addRoleName(Qt.UserRole + 1, "package_id")
|
||||||
self.addRoleName(Qt.UserRole + 2, "icon_url")
|
self.addRoleName(Qt.UserRole + 2, "display_name")
|
||||||
self.addRoleName(Qt.UserRole + 3, "is_compatible")
|
self.addRoleName(Qt.UserRole + 3, "icon_url")
|
||||||
|
self.addRoleName(Qt.UserRole + 4, "is_compatible")
|
||||||
|
self.addRoleName(Qt.UserRole + 5, "is_dismissed")
|
||||||
|
|
||||||
def setMetadata(self, data):
|
def setMetadata(self, data: List[Dict[str, List[Any]]]) -> None:
|
||||||
if self._metadata != data:
|
self._metadata = data
|
||||||
self._metadata = data
|
|
||||||
|
|
||||||
def addValue(self, discrepancy):
|
def addDiscrepancies(self, discrepancy: List[str]) -> None:
|
||||||
if self._discrepancies != discrepancy:
|
self._discrepancies = discrepancy
|
||||||
self._discrepancies = discrepancy
|
|
||||||
|
|
||||||
def update(self):
|
def initialize(self) -> None:
|
||||||
self._items.clear()
|
self._items.clear()
|
||||||
|
|
||||||
for item in self._metadata:
|
for item in self._metadata:
|
||||||
if item["package_id"] not in self._discrepancies:
|
if item["package_id"] not in self._discrepancies:
|
||||||
continue
|
continue
|
||||||
package = {"name": item["display_name"], "sdk_versions": item["sdk_versions"]}
|
package = {"package_id": item["package_id"],
|
||||||
|
"display_name": item["display_name"],
|
||||||
|
"sdk_versions": item["sdk_versions"],
|
||||||
|
"is_dismissed": False}
|
||||||
if self._sdk_version not in item["sdk_versions"]:
|
if self._sdk_version not in item["sdk_versions"]:
|
||||||
package.update({"is_compatible": False})
|
package.update({"is_compatible": False})
|
||||||
else:
|
else:
|
||||||
@ -42,7 +46,6 @@ class SubscribedPackagesModel(ListModel):
|
|||||||
package.update({"icon_url": item["icon_url"]})
|
package.update({"icon_url": item["icon_url"]})
|
||||||
except KeyError: # There is no 'icon_url" in the response payload for this package
|
except KeyError: # There is no 'icon_url" in the response payload for this package
|
||||||
package.update({"icon_url": ""})
|
package.update({"icon_url": ""})
|
||||||
|
|
||||||
self._items.append(package)
|
self._items.append(package)
|
||||||
self.setItems(self._items)
|
self.setItems(self._items)
|
||||||
|
|
||||||
@ -59,3 +62,10 @@ class SubscribedPackagesModel(ListModel):
|
|||||||
if item['is_compatible'] == False:
|
if item['is_compatible'] == False:
|
||||||
has_incompatible_items = True
|
has_incompatible_items = True
|
||||||
return has_incompatible_items
|
return has_incompatible_items
|
||||||
|
|
||||||
|
# Sets the "is_compatible" to True for the given package, in memory
|
||||||
|
def dismissPackage(self, package_id: str) -> None:
|
||||||
|
package = self.find(key="package_id", value=package_id)
|
||||||
|
if package != -1:
|
||||||
|
self.setProperty(package, property="is_dismissed", value=True)
|
||||||
|
Logger.debug("Package {} has been dismissed".format(package_id))
|
||||||
|
@ -556,6 +556,11 @@ class Toolbox(QObject, Extension):
|
|||||||
populated += 1
|
populated += 1
|
||||||
return populated == len(self._server_response_data.items())
|
return populated == len(self._server_response_data.items())
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def dismissIncompatiblePackage(self, package_id: str):
|
||||||
|
self._models["subscribed_packages"].dismissPackage(package_id) # sets "is_compatible" to True, in-memory
|
||||||
|
self._package_manager.dismissPackage(package_id) # adds this package_id as dismissed in the user config file
|
||||||
|
|
||||||
# Make API Calls
|
# Make API Calls
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
def _makeRequestByType(self, request_type: str) -> None:
|
def _makeRequestByType(self, request_type: str) -> None:
|
||||||
@ -663,13 +668,15 @@ class Toolbox(QObject, Extension):
|
|||||||
def _checkCompatibilities(self, json_data) -> None:
|
def _checkCompatibilities(self, json_data) -> None:
|
||||||
user_subscribed_packages = [plugin["package_id"] for plugin in json_data]
|
user_subscribed_packages = [plugin["package_id"] for plugin in json_data]
|
||||||
user_installed_packages = self._package_manager.getUserInstalledPackages()
|
user_installed_packages = self._package_manager.getUserInstalledPackages()
|
||||||
|
user_dismissed_packages = self._package_manager.getDismissedPackages()
|
||||||
# We check if there are packages installed in Cloud Marketplace but not in Cura marketplace (discrepancy)
|
if user_dismissed_packages:
|
||||||
|
user_installed_packages += user_dismissed_packages
|
||||||
|
# We check if there are packages installed in Cloud Marketplace but not in Cura marketplace
|
||||||
package_discrepancy = list(set(user_subscribed_packages).difference(user_installed_packages))
|
package_discrepancy = list(set(user_subscribed_packages).difference(user_installed_packages))
|
||||||
if package_discrepancy:
|
if package_discrepancy:
|
||||||
self._models["subscribed_packages"].addValue(package_discrepancy)
|
self._models["subscribed_packages"].addDiscrepancies(package_discrepancy)
|
||||||
self._models["subscribed_packages"].update()
|
self._models["subscribed_packages"].initialize()
|
||||||
Logger.log("d", "Discrepancy found between Cloud subscribed packages and Cura installed packages")
|
Logger.debug("Discrepancy found between Cloud subscribed packages and Cura installed packages")
|
||||||
sync_message = Message(i18n_catalog.i18nc(
|
sync_message = Message(i18n_catalog.i18nc(
|
||||||
"@info:generic",
|
"@info:generic",
|
||||||
"\nDo you want to sync material and software packages with your account?"),
|
"\nDo you want to sync material and software packages with your account?"),
|
||||||
@ -680,7 +687,6 @@ class Toolbox(QObject, Extension):
|
|||||||
icon="",
|
icon="",
|
||||||
description="Sync your Cloud subscribed packages to your local environment.",
|
description="Sync your Cloud subscribed packages to your local environment.",
|
||||||
button_align=Message.ActionButtonAlignment.ALIGN_RIGHT)
|
button_align=Message.ActionButtonAlignment.ALIGN_RIGHT)
|
||||||
|
|
||||||
sync_message.actionTriggered.connect(self._onSyncButtonClicked)
|
sync_message.actionTriggered.connect(self._onSyncButtonClicked)
|
||||||
sync_message.show()
|
sync_message.show()
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2019 Ultimaker B.V.
|
// Copyright (c) 2020 Ultimaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
@ -21,7 +21,16 @@ UM.MainWindow
|
|||||||
id: base
|
id: base
|
||||||
|
|
||||||
// Cura application window title
|
// Cura application window title
|
||||||
title: PrintInformation.jobName + " - " + catalog.i18nc("@title:window", CuraApplication.applicationDisplayName)
|
title:
|
||||||
|
{
|
||||||
|
let result = "";
|
||||||
|
if(PrintInformation.jobName != "")
|
||||||
|
{
|
||||||
|
result += PrintInformation.jobName + " - ";
|
||||||
|
}
|
||||||
|
result += CuraApplication.applicationDisplayName;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
backgroundColor: UM.Theme.getColor("viewport_background")
|
backgroundColor: UM.Theme.getColor("viewport_background")
|
||||||
|
|
||||||
@ -244,23 +253,6 @@ UM.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolbar
|
|
||||||
{
|
|
||||||
// The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by
|
|
||||||
// plugins)
|
|
||||||
id: toolbar
|
|
||||||
|
|
||||||
property int mouseX: base.mouseX
|
|
||||||
property int mouseY: base.mouseY
|
|
||||||
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
}
|
|
||||||
visible: CuraApplication.platformActivity && !PrintInformation.preSliced
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectSelector
|
ObjectSelector
|
||||||
{
|
{
|
||||||
id: objectSelector
|
id: objectSelector
|
||||||
@ -302,6 +294,23 @@ UM.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toolbar
|
||||||
|
{
|
||||||
|
// The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by
|
||||||
|
// plugins)
|
||||||
|
id: toolbar
|
||||||
|
|
||||||
|
property int mouseX: base.mouseX
|
||||||
|
property int mouseY: base.mouseY
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
}
|
||||||
|
visible: CuraApplication.platformActivity && !PrintInformation.preSliced
|
||||||
|
}
|
||||||
|
|
||||||
// A hint for the loaded content view. Overlay items / controls can safely be placed in this area
|
// A hint for the loaded content view. Overlay items / controls can safely be placed in this area
|
||||||
Item {
|
Item {
|
||||||
id: mainSafeArea
|
id: mainSafeArea
|
||||||
|
5
test-in-docker.sh
Executable file
5
test-in-docker.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
sudo rm -rf ./build ./Uranium
|
||||||
|
sudo docker run -it --rm \
|
||||||
|
-v "$(pwd):/srv/cura" ultimaker/cura-build-environment \
|
||||||
|
/srv/cura/docker/build.sh
|
||||||
|
sudo rm -rf ./build ./Uranium
|
Loading…
x
Reference in New Issue
Block a user