diff --git a/cura/UI/AddPrinterPagesModel.py b/cura/UI/AddPrinterPagesModel.py index 55bb1500ba..d40da59b2a 100644 --- a/cura/UI/AddPrinterPagesModel.py +++ b/cura/UI/AddPrinterPagesModel.py @@ -15,6 +15,7 @@ class AddPrinterPagesModel(WelcomePagesModel): "page_url": self._getBuiltinWelcomePagePath("AddNetworkOrLocalPrinterContent.qml"), "next_page_id": "machine_actions", "next_page_button_text": self._catalog.i18nc("@action:button", "Add"), + "previous_page_button_text": self._catalog.i18nc("@action:button", "Cancel"), }) self._pages.append({"id": "add_printer_by_ip", "page_url": self._getBuiltinWelcomePagePath("AddPrinterByIpContent.qml"), diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 10ae9dabf5..c16ec3763e 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -39,6 +39,7 @@ class WelcomePagesModel(ListModel): PageUrlRole = Qt.UserRole + 2 # URL to the page's QML file NextPageIdRole = Qt.UserRole + 3 # The next page ID it should go to NextPageButtonTextRole = Qt.UserRole + 4 # The text for the next page button + PreviousPageButtonTextRole = Qt.UserRole + 5 # The text for the previous page button def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None: super().__init__(parent) @@ -47,6 +48,7 @@ class WelcomePagesModel(ListModel): self.addRoleName(self.PageUrlRole, "page_url") self.addRoleName(self.NextPageIdRole, "next_page_id") self.addRoleName(self.NextPageButtonTextRole, "next_page_button_text") + self.addRoleName(self.PreviousPageButtonTextRole, "previous_page_button_text") self._application = application self._catalog = i18nCatalog("cura") diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index b6d62ec3f0..ab02887774 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -795,7 +795,6 @@ UM.MainWindow title: catalog.i18nc("@title:window", "Add Printer") model: CuraApplication.getAddPrinterPagesModel() progressBarVisible: false - hasCancelButton: true } Cura.WizardDialog @@ -804,7 +803,6 @@ UM.MainWindow title: catalog.i18nc("@title:window", "What's New") model: CuraApplication.getWhatsNewPagesModel() progressBarVisible: false - hasCancelButton: false } Connections diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index 6037868aaa..7ef1941b87 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -104,6 +104,20 @@ Item } } + // This "Back" button only shows in the "Add Machine" dialog, which has "back_button_text" set to "Cancel" + Cura.SecondaryButton + { + id: backButton + anchors.left: parent.left + anchors.bottom: parent.bottom + visible: base.currentItem.previous_page_button_text + text: base.currentItem.previous_page_button_text + onClicked: + { + base.endWizard() + } + } + Cura.PrimaryButton { id: nextButton diff --git a/resources/qml/WelcomePages/WizardDialog.qml b/resources/qml/WelcomePages/WizardDialog.qml index 31240b1ef5..c81f9daff0 100644 --- a/resources/qml/WelcomePages/WizardDialog.qml +++ b/resources/qml/WelcomePages/WizardDialog.qml @@ -31,7 +31,6 @@ Window property var model: null // Needs to be set by whoever is using this dialog. property alias progressBarVisible: wizardPanel.progressBarVisible - property alias hasCancelButton: cancelButton.visible onVisibilityChanged: { @@ -54,20 +53,4 @@ Window target: model onAllFinished: dialog.hide() } - - Cura.SecondaryButton - { - id: cancelButton - - text: catalog.i18nc("@button", "Cancel") - - visible: false - - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.margins: UM.Theme.getSize("default_margin").width - - enabled: true - onClicked: dialog.visible = false - } }