From a2fde9f5f2f6a75f4d4cf02efd1b2baf584ab359 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 15 Feb 2018 14:58:58 +0100 Subject: [PATCH 1/2] Revert "Fix rounded values in qml files" This reverts commit f11a1341ee52069f47d9fbca5d2e043b7ff3b17d. --- plugins/ChangeLogPlugin/ChangeLog.qml | 4 ++-- resources/qml/AboutDialog.qml | 4 ++-- resources/qml/Preferences/MachinesPage.qml | 4 ++-- resources/qml/Preferences/ProfileTab.qml | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/ChangeLogPlugin/ChangeLog.qml b/plugins/ChangeLogPlugin/ChangeLog.qml index f7715efb98..512687f15a 100644 --- a/plugins/ChangeLogPlugin/ChangeLog.qml +++ b/plugins/ChangeLogPlugin/ChangeLog.qml @@ -11,8 +11,8 @@ import UM 1.1 as UM UM.Dialog { id: base - minimumWidth: Math.round(UM.Theme.getSize("modal_window_minimum").width * 0.75) | 0 - minimumHeight: Math.round(UM.Theme.getSize("modal_window_minimum").height * 0.75) | 0 + minimumWidth: (UM.Theme.getSize("modal_window_minimum").width * 0.75) | 0 + minimumHeight: (UM.Theme.getSize("modal_window_minimum").height * 0.75) | 0 width: minimumWidth height: minimumHeight title: catalog.i18nc("@label", "Changelog") diff --git a/resources/qml/AboutDialog.qml b/resources/qml/AboutDialog.qml index 2c40aa4500..30e540e80a 100644 --- a/resources/qml/AboutDialog.qml +++ b/resources/qml/AboutDialog.qml @@ -22,8 +22,8 @@ UM.Dialog Image { id: logo - width: Math.round(base.minimumWidth * 0.85) | 0 - height: Math.round(width * (1/4.25)) | 0 + width: (base.minimumWidth * 0.85) | 0 + height: (width * (1/4.25)) | 0 source: UM.Theme.getImage("logo") diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 597820f67b..889dfa8d5b 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -160,7 +160,7 @@ UM.ManagementPage } Label { - width: Math.round(parent.width * 0.7) | 0 + width: (parent.width * 0.7) | 0 text: machineInfo.printerConnected ? machineInfo.connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") visible: base.currentItem && base.currentItem.id == Cura.MachineManager.activeMachineId wrapMode: Text.WordWrap @@ -171,7 +171,7 @@ UM.ManagementPage visible: base.currentItem && base.currentItem.id == Cura.MachineManager.activeMachineId && machineInfo.printerAcceptsCommands } Label { - width: Math.round(parent.width * 0.7) | 0 + width: (parent.width * 0.7) | 0 text: { if(!machineInfo.printerConnected || !machineInfo.printerAcceptsCommands) { diff --git a/resources/qml/Preferences/ProfileTab.qml b/resources/qml/Preferences/ProfileTab.qml index ee61feac34..acebea3500 100644 --- a/resources/qml/Preferences/ProfileTab.qml +++ b/resources/qml/Preferences/ProfileTab.qml @@ -51,14 +51,14 @@ Tab { role: "label" title: catalog.i18nc("@title:column", "Setting") - width: Math.round(parent.width * 0.4) | 0 + width: (parent.width * 0.4) | 0 delegate: itemDelegate } TableViewColumn { role: "profile_value" title: catalog.i18nc("@title:column", "Profile") - width: Math.round(parent.width * 0.18) | 0 + width: (parent.width * 0.18) | 0 delegate: itemDelegate } TableViewColumn @@ -66,14 +66,14 @@ Tab role: "user_value" title: catalog.i18nc("@title:column", "Current"); visible: quality == Cura.MachineManager.globalQualityId - width: Math.round(parent.width * 0.18) | 0 + width: (parent.width * 0.18) | 0 delegate: itemDelegate } TableViewColumn { role: "unit" title: catalog.i18nc("@title:column", "Unit") - width: Math.round(parent.width * 0.14) | 0 + width: (parent.width * 0.14) | 0 delegate: itemDelegate } From 06ec77e0120dab132a0cdfd3090d0c712b9514b2 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 15 Feb 2018 15:23:17 +0100 Subject: [PATCH 2/2] Better readability in PreviewPass --- cura/PreviewPass.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cura/PreviewPass.py b/cura/PreviewPass.py index b5b46f447c..de21a5dc86 100644 --- a/cura/PreviewPass.py +++ b/cura/PreviewPass.py @@ -19,13 +19,14 @@ if MYPY: # Make color brighter by normalizing it (maximum factor 2.5 brighter) -def prettier_color(l): - maximum = max(l[:3]) +# color_list is a list of 4 elements: [r, g, b, a], each element is a float 0..1 +def prettier_color(color_list): + maximum = max(color_list[:3]) if maximum > 0: factor = min(1 / maximum, 2.5) else: factor = 1.0 - return [min(i * factor, 1.0) for i in l] + return [min(i * factor, 1.0) for i in color_list] ## A render pass subclass that renders slicable objects with default parameters.