Merge branch 'master' into CURA-7022_Add_cloud_printer_within_add_a_connected_printer

This commit is contained in:
Kostas Karmas 2020-04-29 15:37:53 +02:00
commit b008f1e823
9 changed files with 36 additions and 20 deletions

View file

@ -738,11 +738,15 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
@staticmethod
def _loadMetadata(file_name: str) -> Dict[str, Dict[str, Any]]:
result = dict() # type: Dict[str, Dict[str, Any]]
try:
archive = zipfile.ZipFile(file_name, "r")
except zipfile.BadZipFile:
Logger.logException("w", "Unable to retrieve metadata from {fname}: 3MF archive is corrupt.".format(fname = file_name))
return result
metadata_files = [name for name in archive.namelist() if name.endswith("plugin_metadata.json")]
result = dict()
for metadata_file in metadata_files:
try:

View file

@ -86,7 +86,7 @@ class ModelChecker(QObject, Extension):
if material_shrinkage[node_extruder_position] > shrinkage_threshold:
bbox = node.getBoundingBox()
if bbox.width >= warning_size_xy or bbox.depth >= warning_size_xy or bbox.height >= warning_size_z:
if bbox is not None and (bbox.width >= warning_size_xy or bbox.depth >= warning_size_xy or bbox.height >= warning_size_z):
warning_nodes.append(node)
self._caution_message.setText(catalog.i18nc(

View file

@ -149,6 +149,7 @@ class SolidView(View):
theme = Application.getInstance().getTheme()
self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb()))
self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb()))
self._xray_composite_shader.setUniformValue("u_flat_error_color_mix", 0.) # Don't show flat error color in solid-view.
renderer = self.getRenderer()
if not self._composite_pass or not 'xray' in self._composite_pass.getLayerBindings():

View file

@ -232,11 +232,11 @@ class CloudOutputDeviceManager:
return
new_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
self._setOutputDeviceMetadata(device, new_machine)
if activate:
CuraApplication.getInstance().getMachineManager().setActiveMachine(new_machine.getId())
self._connectToOutputDevice(device, new_machine)
def _connectToActiveMachine(self) -> None:
"""Callback for when the active machine was changed by the user"""
@ -258,14 +258,17 @@ class CloudOutputDeviceManager:
# Remove device if it is not meant for the active machine.
output_device_manager.removeOutputDevice(device.key)
def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None:
"""Connects to an output device and makes sure it is registered in the output device manager."""
def _setOutputDeviceMetadata(self, device: CloudOutputDevice, machine: GlobalStack):
machine.setName(device.name)
machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key)
machine.setMetaDataEntry("group_name", device.name)
machine.addConfiguredConnectionType(device.connectionType.value)
def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None:
"""Connects to an output device and makes sure it is registered in the output device manager."""
self._setOutputDeviceMetadata(device, machine)
if not device.isConnected():
device.connect()

View file

@ -125,7 +125,10 @@ class ToolPathUploader:
if self._retries < self.MAX_RETRIES and status_code in self.RETRY_HTTP_CODES:
self._retries += 1
Logger.log("i", "Retrying %s/%s request %s", self._retries, self.MAX_RETRIES, reply.url().toString())
try:
self._uploadChunk()
except ValueError: # Asynchronously it could have completed in the meanwhile.
pass
return
# Http codes that are not to be retried are assumed to be errors.

View file

@ -29,6 +29,7 @@ class VersionUpgrade45to46(VersionUpgrade):
parser["metadata"]["setting_version"] = "12"
# Remove deleted settings from the visible settings list.
if "general" in parser and "visible_settings" in parser["general"]:
visible_settings = set(parser["general"]["visible_settings"].split(";"))
for removed in _removed_settings:
if removed in visible_settings:

View file

@ -93,6 +93,7 @@ class XRayView(CuraView):
theme = Application.getInstance().getTheme()
self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb()))
self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb()))
self._xray_composite_shader.setUniformValue("u_flat_error_color_mix", 1.) # Show flat error color _only_ in xray-view.
if not self._composite_pass:
self._composite_pass = self.getRenderer().getRenderPass("composite")

View file

@ -113,14 +113,14 @@ UM.Dialog
TableViewColumn
{
role: "original_value"
title: catalog.i18nc("@title:column", "Default")
title: Cura.MachineManager.activeQualityDisplayNameMap["main"]
width: (tableView.width * 0.3) | 0
delegate: defaultDelegate
}
TableViewColumn
{
role: "user_value"
title: catalog.i18nc("@title:column", "Customized")
title: catalog.i18nc("@title:column", "Current changes")
width: (tableView.width * 0.3) | 0
}
section.property: "category"
@ -192,7 +192,7 @@ UM.Dialog
Button
{
id: discardButton
text: catalog.i18nc("@action:button", "Discard");
text: catalog.i18nc("@action:button", "Discard changes");
anchors.right: parent.right
onClicked:
{
@ -205,7 +205,7 @@ UM.Dialog
Button
{
id: keepButton
text: catalog.i18nc("@action:button", "Keep");
text: catalog.i18nc("@action:button", "Keep changes");
anchors.right: discardButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
onClicked:

View file

@ -30,6 +30,7 @@ fragment =
uniform vec4 u_outline_color;
uniform vec4 u_background_color;
uniform float u_xray_error_strength;
uniform float u_flat_error_color_mix;
const vec3 x_axis = vec3(1.0, 0.0, 0.0);
const vec3 y_axis = vec3(0.0, 1.0, 0.0);
@ -73,7 +74,7 @@ fragment =
float rest = mod(intersection_count + .01, 2.0);
if (rest > 1.0 && rest < 1.5 && intersection_count < 49.0)
{
result = vec4(shiftHue(layer0.rgb, hue_shift), result.a);
result = mix(vec4(shiftHue(layer0.rgb, hue_shift), result.a), vec4(1.,0.,0.,1.), u_flat_error_color_mix);
}
vec4 sum = vec4(0.0);
@ -122,6 +123,7 @@ fragment41core =
uniform vec4 u_outline_color;
uniform vec4 u_background_color;
uniform float u_xray_error_strength;
uniform float u_flat_error_color_mix;
const vec3 x_axis = vec3(1.0, 0.0, 0.0);
const vec3 y_axis = vec3(0.0, 1.0, 0.0);
@ -166,7 +168,7 @@ fragment41core =
float rest = mod(intersection_count + .01, 2.0);
if (rest > 1.0 && rest < 1.5 && intersection_count < 49)
{
result = vec4(shiftHue(layer0.rgb, hue_shift), result.a);
result = mix(vec4(shiftHue(layer0.rgb, hue_shift), result.a), vec4(1.,0.,0.,1.), u_flat_error_color_mix);
}
vec4 sum = vec4(0.0);
@ -196,6 +198,7 @@ u_layer2 = 2
u_background_color = [0.965, 0.965, 0.965, 1.0]
u_outline_strength = 1.0
u_outline_color = [0.05, 0.66, 0.89, 1.0]
u_flat_error_color_mix = 0.5
[bindings]