From 7997ae55eac332869b371db7fc3dacabce389c3b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 2 Mar 2017 11:50:47 +0100 Subject: [PATCH 1/3] CURA-3397 Make discard button default --- resources/qml/DiscardOrKeepProfileChangesDialog.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/DiscardOrKeepProfileChangesDialog.qml index a19400de5e..f869352f68 100644 --- a/resources/qml/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/DiscardOrKeepProfileChangesDialog.qml @@ -146,6 +146,7 @@ UM.Dialog Printer.discardOrKeepProfileChangesClosed("discard") base.hide() } + isDefault: true } Button From 67b57129ed1c861a91032e450473179b2833a762 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 2 Mar 2017 18:02:01 +0100 Subject: [PATCH 2/3] CURA-3397 Add options for profile override dialog --- cura/CuraApplication.py | 12 ++++++- .../qml/DiscardOrKeepProfileChangesDialog.qml | 21 +++++++++++ resources/qml/Preferences/GeneralPage.qml | 36 +++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f28d2e4896..2d431da1ed 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -243,6 +243,7 @@ class CuraApplication(QtApplication): Preferences.getInstance().addPreference("mesh/scale_tiny_meshes", True) Preferences.getInstance().addPreference("cura/dialog_on_project_save", True) Preferences.getInstance().addPreference("cura/asked_dialog_on_project_save", False) + Preferences.getInstance().addPreference("cura/choice_on_profile_override", 0) Preferences.getInstance().addPreference("cura/currency", "€") Preferences.getInstance().addPreference("cura/material_settings", "{}") @@ -334,7 +335,16 @@ class CuraApplication(QtApplication): showDiscardOrKeepProfileChanges = pyqtSignal() def discardOrKeepProfileChanges(self): - self.showDiscardOrKeepProfileChanges.emit() + choice = Preferences.getInstance().getValue("cura/choice_on_profile_override") + if choice == 1: + # don't show dialog and DISCARD the profile + self.discardOrKeepProfileChangesClosed("discard") + elif choice == 2: + # don't show dialog and KEEP the profile + self.discardOrKeepProfileChangesClosed("keep") + else: + # ALWAYS ask whether to keep or discard the profile + self.showDiscardOrKeepProfileChanges.emit() @pyqtSlot(str) def discardOrKeepProfileChangesClosed(self, option): diff --git a/resources/qml/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/DiscardOrKeepProfileChangesDialog.qml index f869352f68..ef7c9305c6 100644 --- a/resources/qml/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/DiscardOrKeepProfileChangesDialog.qml @@ -129,6 +129,27 @@ UM.Dialog model: base.changesModel } + Item + { + anchors.right: parent.right + anchors.left: parent.left + anchors.margins: UM.Theme.getSize("default_margin").width + height:childrenRect.height + + ComboBox + { + id: discardOrKeepProfileChangesDropDownButton + model: [ + catalog.i18nc("@option:discardOrKeep", "Always ask me this"), + catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"), + catalog.i18nc("@option:discardOrKeep", "Keep and never ask again") + ] + width: 300 + currentIndex: UM.Preferences.getValue("cura/choice_on_profile_override") + onCurrentIndexChanged: UM.Preferences.setValue("cura/choice_on_profile_override", currentIndex) + } + } + Item { anchors.right: parent.right diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 017de45521..b0646d5287 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -47,6 +47,8 @@ UM.PreferencesPage centerOnSelectCheckbox.checked = boolCheck(UM.Preferences.getValue("view/center_on_select")) UM.Preferences.resetPreference("view/top_layer_count"); topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) + UM.Preferences.resetPreference("cura/choice_on_profile_override") + choiceOnProfileOverrideDropDownButton.currentIndex = UM.Preferences.getValue("cura/choice_on_profile_override") if (plugins.find("id", "SliceInfoPlugin") > -1) { UM.Preferences.resetPreference("info/send_slice_info") @@ -377,6 +379,40 @@ UM.PreferencesPage } } + Item + { + //: Spacer + height: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("default_margin").width + } + + Label + { + font.bold: true + text: catalog.i18nc("@label", "Override Profile") + } + + UM.TooltipArea + { + width: childrenRect.width; + height: childrenRect.height; + + text: catalog.i18nc("@info:tooltip", "When you have made changes to a profile and switched to a different one, a dialog will be shown asking whether you want to keep your modifications or not, or you can choose a default behaviour and never show that dialog again.") + + ComboBox + { + id: choiceOnProfileOverrideDropDownButton + + model: [ + catalog.i18nc("@option:discardOrKeep", "Always ask me this"), + catalog.i18nc("@option:discardOrKeep", "Discard and never ask again"), + catalog.i18nc("@option:discardOrKeep", "Keep and never ask again") + ] + width: 300 + currentIndex: UM.Preferences.getValue("cura/choice_on_profile_override") + onCurrentIndexChanged: UM.Preferences.setValue("cura/choice_on_profile_override", currentIndex) + } + } Item { From b65d950181ef88f4730ebb75f4c8039d2a9b9e39 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Fri, 3 Mar 2017 08:31:30 +0100 Subject: [PATCH 3/3] CURA-3397 Change headers in override profile table --- resources/qml/DiscardOrKeepProfileChangesDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/DiscardOrKeepProfileChangesDialog.qml index ef7c9305c6..c1d167a5b6 100644 --- a/resources/qml/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/DiscardOrKeepProfileChangesDialog.qml @@ -101,7 +101,7 @@ UM.Dialog TableViewColumn { role: "label" - title: catalog.i18nc("@title:column", "Settings") + title: catalog.i18nc("@title:column", "Profile settings") delegate: labelDelegate width: tableView.width * 0.5 } @@ -109,7 +109,7 @@ UM.Dialog TableViewColumn { role: "original_value" - title: "Profile" + title: "Default" width: tableView.width * 0.25 delegate: defaultDelegate }