From fb8bde6f76e4812968d8ffe4a7031c8ce2223705 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 3 Nov 2017 15:29:33 +0100 Subject: [PATCH 01/11] Added view rotation for each click CURA-4527 --- resources/qml/Cura.qml | 83 ++++++++++++++++++++ resources/themes/cura-light/styles.qml | 103 +++++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2fd19a8a03..e6b30e8f5c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -403,6 +403,89 @@ UM.MainWindow } } + + //View orientation Item + Item + { + height: 90 + width: 90 + + anchors.top: topbar.bottom; + anchors.topMargin: - UM.Theme.getSize("default_margin").height * 2; + anchors.right: sidebar.left + anchors.rightMargin: 250 + + //Rotate_top + Button + { + id: orientation_rotate_top; + iconSource: UM.Theme.getIcon("arrow_top") + style: UM.Theme.styles.orientation_button + anchors.top: parent.top + anchors.left: parent.left + anchors.leftMargin: 30 + + + } + + //Rotate_right + Button + { + id: orientation_rotate_right; + iconSource: UM.Theme.getIcon("arrow_right") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + anchors.right: parent.right + onClicked:{ + UM.Controller.rotateView("x", -90); + } + } + + //Rotate_bottom + Button + { + id: orientation_rotate_bottom; + iconSource: UM.Theme.getIcon("arrow_bottom") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.leftMargin: 30 + } + + //Rotate_left + Button + { + id: orientation_rotate_left; + iconSource: UM.Theme.getIcon("arrow_left") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + anchors.left: parent.left + onClicked:{ + UM.Controller.rotateView("x", 90); + } + + } + + //Rotate_front + Button + { + id: orientation_rotate_front; + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + anchors.left: parent.left + anchors.leftMargin: 30 + + onClicked:{ + UM.Controller.rotateView("home" , 0); + } + } + } + + Loader { sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 6d991c5541..160b41b1ab 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -380,6 +380,109 @@ QtObject { } } + property Component orientation_button: Component { + ButtonStyle { + background: Item { + implicitWidth: 30; + implicitHeight: 30; + + Rectangle { + id: buttonFace2; + + anchors.fill: parent; + property bool down: control.pressed || (control.checkable && control.checked); + + color: { + if(control.customColor !== undefined && control.customColor !== null) { + return control.customColor + } else if(control.checkable && control.checked && control.hovered) { + return Theme.getColor("button_active_hover"); + } else if(control.pressed || (control.checkable && control.checked)) { + return Theme.getColor("button_active"); + } else if(control.hovered) { + return Theme.getColor("button_hover"); + } else { + //return Theme.getColor("button"); + return "red" + } + } + Behavior on color { ColorAnimation { duration: 50; } } + + border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 + border.color: Theme.getColor("tool_button_border") + + UM.RecolorImage { + id: tool_button_arrow2 + //anchors.right: parent.right; + //anchors.rightMargin: (Theme.getSize("button").width - Theme.getSize("button_icon").width) / 4 + //anchors.bottom: parent.bottom; + //anchors.bottomMargin: (Theme.getSize("button").height - Theme.getSize("button_icon").height) / 4 + //width: Theme.getSize("standard_arrow").width + //height: Theme.getSize("standard_arrow").height + + width: 5 + height: 5 + + sourceSize.width: 5 + sourceSize.height: 5 + visible: control.menu != null; + color: + { + if(control.checkable && control.checked && control.hovered) + { + return Theme.getColor("button_text_active_hover"); + } + else if(control.pressed || (control.checkable && control.checked)) + { + return Theme.getColor("button_text_active"); + } + else if(control.hovered) + { + return Theme.getColor("button_text_hover"); + } + else + { + return Theme.getColor("button_text"); + } + } + source: Theme.getIcon("arrow_bottom") + } + } + } + + label: Item { + UM.RecolorImage { + anchors.centerIn: parent; + opacity: !control.enabled ? 0.2 : 1.0 + source: control.iconSource; + width: 20; + height: 20; + color: + { + if(control.checkable && control.checked && control.hovered) + { + return Theme.getColor("button_text_active_hover"); + } + else if(control.pressed || (control.checkable && control.checked)) + { + return Theme.getColor("button_text_active"); + } + else if(control.hovered) + { + return Theme.getColor("button_text_hover"); + } + else + { + return Theme.getColor("button_text"); + } + } + + sourceSize: Theme.getSize("button_icon") + } + } + } + } + property Component progressbar: Component{ ProgressBarStyle { background: Rectangle { From 7722e438c9d774430aa01598eb879a33dcc6fb2d Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Mon, 6 Nov 2017 10:28:07 +0100 Subject: [PATCH 02/11] Changed orientation button location, adjusted call functins CURA-4527 --- resources/qml/Cura.qml | 83 -------------------------- resources/qml/Topbar.qml | 70 ++++++++++++++++++++++ resources/themes/cura-light/styles.qml | 12 ++-- 3 files changed, 77 insertions(+), 88 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index e6b30e8f5c..2fd19a8a03 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -403,89 +403,6 @@ UM.MainWindow } } - - //View orientation Item - Item - { - height: 90 - width: 90 - - anchors.top: topbar.bottom; - anchors.topMargin: - UM.Theme.getSize("default_margin").height * 2; - anchors.right: sidebar.left - anchors.rightMargin: 250 - - //Rotate_top - Button - { - id: orientation_rotate_top; - iconSource: UM.Theme.getIcon("arrow_top") - style: UM.Theme.styles.orientation_button - anchors.top: parent.top - anchors.left: parent.left - anchors.leftMargin: 30 - - - } - - //Rotate_right - Button - { - id: orientation_rotate_right; - iconSource: UM.Theme.getIcon("arrow_right") - style: UM.Theme.styles.orientation_button - anchors.bottom: parent.bottom - anchors.bottomMargin: 30 - anchors.right: parent.right - onClicked:{ - UM.Controller.rotateView("x", -90); - } - } - - //Rotate_bottom - Button - { - id: orientation_rotate_bottom; - iconSource: UM.Theme.getIcon("arrow_bottom") - style: UM.Theme.styles.orientation_button - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.leftMargin: 30 - } - - //Rotate_left - Button - { - id: orientation_rotate_left; - iconSource: UM.Theme.getIcon("arrow_left") - style: UM.Theme.styles.orientation_button - anchors.bottom: parent.bottom - anchors.bottomMargin: 30 - anchors.left: parent.left - onClicked:{ - UM.Controller.rotateView("x", 90); - } - - } - - //Rotate_front - Button - { - id: orientation_rotate_front; - iconSource: UM.Theme.getIcon("category_machine") - style: UM.Theme.styles.orientation_button - anchors.bottom: parent.bottom - anchors.bottomMargin: 30 - anchors.left: parent.left - anchors.leftMargin: 30 - - onClicked:{ - UM.Controller.rotateView("home" , 0); - } - } - } - - Loader { sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index c69c786d5a..7e1bfeb808 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -220,6 +220,76 @@ Rectangle menu: PrinterMenu { } } + //View orientation Item + Row + { + id: viewOrientationControl + height: 30 + width: 155 + spacing: 2 + + anchors { + verticalCenter: base.verticalCenter + right: viewModeButton.right + rightMargin: UM.Theme.getSize("default_margin").width + viewModeButton.width + } + + // #1 3d view + Button + { + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.verticalCenter: viewOrientationControl.verticalCenter + onClicked:{ + UM.Controller.rotateView("3d", 0); + } + } + + // #2 Front view + Button + { + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.verticalCenter: viewOrientationControl.verticalCenter + onClicked:{ + UM.Controller.rotateView("home", 0); + } + } + + // #3 Top view + Button + { + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.verticalCenter: viewOrientationControl.verticalCenter + onClicked:{ + UM.Controller.rotateView("y", 90); + } + } + + // #4 Left view + Button + { + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.verticalCenter: viewOrientationControl.verticalCenter + onClicked:{ + UM.Controller.rotateView("x", 90); + } + } + + // #5 Left view + Button + { + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.verticalCenter: viewOrientationControl.verticalCenter + onClicked:{ + UM.Controller.rotateView("x", -90); + } + } + } + ComboBox { id: viewModeButton diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 160b41b1ab..36a3ddffbe 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -383,8 +383,8 @@ QtObject { property Component orientation_button: Component { ButtonStyle { background: Item { - implicitWidth: 30; - implicitHeight: 30; + implicitWidth: 25; + implicitHeight: 25; Rectangle { id: buttonFace2; @@ -403,7 +403,7 @@ QtObject { return Theme.getColor("button_hover"); } else { //return Theme.getColor("button"); - return "red" + return "transparent" } } Behavior on color { ColorAnimation { duration: 50; } } @@ -469,11 +469,13 @@ QtObject { } else if(control.hovered) { - return Theme.getColor("button_text_hover"); + //return Theme.getColor("button_text_hover"); + return "white" } else { - return Theme.getColor("button_text"); + //return Theme.getColor("button_text"); + return "black" } } From 6e7e859a0a879b38c850f2444d68eb9521ac0835 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 7 Nov 2017 10:59:23 +0100 Subject: [PATCH 03/11] Introduced Lock Position functionality CURA-4527 --- resources/themes/cura-light/styles.qml | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 36a3ddffbe..eff4542bce 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -857,6 +857,49 @@ QtObject { } } + property Component partially_checkbox: Component { + CheckBoxStyle { + background: Item { } + indicator: Rectangle { + implicitWidth: Theme.getSize("checkbox").width; + implicitHeight: Theme.getSize("checkbox").height; + + color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); + Behavior on color { ColorAnimation { duration: 50; } } + + radius: control.exclusiveGroup ? Theme.getSize("checkbox").width / 2 : 0 + + border.width: Theme.getSize("default_lining").width; + border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); + + UM.RecolorImage { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width / 2.5 + height: parent.height / 2.5 + sourceSize.width: width + sourceSize.height: width + color: Theme.getColor("checkbox_mark") + source: { + if (control.checkbox_state == 2){ + return Theme.getIcon("solid") + } + else{ + return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check") + } + } + opacity: control.checked + Behavior on opacity { NumberAnimation { duration: 100; } } + } + } + label: Label { + text: control.text; + color: Theme.getColor("checkbox_text"); + font: Theme.getFont("default"); + } + } + } + property Component slider: Component { SliderStyle { groove: Rectangle { From 3d2868c336ff24b3c724ced18244d4b8d53b5051 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 15 Nov 2017 00:43:17 +0100 Subject: [PATCH 04/11] Added icons CURA-4527 --- resources/qml/Topbar.qml | 10 ++-- resources/themes/cura-light/icons/view_3d.svg | 56 +++++++++++++++++++ .../themes/cura-light/icons/view_fron.svg | 56 +++++++++++++++++++ .../themes/cura-light/icons/view_left.svg | 56 +++++++++++++++++++ .../themes/cura-light/icons/view_right.svg | 56 +++++++++++++++++++ .../themes/cura-light/icons/view_top.svg | 56 +++++++++++++++++++ 6 files changed, 285 insertions(+), 5 deletions(-) create mode 100644 resources/themes/cura-light/icons/view_3d.svg create mode 100644 resources/themes/cura-light/icons/view_fron.svg create mode 100644 resources/themes/cura-light/icons/view_left.svg create mode 100644 resources/themes/cura-light/icons/view_right.svg create mode 100644 resources/themes/cura-light/icons/view_top.svg diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 7e1bfeb808..bf4c8b50ac 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -237,7 +237,7 @@ Rectangle // #1 3d view Button { - iconSource: UM.Theme.getIcon("category_machine") + iconSource: UM.Theme.getIcon("view_3d") style: UM.Theme.styles.orientation_button anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ @@ -248,7 +248,7 @@ Rectangle // #2 Front view Button { - iconSource: UM.Theme.getIcon("category_machine") + iconSource: UM.Theme.getIcon("view_fron") style: UM.Theme.styles.orientation_button anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ @@ -259,7 +259,7 @@ Rectangle // #3 Top view Button { - iconSource: UM.Theme.getIcon("category_machine") + iconSource: UM.Theme.getIcon("view_top") style: UM.Theme.styles.orientation_button anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ @@ -270,7 +270,7 @@ Rectangle // #4 Left view Button { - iconSource: UM.Theme.getIcon("category_machine") + iconSource: UM.Theme.getIcon("view_left") style: UM.Theme.styles.orientation_button anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ @@ -281,7 +281,7 @@ Rectangle // #5 Left view Button { - iconSource: UM.Theme.getIcon("category_machine") + iconSource: UM.Theme.getIcon("view_right") style: UM.Theme.styles.orientation_button anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ diff --git a/resources/themes/cura-light/icons/view_3d.svg b/resources/themes/cura-light/icons/view_3d.svg new file mode 100644 index 0000000000..de803ab2a6 --- /dev/null +++ b/resources/themes/cura-light/icons/view_3d.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/icons/view_fron.svg b/resources/themes/cura-light/icons/view_fron.svg new file mode 100644 index 0000000000..68e43c43a0 --- /dev/null +++ b/resources/themes/cura-light/icons/view_fron.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/icons/view_left.svg b/resources/themes/cura-light/icons/view_left.svg new file mode 100644 index 0000000000..729a7f18cd --- /dev/null +++ b/resources/themes/cura-light/icons/view_left.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/icons/view_right.svg b/resources/themes/cura-light/icons/view_right.svg new file mode 100644 index 0000000000..802da651ef --- /dev/null +++ b/resources/themes/cura-light/icons/view_right.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/cura-light/icons/view_top.svg b/resources/themes/cura-light/icons/view_top.svg new file mode 100644 index 0000000000..8c94744df0 --- /dev/null +++ b/resources/themes/cura-light/icons/view_top.svg @@ -0,0 +1,56 @@ + + + + + + image/svg+xml + + + + + + + + + From ce0510cee3a2e57a12c2c2ebcd83135eaa42c7ae Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 15 Nov 2017 16:34:22 +0100 Subject: [PATCH 05/11] Hide icons if they overlap monitor button CURA-4527 --- resources/qml/Topbar.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index bf4c8b50ac..dfc4562017 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -225,7 +225,7 @@ Rectangle { id: viewOrientationControl height: 30 - width: 155 + spacing: 2 anchors { @@ -242,7 +242,9 @@ Rectangle anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ UM.Controller.rotateView("3d", 0); + console.log("WIDTH : " + base.width) } + visible: base.width > 1100 } // #2 Front view @@ -254,6 +256,7 @@ Rectangle onClicked:{ UM.Controller.rotateView("home", 0); } + visible: base.width > 1130 } // #3 Top view @@ -265,6 +268,7 @@ Rectangle onClicked:{ UM.Controller.rotateView("y", 90); } + visible: base.width > 1160 } // #4 Left view @@ -276,6 +280,7 @@ Rectangle onClicked:{ UM.Controller.rotateView("x", 90); } + visible: base.width > 1190 } // #5 Left view @@ -287,6 +292,7 @@ Rectangle onClicked:{ UM.Controller.rotateView("x", -90); } + visible: base.width > 1210 } } From d7b230269b7685c9800f24f0d556ff93edbb4bbe Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Wed, 22 Nov 2017 11:10:25 +0100 Subject: [PATCH 06/11] The icons changed CURA-4527 --- resources/qml/Topbar.qml | 3 +- resources/themes/cura-light/icons/view_3d.svg | 70 ++++------------- .../themes/cura-light/icons/view_fron.svg | 56 -------------- .../themes/cura-light/icons/view_front.svg | 19 +++++ .../themes/cura-light/icons/view_left.svg | 77 +++++-------------- .../themes/cura-light/icons/view_right.svg | 77 +++++-------------- .../themes/cura-light/icons/view_top.svg | 77 +++++-------------- 7 files changed, 97 insertions(+), 282 deletions(-) delete mode 100644 resources/themes/cura-light/icons/view_fron.svg create mode 100644 resources/themes/cura-light/icons/view_front.svg diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index dfc4562017..033e1a55f9 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -242,7 +242,6 @@ Rectangle anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ UM.Controller.rotateView("3d", 0); - console.log("WIDTH : " + base.width) } visible: base.width > 1100 } @@ -250,7 +249,7 @@ Rectangle // #2 Front view Button { - iconSource: UM.Theme.getIcon("view_fron") + iconSource: UM.Theme.getIcon("view_front") style: UM.Theme.styles.orientation_button anchors.verticalCenter: viewOrientationControl.verticalCenter onClicked:{ diff --git a/resources/themes/cura-light/icons/view_3d.svg b/resources/themes/cura-light/icons/view_3d.svg index de803ab2a6..cfe394e65d 100644 --- a/resources/themes/cura-light/icons/view_3d.svg +++ b/resources/themes/cura-light/icons/view_3d.svg @@ -1,56 +1,14 @@ - - - - - - image/svg+xml - - - - - - - - - + + + + icn_perspectives_white + Created with Sketch. + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/view_fron.svg b/resources/themes/cura-light/icons/view_fron.svg deleted file mode 100644 index 68e43c43a0..0000000000 --- a/resources/themes/cura-light/icons/view_fron.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - diff --git a/resources/themes/cura-light/icons/view_front.svg b/resources/themes/cura-light/icons/view_front.svg new file mode 100644 index 0000000000..7de9abe0af --- /dev/null +++ b/resources/themes/cura-light/icons/view_front.svg @@ -0,0 +1,19 @@ + + + + icn_front_white + Created with Sketch. + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/view_left.svg b/resources/themes/cura-light/icons/view_left.svg index 729a7f18cd..1770da4c81 100644 --- a/resources/themes/cura-light/icons/view_left.svg +++ b/resources/themes/cura-light/icons/view_left.svg @@ -1,56 +1,21 @@ - - - - - - image/svg+xml - - - - - - - - - + + + + icn_left_white + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/view_right.svg b/resources/themes/cura-light/icons/view_right.svg index 802da651ef..5e0628e60e 100644 --- a/resources/themes/cura-light/icons/view_right.svg +++ b/resources/themes/cura-light/icons/view_right.svg @@ -1,56 +1,21 @@ - - - - - - image/svg+xml - - - - - - - - - + + + + icn_right_white + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/view_top.svg b/resources/themes/cura-light/icons/view_top.svg index 8c94744df0..3eb32e9878 100644 --- a/resources/themes/cura-light/icons/view_top.svg +++ b/resources/themes/cura-light/icons/view_top.svg @@ -1,56 +1,21 @@ - - - - - - image/svg+xml - - - - - - - - - + + + + icn_top_white + Created with Sketch. + + + + + + + + + + + + + + + + \ No newline at end of file From a7a3ba950075cf1d8d4977aa1ea5a649a10045ba Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 22 Nov 2017 13:09:24 +0100 Subject: [PATCH 07/11] Always update the job name when a project file is loaded CURA-4553 --- cura/PrintInformation.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 3cced2f85c..f0c29f5b81 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -70,6 +70,7 @@ class PrintInformation(QObject): Application.getInstance().globalContainerStackChanged.connect(self._updateJobName) Application.getInstance().fileLoaded.connect(self.setBaseName) + Application.getInstance().workspaceLoaded.connect(self.setProjectName) Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged) self._active_material_container = None @@ -283,7 +284,11 @@ class PrintInformation(QObject): return self._base_name @pyqtSlot(str) - def setBaseName(self, base_name): + def setProjectName(self, name): + self.setBaseName(name, is_project_file = True) + + @pyqtSlot(str) + def setBaseName(self, base_name, is_project_file = False): # Ensure that we don't use entire path but only filename name = os.path.basename(base_name) @@ -291,15 +296,17 @@ class PrintInformation(QObject): # extension. This cuts the extension off if necessary. name = os.path.splitext(name)[0] + # if this is a profile file, always update the job name # name is "" when I first had some meshes and afterwards I deleted them so the naming should start again is_empty = name == "" - if is_empty or (self._base_name == "" and self._base_name != name): + if is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)): # remove ".curaproject" suffix from (imported) the file name if name.endswith(".curaproject"): name = name[:name.rfind(".curaproject")] self._base_name = name self._updateJobName() + ## Created an acronymn-like abbreviated machine name from the currently active machine name # Called each time the global stack is switched def _setAbbreviatedMachineName(self): From 3b5ed701139b96e37afbe2068eaf543804d0e855 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 22 Nov 2017 16:15:06 +0100 Subject: [PATCH 08/11] CURA-4602 Fixed active custom profile selected check --- cura/Settings/MachineManager.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 002c84fb67..ca929b46fc 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -621,9 +621,16 @@ class MachineManager(QObject): def activeQualityId(self) -> str: if self._active_container_stack: quality = self._active_container_stack.quality + if isinstance(quality, type(self._empty_quality_container)): + return "" quality_changes = self._active_container_stack.qualityChanges - if quality and quality_changes and isinstance(quality_changes, type(self._empty_quality_changes_container)) and not isinstance(quality, type(self._empty_quality_container)): - return quality.getId() + if quality and quality_changes: + if isinstance(quality_changes, type(self._empty_quality_changes_container)): + # It's a built-in profile + return quality.getId() + else: + # Custom profile + return quality_changes.getId() return "" @pyqtProperty(str, notify=activeQualityChanged) From dc105c86a000692f8c88d7c049791d018b210b94 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 22 Nov 2017 16:16:35 +0100 Subject: [PATCH 09/11] Ignore live scripting plug-ins --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ac1e8eba92..f67add62cf 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ plugins/cura-god-mode-plugin plugins/cura-big-flame-graph plugins/cura-siemensnx-plugin plugins/CuraVariSlicePlugin +plugins/CuraLiveScriptingPlugin #Build stuff CMakeCache.txt From 6c3eaca0fd1a545bc7dc59ffc18b32550b99dc07 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 22 Nov 2017 16:22:23 +0100 Subject: [PATCH 10/11] fix loading user changes container for single extruder machine --- cura/Settings/CuraContainerRegistry.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 7abe5b35f5..2c9e15b8c9 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -449,12 +449,11 @@ class CuraContainerRegistry(ContainerRegistry): extruder_stack.setVariantById(variant_id) extruder_stack.setMaterialById("default") extruder_stack.setQualityById("default") - quality_changes_id = "default" if machine.qualityChanges.getId() != "empty_quality_changes": extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id) if extruder_quality_changes_container: quality_changes_id = extruder_quality_changes_container[0].getId() - extruder_stack.setQualityChangesById(quality_changes_id) + extruder_stack.setQualityChangesById(quality_changes_id) self.addContainer(extruder_stack) From 105d7a56154ed8c5323df3b8fc2c61941958da1e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 22 Nov 2017 17:12:53 +0100 Subject: [PATCH 11/11] Return newly added single extruder The workspace reader needs to use it to get the correct material. Contributes to issue CURA-4604. --- cura/Settings/CuraContainerRegistry.py | 4 +++- plugins/3MFReader/ThreeMFWorkspaceReader.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 2c9e15b8c9..1674405824 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry): extruder_stack = None # if extruders are defined in the machine definition use those instead - if machine.extruders and len(machine.extruders) > 0: + if machine.extruders and "0" in machine.extruders: new_extruder_id = machine.extruders["0"].getId() extruder_stack = machine.extruders["0"] @@ -457,6 +457,8 @@ class CuraContainerRegistry(ContainerRegistry): self.addContainer(extruder_stack) + return extruder_stack + # Fix the extruders that were upgraded to ExtruderStack instances during addContainer. # The stacks are now responsible for setting the next stack on deserialize. However, # due to problems with loading order, some stacks may not have the proper next stack diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index a237460bab..aa81399b56 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -746,7 +746,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): # If not extruder stacks were saved in the project file (pre 3.1) create one manually # We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this if not extruder_stacks: - self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder") + extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")) except: Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")