Merge branch '4.0'

This commit is contained in:
Ghostkeeper 2019-02-04 13:06:32 +01:00
commit e7d2400199
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
14 changed files with 42 additions and 37 deletions

View file

@ -2,7 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
# --------- # ---------
# Genearl constants used in Cura # General constants used in Cura
# --------- # ---------
DEFAULT_CURA_APP_NAME = "cura" DEFAULT_CURA_APP_NAME = "cura"
DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura" DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura"

View file

@ -52,8 +52,7 @@ class GlobalStacksModel(ListModel):
if container_stack.getMetaDataEntry("hidden", False) in ["True", True]: if container_stack.getMetaDataEntry("hidden", False) in ["True", True]:
continue continue
# TODO: Remove reference to connect group name. items.append({"name": container_stack.getMetaDataEntry("group_name", container_stack.getName()),
items.append({"name": container_stack.getMetaDataEntry("connect_group_name", container_stack.getName()),
"id": container_stack.getId(), "id": container_stack.getId(),
"hasRemoteConnection": has_remote_connection, "hasRemoteConnection": has_remote_connection,
"metadata": container_stack.getMetaData().copy()}) "metadata": container_stack.getMetaData().copy()})

View file

@ -52,14 +52,14 @@ class MachineManagementModel(ListModel):
"um_network_key": "*", "um_network_key": "*",
"hidden": "False"} "hidden": "False"}
self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers) self._network_container_stacks = ContainerRegistry.getInstance().findContainerStacks(**network_filter_printers)
self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("connect_group_name")) self._network_container_stacks.sort(key = lambda i: i.getMetaDataEntry("group_name", ""))
for container in self._network_container_stacks: for container in self._network_container_stacks:
metadata = container.getMetaData().copy() metadata = container.getMetaData().copy()
if container.getBottom(): if container.getBottom():
metadata["definition_name"] = container.getBottom().getName() metadata["definition_name"] = container.getBottom().getName()
items.append({"name": metadata["connect_group_name"], items.append({"name": metadata.get("group_name", ""),
"id": container.getId(), "id": container.getId(),
"metadata": metadata, "metadata": metadata,
"group": catalog.i18nc("@info:title", "Network enabled printers")}) "group": catalog.i18nc("@info:title", "Network enabled printers")})

View file

