Merge branch '4.0'

This commit is contained in:
Ghostkeeper 2019-02-21 09:09:19 +01:00
commit 650204dae7
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
19 changed files with 95 additions and 66 deletions

View file

@ -10,6 +10,7 @@ from time import time
from typing import Any, cast, Dict, List, Optional, Set, TYPE_CHECKING
from UM.Backend.Backend import Backend, BackendState
from UM.Scene.Camera import Camera
from UM.Scene.SceneNode import SceneNode
from UM.Signal import Signal
from UM.Logger import Logger
@ -476,7 +477,7 @@ class CuraEngineBackend(QObject, Backend):
#
# \param source The scene node that was changed.
def _onSceneChanged(self, source: SceneNode) -> None:
if not isinstance(source, SceneNode):
if not source.callDecoration("isSliceable"):
return
# This case checks if the source node is a node that contains GCode. In this case the

View file

@ -9,6 +9,7 @@ from UM.Application import Application
from UM.Extension import Extension
from UM.Logger import Logger
from UM.Message import Message
from UM.Scene.Camera import Camera
from UM.i18n import i18nCatalog
from UM.PluginRegistry import PluginRegistry
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
@ -35,7 +36,12 @@ class ModelChecker(QObject, Extension):
## Pass-through to allow UM.Signal to connect with a pyqtSignal.
def _onChanged(self, *args, **kwargs):
self.onChanged.emit()
# Ignore camera updates.
if len(args) == 0:
self.onChanged.emit()
return
if not isinstance(args[0], Camera):
self.onChanged.emit()
## Called when plug-ins are initialized.
#

View file

