From ce4117a3eea95e8518b3ac57eb65417aa300978a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 29 Oct 2021 15:12:16 +0200 Subject: [PATCH] Reset export USB button when re-opening window To do that, I moved the property to track that state to the root of the window. Contributes to issue CURA-8609. --- cura/UltimakerCloud/CloudMaterialSync.py | 1 + .../qml/Preferences/Materials/MaterialsSyncDialog.qml | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cura/UltimakerCloud/CloudMaterialSync.py b/cura/UltimakerCloud/CloudMaterialSync.py index df5730e7c8..f803708a1e 100644 --- a/cura/UltimakerCloud/CloudMaterialSync.py +++ b/cura/UltimakerCloud/CloudMaterialSync.py @@ -56,6 +56,7 @@ class CloudMaterialSync(QObject): return self.sync_all_dialog.setProperty("syncModel", self) self.sync_all_dialog.setProperty("pageIndex", 0) # Return to first page. + self.sync_all_dialog.setProperty("hasExportedUsb", False) # If the user exported USB before, reset that page. self.sync_all_dialog.show() def _showSyncNewMaterialsMessage(self) -> None: diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index 310727ccf0..1f9b5aa513 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -24,6 +24,7 @@ Window property variant syncModel property alias pageIndex: swipeView.currentIndex property alias syncStatusText: syncStatusLabel.text + property bool hasExportedUsb: false SwipeView { @@ -686,10 +687,10 @@ Window anchors.right: parent.right property bool hasExported: false - text: hasExported ? catalog.i18nc("@button", "Done") : catalog.i18nc("@button", "Export material archive") + text: materialsSyncDialog.hasExportedUsb ? catalog.i18nc("@button", "Done") : catalog.i18nc("@button", "Export material archive") onClicked: { - if(!hasExported) + if(!materialsSyncDialog.hasExportedUsb) { exportUsbDialog.folder = syncModel.getPreferredExportAllPath(); exportUsbDialog.open(); @@ -729,7 +730,7 @@ Window { syncModel.exportAll(fileUrl); CuraApplication.setDefaultPath("dialog_material_path", folder); - exportUsbButton.hasExported = true; + materialsSyncDialog.hasExportedUsb = true; } } } \ No newline at end of file