@ -501,7 +501,7 @@ class MachineManager(QObject):
@pyqtProperty(str, notify = globalContainerChanged) @pyqtProperty(str, notify = globalContainerChanged)
def activeMachineName(self) -> str: def activeMachineName(self) -> str:
if self._global_container_stack: if self._global_container_stack:
return self._global_container_stack.getName() return self._global_container_stack.getMetaDataEntry("group_name", self._global_container_stack.getName())
return "" return ""
@pyqtProperty(str, notify = globalContainerChanged) @pyqtProperty(str, notify = globalContainerChanged)
@ -553,7 +553,7 @@ class MachineManager(QObject):
@pyqtProperty(str, notify = printerConnectedStatusChanged) @pyqtProperty(str, notify = printerConnectedStatusChanged)
def activeMachineNetworkGroupName(self) -> str: def activeMachineNetworkGroupName(self) -> str:
if self._global_container_stack: if self._global_container_stack:
return self._global_container_stack.getMetaDataEntry("connect_group_name", "") return self._global_container_stack.getMetaDataEntry("group_name", "")
return "" return ""
@pyqtProperty(QObject, notify = globalContainerChanged) @pyqtProperty(QObject, notify = globalContainerChanged)
@ -1345,7 +1345,7 @@ class MachineManager(QObject):
if not new_machine: if not new_machine:
return return
new_machine.setMetaDataEntry("um_network_key", self.activeMachineNetworkKey()) new_machine.setMetaDataEntry("um_network_key", self.activeMachineNetworkKey())
new_machine.setMetaDataEntry("connect_group_name", self.activeMachineNetworkGroupName) new_machine.setMetaDataEntry("group_name", self.activeMachineNetworkGroupName)
new_machine.setMetaDataEntry("hidden", False) new_machine.setMetaDataEntry("hidden", False)
new_machine.setMetaDataEntry("connection_type", self._global_container_stack.getMetaDataEntry("connection_type")) new_machine.setMetaDataEntry("connection_type", self._global_container_stack.getMetaDataEntry("connection_type"))
else: else:
@ -1393,7 +1393,8 @@ class MachineManager(QObject):
self._global_container_stack.extruders[position].setEnabled(False) self._global_container_stack.extruders[position].setEnabled(False)
need_to_show_message = True need_to_show_message = True
disabled_used_extruder_position_set.add(int(position)) # In message, we need to show Extruder 1, 2, 3 instead of 0, 1, 2
disabled_used_extruder_position_set.add(int(position) + 1)
else: else:
variant_container_node = self._variant_manager.getVariantNode(self._global_container_stack.definition.getId(), variant_container_node = self._variant_manager.getVariantNode(self._global_container_stack.definition.getId(),
@ -1449,12 +1450,12 @@ class MachineManager(QObject):
# then all the container stacks are updated, both the current and the hidden ones. # then all the container stacks are updated, both the current and the hidden ones.
def checkCorrectGroupName(self, device_id: str, group_name: str) -> None: def checkCorrectGroupName(self, device_id: str, group_name: str) -> None:
if self._global_container_stack and device_id == self.activeMachineNetworkKey(): if self._global_container_stack and device_id == self.activeMachineNetworkKey():
# Check if the connect_group_name is correct. If not, update all the containers connected to the same printer # Check if the group_name is correct. If not, update all the containers connected to the same printer
if self.activeMachineNetworkGroupName != group_name: if self.activeMachineNetworkGroupName != group_name:
metadata_filter = {"um_network_key": self.activeMachineNetworkKey()} metadata_filter = {"um_network_key": self.activeMachineNetworkKey()}
containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter) containers = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
for container in containers: for container in containers:
container.setMetaDataEntry("connect_group_name", group_name) container.setMetaDataEntry("group_name", group_name)
## This method checks if there is an instance connected to the given network_key ## This method checks if there is an instance connected to the given network_key
def existNetworkInstances(self, network_key: str) -> bool: def existNetworkInstances(self, network_key: str) -> bool:

View file

@ -500,7 +500,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
is_printer_group = False is_printer_group = False
if machine_conflict: if machine_conflict:
group_name = existing_global_stack.getMetaDataEntry("connect_group_name") group_name = existing_global_stack.getMetaDataEntry("group_name")
if group_name is not None: if group_name is not None:
is_printer_group = True is_printer_group = True
machine_name = group_name machine_name = group_name

View file

@ -355,8 +355,8 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
def sendJobToTop(self, print_job_uuid: str) -> None: def sendJobToTop(self, print_job_uuid: str) -> None:
# This function is part of the output device (and not of the printjob output model) as this type of operation # This function is part of the output device (and not of the printjob output model) as this type of operation
# is a modification of the cluster queue and not of the actual job. # is a modification of the cluster queue and not of the actual job.
data = "{\"to_position\": 0}" data = "{\"list\": \"queued\",\"to_position\": 0}"
self.put("print_jobs/{uuid}/move_to_position".format(uuid = print_job_uuid), data, on_finished=None) self.post("print_jobs/{uuid}/action/move".format(uuid = print_job_uuid), data, on_finished=None)
@pyqtSlot(str) @pyqtSlot(str)
def deleteJobFromQueue(self, print_job_uuid: str) -> None: def deleteJobFromQueue(self, print_job_uuid: str) -> None:

View file

@ -106,13 +106,13 @@ class DiscoverUM3Action(MachineAction):
global_container_stack = CuraApplication.getInstance().getGlobalContainerStack() global_container_stack = CuraApplication.getInstance().getGlobalContainerStack()
if global_container_stack: if global_container_stack:
meta_data = global_container_stack.getMetaData() meta_data = global_container_stack.getMetaData()
if "connect_group_name" in meta_data: if "group_name" in meta_data:
previous_connect_group_name = meta_data["connect_group_name"] previous_connect_group_name = meta_data["group_name"]
global_container_stack.setMetaDataEntry("connect_group_name", group_name) global_container_stack.setMetaDataEntry("group_name", group_name)
# Find all the places where there is the same group name and change it accordingly # Find all the places where there is the same group name and change it accordingly
CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "connect_group_name", value = previous_connect_group_name, new_value = group_name) CuraApplication.getInstance().getMachineManager().replaceContainersMetadata(key = "group_name", value = previous_connect_group_name, new_value = group_name)
else: else:
global_container_stack.setMetaDataEntry("connect_group_name", group_name) global_container_stack.setMetaDataEntry("group_name", group_name)
# Set the default value for "hidden", which is used when you have a group with multiple types of printers # Set the default value for "hidden", which is used when you have a group with multiple types of printers
global_container_stack.setMetaDataEntry("hidden", False) global_container_stack.setMetaDataEntry("hidden", False)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2018 Ultimaker B.V. # Copyright (c) 2019 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 json import json
from queue import Queue from queue import Queue
@ -245,7 +245,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
properties = device.getProperties().copy() properties = device.getProperties().copy()
if b"incomplete" in properties: if b"incomplete" in properties:
del properties[b"incomplete"] del properties[b"incomplete"]
properties[b'cluster_size'] = len(cluster_printers_list) properties[b"cluster_size"] = len(cluster_printers_list)
self._onRemoveDevice(instance_name) self._onRemoveDevice(instance_name)
self._onAddDevice(instance_name, address, properties) self._onAddDevice(instance_name, address, properties)

