From 38a2245d74e70f50d21841043dc2c3bc8810500b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 28 Sep 2017 16:07:03 +0200 Subject: [PATCH 1/3] XML materials are now added in one batch --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 12fa1c9ef4..41953d9250 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -416,6 +416,7 @@ class XmlMaterialProfile(InstanceContainer): ## Overridden from InstanceContainer def deserialize(self, serialized): + containers_to_add = [] # update the serialized data first from UM.Settings.Interfaces import ContainerInterface serialized = ContainerInterface.deserialize(self, serialized) @@ -573,7 +574,7 @@ class XmlMaterialProfile(InstanceContainer): new_material._dirty = False if is_new_material: - ContainerRegistry.getInstance().addContainer(new_material) + containers_to_add.append(new_material) hotends = machine.iterfind("./um:hotend", self.__namespaces) for hotend in hotends: @@ -632,7 +633,10 @@ class XmlMaterialProfile(InstanceContainer): new_hotend_material._dirty = False if is_new_material: - ContainerRegistry.getInstance().addContainer(new_hotend_material) + containers_to_add.append(new_hotend_material) + + for container_to_add in containers_to_add: + ContainerRegistry.getInstance().addContainer(container_to_add) def _addSettingElement(self, builder, instance): try: From 940a8a44c82a19b9045a1230760f1646465b85e7 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 28 Sep 2017 15:38:29 +0200 Subject: [PATCH 2/3] Apply screenScaleFactor to Cura Connect UI Any pixel size specified in QML should not either use UM.Theme.getSize(), or use screenScaleFactor to make sure the pixel size is as intended on OSX, Windows and Linux regardless of display DPI. Contributes to CURA-4376 --- plugins/UM3NetworkPrinting/ClusterControlItem.qml | 2 +- plugins/UM3NetworkPrinting/ClusterMonitorItem.qml | 8 ++++---- plugins/UM3NetworkPrinting/PrintWindow.qml | 10 +++++----- plugins/UM3NetworkPrinting/PrinterInfoBlock.qml | 8 ++++---- plugins/UM3NetworkPrinting/PrinterTile.qml | 10 +++++----- plugins/UM3NetworkPrinting/PrinterVideoStream.qml | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/plugins/UM3NetworkPrinting/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/ClusterControlItem.qml index 6558720943..f2e2b601f2 100644 --- a/plugins/UM3NetworkPrinting/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterControlItem.qml @@ -12,7 +12,7 @@ Component property var manager: Cura.MachineManager.printerOutputDevices[0] anchors.fill: parent property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. - property var cornerRadius: 4 // TODO: Should be linked to theme. + property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. visible: manager != null diff --git a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml index d39cdab81e..48fb0a33fc 100644 --- a/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml +++ b/plugins/UM3NetworkPrinting/ClusterMonitorItem.qml @@ -15,7 +15,7 @@ Component property var emphasisColor: "#44c0ff" //TODO: should be linked to theme. property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. - property var cornerRadius: 4 // TODO: Should be linked to theme. + property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. UM.I18nCatalog { id: catalog @@ -50,7 +50,7 @@ Component anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(800, maximumWidth) + width: Math.min(800 * screenScaleFactor, maximumWidth) height: children.height visible: OutputDevice.connectedPrinters.length != 0 @@ -90,8 +90,8 @@ Component delegate: PrinterInfoBlock { printer: modelData - width: Math.min(800, maximumWidth) - height: 125 + width: Math.min(800 * screenScaleFactor, maximumWidth) + height: 125 * screenScaleFactor // Add a 1 pix margin, as the border is sometimes cut off otherwise. anchors.horizontalCenter: parent.horizontalCenter diff --git a/plugins/UM3NetworkPrinting/PrintWindow.qml b/plugins/UM3NetworkPrinting/PrintWindow.qml index 940993556f..7afe174da2 100644 --- a/plugins/UM3NetworkPrinting/PrintWindow.qml +++ b/plugins/UM3NetworkPrinting/PrintWindow.qml @@ -11,8 +11,8 @@ UM.Dialog { id: base; - minimumWidth: 500 - minimumHeight: 140 + minimumWidth: 500 * screenScaleFactor + minimumHeight: 140 * screenScaleFactor maximumWidth: minimumWidth maximumHeight: minimumHeight width: minimumWidth @@ -31,7 +31,7 @@ UM.Dialog anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width - height: 50 + height: 50 * screenScaleFactor Label { @@ -44,7 +44,7 @@ UM.Dialog } text: "Printer selection" wrapMode: Text.Wrap - height: 20 + height: 20 * screenScaleFactor } ComboBox @@ -54,7 +54,7 @@ UM.Dialog textRole: "friendly_name" width: parent.width - height: 40 + height: 40 * screenScaleFactor Behavior on height { NumberAnimation { duration: 100 } } onActivated: diff --git a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml index f53864659b..161fdca36e 100644 --- a/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrinterInfoBlock.qml @@ -137,7 +137,7 @@ Rectangle Rectangle // Camera icon { id: showCameraIcon - width: 40 + width: 40 * screenScaleFactor height: width radius: width anchors.right: printProgressArea.left @@ -161,7 +161,7 @@ Rectangle width: parent.width / 2 - UM.Theme.getSize("default_margin").width height: childrenRect.height - spacing: 10 + spacing: 10 * screenScaleFactor PrintCoreConfiguration { @@ -173,7 +173,7 @@ Rectangle Rectangle { id: extruderSeperator - width: 1 + width: 1 * screenScaleFactor height: parent.height color: lineColor } @@ -215,7 +215,7 @@ Rectangle width: parent.width //border.width: UM.Theme.getSize("default_lining").width //border.color: lineColor - height: 40 + height: 40 * screenScaleFactor anchors.left: parent.left Label diff --git a/plugins/UM3NetworkPrinting/PrinterTile.qml b/plugins/UM3NetworkPrinting/PrinterTile.qml index f240f3034f..3d03e93688 100644 --- a/plugins/UM3NetworkPrinting/PrinterTile.qml +++ b/plugins/UM3NetworkPrinting/PrinterTile.qml @@ -8,8 +8,8 @@ import Cura 1.0 as Cura Rectangle { id: base - width: 250 - height: 250 + width: 250 * screenScaleFactor + height: 250 * screenScaleFactor signal clicked() MouseArea { @@ -19,8 +19,8 @@ Rectangle Rectangle { // TODO: Actually add UM icon / picture - width: 100 - height: 100 + width: 100 * screenScaleFactor + height: 100 * screenScaleFactor border.width: UM.Theme.getSize("default_lining").width anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top @@ -47,7 +47,7 @@ Rectangle anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("default_margin").height font: UM.Theme.getFont("default") - height:10 + height:10 * screenScaleFactor anchors.horizontalCenter: parent.horizontalCenter } } diff --git a/plugins/UM3NetworkPrinting/PrinterVideoStream.qml b/plugins/UM3NetworkPrinting/PrinterVideoStream.qml index 4f138ee8d1..fe60d30dd4 100644 --- a/plugins/UM3NetworkPrinting/PrinterVideoStream.qml +++ b/plugins/UM3NetworkPrinting/PrinterVideoStream.qml @@ -29,8 +29,8 @@ Item anchors.right: cameraImage.right // TODO: Harcoded sizes - width: 20 - height: 20 + width: 20 * screenScaleFactor + height: 20 * screenScaleFactor onClicked: OutputDevice.selectAutomaticPrinter() @@ -56,8 +56,8 @@ Item Image { id: cameraImage - width: Math.min(sourceSize.width === 0 ? 800 : sourceSize.width, maximumWidth) - height: (sourceSize.height === 0 ? 600 : sourceSize.height) * width / sourceSize.width + width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) + height: (sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter z: 1 From dbf13b0d1a90f943f436738d0591a13d95bafa23 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Sep 2017 09:14:43 +0200 Subject: [PATCH 3/3] Fix calling loggers Because UM.Logger is a module, not the Logger class. --- cura/Settings/QualitySettingsModel.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cura/Settings/QualitySettingsModel.py b/cura/Settings/QualitySettingsModel.py index 7c7550ed50..2ab4e2a9b5 100644 --- a/cura/Settings/QualitySettingsModel.py +++ b/cura/Settings/QualitySettingsModel.py @@ -1,11 +1,11 @@ -# Copyright (c) 2016 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import collections from PyQt5.QtCore import pyqtProperty, pyqtSignal, Qt -import UM.Logger +from UM.Logger import Logger import UM.Qt from UM.Application import Application from UM.Settings.ContainerRegistry import ContainerRegistry @@ -97,7 +97,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): containers = self._container_registry.findInstanceContainers(id = self._quality_id) if not containers: - UM.Logger.log("w", "Could not find a quality container with id %s", self._quality_id) + Logger.log("w", "Could not find a quality container with id %s", self._quality_id) return quality_container = None @@ -116,7 +116,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): quality_container = self._container_registry.findInstanceContainers(**criteria) if not quality_container: - UM.Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId()) + Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId()) return quality_container = quality_container[0] @@ -160,7 +160,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): containers = self._container_registry.findInstanceContainers(**criteria) if not containers: - UM.Logger.log("w", "Could not find any quality containers matching the search criteria %s" % str(criteria)) + Logger.log("w", "Could not find any quality containers matching the search criteria %s" % str(criteria)) return if quality_changes_container: