From f68fdb01b4b8f2729456427066f9b9ee1793d7f3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Aug 2015 10:55:13 +0200 Subject: [PATCH 1/6] Added preference to disable auto center when selecting object --- cura/CuraApplication.py | 9 ++-- resources/qml/ViewPage.qml | 50 ++++++++++++++++++++--- resources/qml/WizardPages/Bedleveling.qml | 2 +- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 319fa60758..531aebdeca 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -85,6 +85,7 @@ class CuraApplication(QtApplication): Preferences.getInstance().addPreference("cura/active_mode", "simple") Preferences.getInstance().addPreference("cura/recent_files", "") Preferences.getInstance().addPreference("cura/categories_expanded", "") + Preferences.getInstance().addPreference("view/center_on_select", True) JobQueue.getInstance().jobFinished.connect(self._onJobFinished) @@ -197,10 +198,10 @@ class CuraApplication(QtApplication): self._previous_active_tool = None else: self.getController().setActiveTool("TranslateTool") - - self._camera_animation.setStart(self.getController().getTool("CameraTool").getOrigin()) - self._camera_animation.setTarget(Selection.getSelectedObject(0).getWorldPosition()) - self._camera_animation.start() + if Preferences.getInstance().getValue("view/center_on_select"): + self._camera_animation.setStart(self.getController().getTool("CameraTool").getOrigin()) + self._camera_animation.setTarget(Selection.getSelectedObject(0).getWorldPosition()) + self._camera_animation.start() else: if self.getController().getActiveTool(): self._previous_active_tool = self.getController().getActiveTool().getPluginId() diff --git a/resources/qml/ViewPage.qml b/resources/qml/ViewPage.qml index 172ddad8d8..aa2c40992c 100644 --- a/resources/qml/ViewPage.qml +++ b/resources/qml/ViewPage.qml @@ -8,7 +8,8 @@ import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM -UM.PreferencesPage { +UM.PreferencesPage +{ id: preferencesPage //: View configuration page title @@ -17,22 +18,26 @@ UM.PreferencesPage { function reset() { UM.Preferences.resetPreference("view/show_overhang"); + UM.Preferences.resetPreferences("view/center_on_select"); } - GridLayout { + GridLayout + { columns: 2; - CheckBox { - id: viewCheckbox + CheckBox + { + id: overhangCheckbox checked: UM.Preferences.getValue("view/show_overhang") onCheckedChanged: UM.Preferences.setValue("view/show_overhang", checked) } - Button { + Button + { id: viewText //is a button so the user doesn't have te click inconvenientley precise to enable or disable the checkbox //: Display Overhang preference checkbox text: qsTr("Display Overhang"); - onClicked: viewCheckbox.checked = !viewCheckbox.checked + onClicked: overhangCheckbox.checked = !overhangCheckbox.checked //: Display Overhang preference tooltip tooltip: "Highlight unsupported areas of the model in red. Without support these areas will nog print properly." @@ -49,6 +54,39 @@ UM.PreferencesPage { } } } + + CheckBox + { + id: centerCheckbox + checked: UM.Preferences.getValue("view/center_on_select") + onCheckedChanged: UM.Preferences.setValue("view/center_on_select", checked) + } + Button + { + id: centerText //is a button so the user doesn't have te click inconvenientley precise to enable or disable the checkbox + + //: Display Overhang preference checkbox + text: qsTr("Center camera when item is selected"); + onClicked: overhangCheckbox.checked = !overhangCheckbox.checked + + //: Display Overhang preference tooltip + tooltip: "Moves the camera so the object is in the center of the view when an object is selected" + + style: ButtonStyle + { + background: Rectangle + { + border.width: 0 + color: "transparent" + } + label: Text + { + renderType: Text.NativeRendering + horizontalAlignment: Text.AlignLeft + text: control.text + } + } + } Item { Layout.fillHeight: true; Layout.columnSpan: 2 } } } diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index 08b116a7e9..3c1dcea552 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -20,7 +20,7 @@ Column Component.onCompleted: printer_connection.homeHead() Label { - text: UM.Models.settingsModel.getItem(UM.Models.settingsModel.find("key", "machine_width")).toString() + text: "" //Component.onCompleted:console.log(UM.Models.settingsModel.getMachineSetting("machine_width")) } Button From bbf0b92f8756e41500f32f6a4e9224d55414548c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Aug 2015 11:53:30 +0200 Subject: [PATCH 2/6] Added preference to disable automatic push free fix #49 --- cura/PlatformPhysics.py | 6 +- resources/qml/Cura.qml | 7 ++ resources/qml/GeneralPage.qml | 130 ++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 resources/qml/GeneralPage.qml diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index ee6e39f03b..f96c81abce 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -12,6 +12,8 @@ from UM.Math.Vector import Vector from UM.Math.AxisAlignedBox import AxisAlignedBox from UM.Application import Application from UM.Scene.Selection import Selection +from UM.Preferences import Preferences + from cura.ConvexHullDecorator import ConvexHullDecorator from . import PlatformPhysicsOperation @@ -37,6 +39,8 @@ class PlatformPhysics: self._change_timer.setSingleShot(True) self._change_timer.timeout.connect(self._onChangeTimerFinished) + Preferences.getInstance().addPreference("physics/automatic_push_free", True) + def _onSceneChanged(self, source): self._change_timer.start() @@ -82,7 +86,7 @@ class PlatformPhysics: elif Selection.isSelected(node): pass - else: + elif Preferences.getInstance().getValue("physics/automatic_push_free"): # Check for collisions between convex hulls for other_node in BreadthFirstIterator(root): # Ignore root, ourselves and anything that is not a normal SceneNode. diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 24fb33490f..2388f0d5e7 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -344,8 +344,15 @@ UM.MainWindow { id: preferences Component.onCompleted: { + //; Remove & re-add the general page as we want to use our own instead of uranium standard. + removePage(0); + insertPage(0, qsTr("General") , "" , Qt.resolvedUrl("./GeneralPage.qml")); + //: View preferences page title insertPage(1, qsTr("View"), "view-preview", Qt.resolvedUrl("./ViewPage.qml")); + + //Force refresh + setPage(0) } } diff --git a/resources/qml/GeneralPage.qml b/resources/qml/GeneralPage.qml new file mode 100644 index 0000000000..9f7203702f --- /dev/null +++ b/resources/qml/GeneralPage.qml @@ -0,0 +1,130 @@ +// Copyright (c) 2015 Ultimaker B.V. +// Uranium is released under the terms of the AGPLv3 or higher. + +import QtQuick 2.1 +import QtQuick.Controls 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Controls.Styles 1.1 + +import UM 1.0 as UM + +UM.PreferencesPage +{ + //: General configuration page title + title: qsTr("General"); + + function reset() + { + UM.Preferences.resetPreference("general/language") + UM.Preferences.resetPreference("physics/automatic_push_free") + } + GridLayout + { + columns: 2; + //: Language selection label + Label + { + id: languageLabel + text: qsTr("Language") + } + + ComboBox + { + id: languageComboBox + model: ListModel + { + id: languageList + //: English language combo box option + ListElement { text: QT_TR_NOOP("English"); code: "en" } + //: German language combo box option + ListElement { text: QT_TR_NOOP("German"); code: "de" } + //: French language combo box option + // ListElement { text: QT_TR_NOOP("French"); code: "fr" } + //: Spanish language combo box option + ListElement { text: QT_TR_NOOP("Spanish"); code: "es" } + //: Italian language combo box option + // ListElement { text: QT_TR_NOOP("Italian"); code: "it" } + //: Finnish language combo box option + ListElement { text: QT_TR_NOOP("Finnish"); code: "fi" } + //: Russian language combo box option + ListElement { text: QT_TR_NOOP("Russian"); code: "ru" } + } + + currentIndex: + { + var code = UM.Preferences.getValue("general/language"); + for(var i = 0; i < languageList.count; ++i) + { + if(model.get(i).code == code) + { + return i + } + } + } + onActivated: UM.Preferences.setValue("general/language", model.get(index).code) + + anchors.left: languageLabel.right + anchors.top: languageLabel.top + anchors.leftMargin: 20 + + Component.onCompleted: + { + // Because ListModel is stupid and does not allow using qsTr() for values. + for(var i = 0; i < languageList.count; ++i) + { + languageList.setProperty(i, "text", qsTr(languageList.get(i).text)); + } + + // Glorious hack time. ComboBox does not update the text properly after changing the + // model. So change the indices around to force it to update. + currentIndex += 1; + currentIndex -= 1; + } + } + + Label + { + id: languageCaption; + Layout.columnSpan: 2 + + //: Language change warning + text: qsTr("You will need to restart the application for language changes to have effect.") + wrapMode: Text.WordWrap + font.italic: true + } + + CheckBox + { + id: pushFreeCheckbox + checked: UM.Preferences.getValue("physics/automatic_push_free") + onCheckedChanged: UM.Preferences.setValue("physics/automatic_push_free", checked) + } + Button + { + id: pushFreeText //is a button so the user doesn't have te click inconvenientley precise to enable or disable the checkbox + + //: Display Overhang preference checkbox + text: qsTr("Automatic push free"); + onClicked: pushFreeCheckbox.checked = !pushFreeCheckbox.checked + + //: Display Overhang preference tooltip + tooltip: "Are objects on the platform automatically moved so they no longer intersect" + + style: ButtonStyle + { + background: Rectangle + { + border.width: 0 + color: "transparent" + } + label: Text + { + renderType: Text.NativeRendering + horizontalAlignment: Text.AlignLeft + text: control.text + } + } + } + Item { Layout.fillHeight: true; Layout.columnSpan: 2 } + } +} From 21d8eb941bc6e67fe310e637c06ce90e76f38203 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Aug 2015 11:55:03 +0200 Subject: [PATCH 3/6] Fixed usage of wrong checkbox in viewpage --- resources/qml/ViewPage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ViewPage.qml b/resources/qml/ViewPage.qml index aa2c40992c..ed00eacca0 100644 --- a/resources/qml/ViewPage.qml +++ b/resources/qml/ViewPage.qml @@ -67,7 +67,7 @@ UM.PreferencesPage //: Display Overhang preference checkbox text: qsTr("Center camera when item is selected"); - onClicked: overhangCheckbox.checked = !overhangCheckbox.checked + onClicked: centerCheckbox.checked = !centerCheckbox.checked //: Display Overhang preference tooltip tooltip: "Moves the camera so the object is in the center of the view when an object is selected" From 5f844d403926c88168a61763deb9119642e032a9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Aug 2015 13:33:10 +0200 Subject: [PATCH 4/6] Added action for togling fullscreen Contributes to CURA-52 --- resources/qml/Actions.qml | 8 ++++++++ resources/qml/Cura.qml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index 5b5a73a81a..29bd573d12 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -40,6 +40,14 @@ Item { property alias reportBug: reportBugAction; property alias about: aboutAction; + property alias toggleFullScreen: toggleFullScreenAction; + + Action + { + id:toggleFullScreenAction + shortcut: StandardKey.FullScreen; + } + Action { id: undoAction; //: Undo action diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2388f0d5e7..7b9828711f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -12,7 +12,6 @@ import UM 1.1 as UM UM.MainWindow { id: base visible: true - //: Cura application window title title: qsTr("Cura"); @@ -425,6 +424,8 @@ UM.MainWindow { reportBug.onTriggered: CuraActions.openBugReportPage(); showEngineLog.onTriggered: engineLog.visible = true; about.onTriggered: aboutDialog.visible = true; + toggleFullScreen.onTriggered: base.toggleFullscreen() + } Menu { From 329b2d4f7720aab4d6054c8f1924aff3d308b9c4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Aug 2015 15:49:43 +0200 Subject: [PATCH 5/6] Removed unused settings from fdmprinter --- resources/settings/fdmprinter.json | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index d06ecf49f3..35cdf2256f 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -28,21 +28,6 @@ "machine_center_is_zero": { "default": false }, - "machine_head_shape_min_x": { - "default": 40 - }, - "machine_head_shape_min_y": { - "default": 10 - }, - "machine_head_shape_max_x": { - "default": 60 - }, - "machine_head_shape_max_y": { - "default": 30 - }, - "machine_nozzle_gantry_distance": { - "default": 55 - }, "machine_extruder_count": { "default": 1 }, From 21ff2eaab0208ae552589e6d3fe4d98917125858 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 20 Aug 2015 16:14:58 +0200 Subject: [PATCH 6/6] Fixed machine head polygons --- resources/settings/fdmprinter.json | 16 ++++++------- resources/settings/ultimaker2.json | 28 +++++++++++++++++----- resources/settings/ultimaker_original.json | 27 +++++++++++++++++---- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index 35cdf2256f..6aae7644b5 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -52,20 +52,20 @@ "machine_head_polygon": { "default": [ [ - -10, - 10 + -1, + 1 ], [ - 10, - 10 + -1, + -1 ], [ - 10, - -10 + 1, + -1 ], [ - -10, - -10 + 1, + 1 ] ] }, diff --git a/resources/settings/ultimaker2.json b/resources/settings/ultimaker2.json index 0e42d73688..598a9327c1 100644 --- a/resources/settings/ultimaker2.json +++ b/resources/settings/ultimaker2.json @@ -47,14 +47,30 @@ "machine_height": { "default": 205 }, "machine_heated_bed": { "default": true }, - + "machine_head_with_fans_polygon": + { + "default": [ + [ + -40, + 30 + ], + [ + -40, + -10 + ], + [ + 60, + -10 + ], + [ + 60, + 30 + ] + ] + }, "machine_center_is_zero": { "default": false }, "machine_nozzle_size": { "default": 0.4 }, - "machine_head_shape_min_x": { "default": 40 }, - "machine_head_shape_min_y": { "default": 10 }, - "machine_head_shape_max_x": { "default": 60 }, - "machine_head_shape_max_y": { "default": 30 }, - "machine_nozzle_gantry_distance": { "default": 55 }, + "gantry_height": { "default": 55 }, "machine_use_extruder_offset_to_offset_coords": { "default": true }, "machine_gcode_flavor": { "default": "UltiGCode" }, "machine_disallowed_areas": { "default": [ diff --git a/resources/settings/ultimaker_original.json b/resources/settings/ultimaker_original.json index 5dde73fcf7..9b34404c54 100644 --- a/resources/settings/ultimaker_original.json +++ b/resources/settings/ultimaker_original.json @@ -50,11 +50,28 @@ "machine_depth": { "default": 205 }, "machine_center_is_zero": { "default": false }, "machine_nozzle_size": { "default": 0.4 }, - "machine_head_shape_min_x": { "default": 75 }, - "machine_head_shape_min_y": { "default": 18 }, - "machine_head_shape_max_x": { "default": 18 }, - "machine_head_shape_max_y": { "default": 35 }, - "machine_nozzle_gantry_distance": { "default": 55 }, + "machine_head_with_fans_polygon": + { + "default": [ + [ + -75, + 35 + ], + [ + -75, + -18 + ], + [ + 18, + 35 + ], + [ + 18, + -18 + ] + ] + }, + "gantry_height": { "default": 55 }, "machine_use_extruder_offset_to_offset_coords": { "default": true }, "machine_gcode_flavor": { "default": "RepRap (Marlin/Sprinter)" },