View file

@ -1,9 +1,12 @@
import configparser import configparser
from typing import Tuple, List, Set from typing import Tuple, List, Set, Dict
import io import io
from UM.VersionUpgrade import VersionUpgrade from UM.VersionUpgrade import VersionUpgrade
from cura.PrinterOutputDevice import ConnectionType from cura.PrinterOutputDevice import ConnectionType
deleted_settings = {"bridge_wall_max_overhang"} # type: Set[str] deleted_settings = {"bridge_wall_max_overhang"} # type: Set[str]
renamed_configurations = {"connect_group_name": "group_name"} # type: Dict[str, str]
class VersionUpgrade35to40(VersionUpgrade): class VersionUpgrade35to40(VersionUpgrade):
@ -20,10 +23,16 @@ class VersionUpgrade35to40(VersionUpgrade):
# Set the connection type if um_network_key or the octoprint key is set. # Set the connection type if um_network_key or the octoprint key is set.
parser["metadata"]["connection_type"] = str(ConnectionType.NetworkConnection.value) parser["metadata"]["connection_type"] = str(ConnectionType.NetworkConnection.value)
if "metadata" in parser:
for old_name, new_name in renamed_configurations.items():
if old_name not in parser["metadata"]:
continue
parser["metadata"][new_name] = parser["metadata"][old_name]
del parser["metadata"][old_name]
result = io.StringIO() result = io.StringIO()
parser.write(result) parser.write(result)
return [filename], [result.getvalue()] return [filename], [result.getvalue()]
pass
def getCfgVersion(self, serialised: str) -> int: def getCfgVersion(self, serialised: str) -> int:
parser = configparser.ConfigParser(interpolation = None) parser = configparser.ConfigParser(interpolation = None)

View file

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2019 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.10 import QtQuick 2.10
@ -37,8 +37,8 @@ Column
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
renderType: Text.NativeRendering renderType: Text.NativeRendering
text: catalog.i18nc("@label", "Enjoy a more powerful 3D printing experience.") text: catalog.i18nc("@label", "The next generation 3D printing workflow")
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default_bold")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
} }
@ -48,12 +48,7 @@ Column
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
renderType: Text.NativeRendering renderType: Text.NativeRendering
text: { text: catalog.i18nc("@text", "- Send print jobs to your Ultimaker printers outside your local network\n- Store your Ultimaker Cura settings in the cloud for use anywhere\n- Get exclusive access to material profiles from leading brands")
var t = " - Send prints to your Ultimaker printer from anywhere\n"
+ " - Access your Ultimaker Cura Settings worldwide\n"
+ " - Enhance your workflow with advanced material profiles"
return catalog.i18nc("@label", t)
}
lineHeight: 1.4 lineHeight: 1.4
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")

View file

@ -14,9 +14,9 @@ Instantiator
{ {
property string connectGroupName: property string connectGroupName:
{ {
if("connect_group_name" in model.metadata) if("group_name" in model.metadata)
{ {
return model.metadata["connect_group_name"] return model.metadata["group_name"]
} }
return "" return ""
} }

View file

@ -56,7 +56,7 @@ UM.ManagementPage
{ {
text: catalog.i18nc("@action:button", "Rename"); text: catalog.i18nc("@action:button", "Rename");
iconName: "edit-rename"; iconName: "edit-rename";
enabled: base.currentItem != null && base.currentItem.metadata.connect_group_name == null enabled: base.currentItem != null && base.currentItem.metadata.group_name == null
onClicked: renameDialog.open(); onClicked: renameDialog.open();
} }
] ]

View file

@ -38,7 +38,7 @@ ListView
var result = Cura.MachineManager.activeMachineId == model.id var result = Cura.MachineManager.activeMachineId == model.id
if (Cura.MachineManager.activeMachineHasRemoteConnection) if (Cura.MachineManager.activeMachineHasRemoteConnection)
{ {
result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["group_name"]
} }
return result return result
} }

View file

@ -6,6 +6,7 @@
"colors": { "colors": {
"main_background": [39, 44, 48, 255], "main_background": [39, 44, 48, 255],
"message_background": [39, 44, 48, 255],
"wide_lining": [31, 36, 39, 255], "wide_lining": [31, 36, 39, 255],
"thick_lining": [255, 255, 255, 30], "thick_lining": [255, 255, 255, 30],
"lining": [64, 69, 72, 255], "lining": [64, 69, 72, 255],