@ -11,7 +11,7 @@ Rectangle
{
id: viewportOverlay
property bool isConnected: Cura.MachineManager.activeMachineHasActiveNetworkConnection || Cura.MachineManager.activeMachineHasActiveCloudConnection
property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection
property bool isNetworkConfigurable: ["Ultimaker 3", "Ultimaker 3 Extended", "Ultimaker S5"].indexOf(Cura.MachineManager.activeMachineDefinitionName) > -1
property bool isNetworkConfigured:
{

View file

@ -7,34 +7,39 @@ import QtQuick.Controls.Styles 1.3
import UM 1.3 as UM
import Cura 1.0 as Cura
Rectangle {
Rectangle
{
id: base
property var enabled: true
property var iconSource: null;
color: UM.Theme.getColor("monitor_icon_primary")
height: width;
radius: Math.round(0.5 * width);
width: 24 * screenScaleFactor;
property var iconSource: null
color: enabled ? UM.Theme.getColor("monitor_icon_primary") : UM.Theme.getColor("monitor_icon_disabled")
height: width
radius: Math.round(0.5 * width)
width: 24 * screenScaleFactor
UM.RecolorImage {
id: icon;
anchors {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
UM.RecolorImage
{
id: icon
anchors
{
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
color: UM.Theme.getColor("monitor_icon_accent");
height: width;
source: iconSource;
width: Math.round(parent.width / 2);
color: UM.Theme.getColor("monitor_icon_accent")
height: width
source: iconSource
width: Math.round(parent.width / 2)
}
MouseArea {
id: clickArea;
anchors.fill: parent;
MouseArea
{
id: clickArea
anchors.fill: parent
hoverEnabled: base.enabled
onClicked: {
onClicked:
{
if (base.enabled)
{
if (OutputDevice.activeCameraUrl != "")

View file

@ -11,14 +11,14 @@ Button
id: base
background: Rectangle
{
color: UM.Theme.getColor("viewport_background") // TODO: Theme!
color: enabled ? UM.Theme.getColor("viewport_background") : "transparent"
height: base.height
opacity: base.down || base.hovered ? 1 : 0
radius: Math.round(0.5 * width)
width: base.width
}
contentItem: Label {
color: UM.Theme.getColor("monitor_text_primary")
color: enabled ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled")
font.pixelSize: 32 * screenScaleFactor
horizontalAlignment: Text.AlignHCenter
text: base.text

View file

@ -14,6 +14,10 @@ import Cura 1.0 as Cura
*/
Item
{
// If the printer is a cloud printer or not. Other items base their enabled state off of this boolean. In the future
// they might not need to though.
property bool cloudConnection: Cura.MachineManager.activeMachineIsUsingCloudConnection
Label
{
id: queuedLabel
@ -37,6 +41,7 @@ Item
}
height: 18 * screenScaleFactor // TODO: Theme!
width: childrenRect.width
visible: !cloudConnection
UM.RecolorImage
{
@ -67,7 +72,8 @@ Item
MouseArea
{
anchors.fill: manageQueueLabel
hoverEnabled: true
enabled: !cloudConnection
hoverEnabled: !cloudConnection
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel()
onEntered:
{
@ -165,11 +171,11 @@ Item
// When printing over the cloud we don't recieve print jobs until there is one, so
// unless there's at least one print job we'll be stuck with skeleton loading
// indefinitely.
if (Cura.MachineManager.activeMachineHasActiveCloudConnection)
if (Cura.MachineManager.activeMachineIsUsingCloudConnection || OutputDevice.receivedPrintJobs)
{
return OutputDevice.queuedPrintJobs
}
return OutputDevice.receivedPrintJobs ? OutputDevice.queuedPrintJobs : [null,null]
return [null, null]
}
spacing: 6 // TODO: Theme!
}

View file

@ -455,8 +455,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._start_cloud_flow_message = Message(
text = i18n_catalog.i18nc("@info:status", "Send and monitor print jobs from anywhere using your Ultimaker account."),
lifetime = 0,
image_source = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "resources", "svg",
"cloud-flow-start.svg"),
image_source = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
"resources", "svg", "cloud-flow-start.svg")),
image_caption = i18n_catalog.i18nc("@info:status", "Connect to Ultimaker Cloud"),
option_text = i18n_catalog.i18nc("@action", "Don't ask me again for this printer."),
option_state = False
@ -477,12 +477,14 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self._cloud_flow_complete_message = Message(
text = i18n_catalog.i18nc("@info:status", "You can now send and monitor print jobs from anywhere using your Ultimaker account."),
lifetime = 30,
image_source = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "resources", "svg",
"cloud-flow-completed.svg"),
image_source = QUrl.fromLocalFile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
"resources", "svg", "cloud-flow-completed.svg")),
image_caption = i18n_catalog.i18nc("@info:status", "Connected!")
)
self._cloud_flow_complete_message.addAction("", i18n_catalog.i18nc("@action", "Review your connection"), "", "", 1) # TODO: Icon
self._cloud_flow_complete_message.actionTriggered.connect(self._onReviewCloudConnection)
# Don't show the review connection link if we're not on the local network
if self._application.getMachineManager().activeMachineHasNetworkConnection:
self._cloud_flow_complete_message.addAction("", i18n_catalog.i18nc("@action", "Review your connection"), "", "", 1) # TODO: Icon
self._cloud_flow_complete_message.actionTriggered.connect(self._onReviewCloudConnection)
self._cloud_flow_complete_message.show()
# Set the machine's cloud flow as complete so we don't ask the user again and again for cloud connected printers

View file

@ -72,7 +72,9 @@ class XmlMaterialProfile(InstanceContainer):
material_manager = CuraApplication.getInstance().getMaterialManager()
root_material_id = self.getMetaDataEntry("base_file") #if basefile is self.getId, this is a basefile.
material_group = material_manager.getMaterialGroup(root_material_id)
if not material_group: #If the profile is not registered in the registry but loose/temporary, it will not have a base file tree.
super().setMetaDataEntry(key, value)
return
# Update the root material container
root_material_container = material_group.root_material_node.getContainer()
if root_material_container is not None:
@ -142,23 +144,13 @@ class XmlMaterialProfile(InstanceContainer):
# setting_version is derived from the "version" tag in the schema, so don't serialize it into a file
if ignored_metadata_keys is None:
ignored_metadata_keys = set()
ignored_metadata_keys |= {"setting_version"}
ignored_metadata_keys |= {"setting_version", "definition", "status", "variant", "type", "base_file", "approximate_diameter", "id", "container_type", "name"}
# remove the keys that we want to ignore in the metadata
for key in ignored_metadata_keys:
if key in metadata:
del metadata[key]
properties = metadata.pop("properties", {})
# Metadata properties that should not be serialized.
metadata.pop("status", "")
metadata.pop("variant", "")
metadata.pop("type", "")
metadata.pop("base_file", "")
metadata.pop("approximate_diameter", "")
metadata.pop("id", "")
metadata.pop("container_type", "")
metadata.pop("name", "")
## Begin Name Block
builder.start("name") # type: ignore
@ -1166,6 +1158,8 @@ class XmlMaterialProfile(InstanceContainer):
with open(product_to_id_file, encoding = "utf-8") as f:
product_to_id_map = json.load(f)
product_to_id_map = {key: [value] for key, value in product_to_id_map.items()}
#This also loads "Ultimaker S5" -> "ultimaker_s5" even though that is not strictly necessary with the default to change spaces into underscores.
#However it is not always loaded with that default; this mapping is also used in serialize() without that default.
return product_to_id_map
## Parse the value of the "material compatible" property.

View file

@ -6,6 +6,7 @@
"Ultimaker 2+": "ultimaker2_plus",
"Ultimaker 3": "ultimaker3",
"Ultimaker 3 Extended": "ultimaker3_extended",
"Ultimaker S5": "ultimaker_s5",
"Ultimaker Original": "ultimaker_original",
"Ultimaker Original+": "ultimaker_original_plus",
"Ultimaker Original Dual Extrusion": "ultimaker_original_dual",