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.
This commit is contained in:
Ghostkeeper 2021-10-29 15:12:16 +02:00
parent c58d03ad4c
commit ce4117a3ee
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A
2 changed files with 5 additions and 3 deletions

View File

@ -56,6 +56,7 @@ class CloudMaterialSync(QObject):
return return
self.sync_all_dialog.setProperty("syncModel", self) self.sync_all_dialog.setProperty("syncModel", self)
self.sync_all_dialog.setProperty("pageIndex", 0) # Return to first page. 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() self.sync_all_dialog.show()
def _showSyncNewMaterialsMessage(self) -> None: def _showSyncNewMaterialsMessage(self) -> None:

View File

@ -24,6 +24,7 @@ Window
property variant syncModel property variant syncModel
property alias pageIndex: swipeView.currentIndex property alias pageIndex: swipeView.currentIndex
property alias syncStatusText: syncStatusLabel.text property alias syncStatusText: syncStatusLabel.text
property bool hasExportedUsb: false
SwipeView SwipeView
{ {
@ -686,10 +687,10 @@ Window
anchors.right: parent.right anchors.right: parent.right
property bool hasExported: false 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: onClicked:
{ {
if(!hasExported) if(!materialsSyncDialog.hasExportedUsb)
{ {
exportUsbDialog.folder = syncModel.getPreferredExportAllPath(); exportUsbDialog.folder = syncModel.getPreferredExportAllPath();
exportUsbDialog.open(); exportUsbDialog.open();
@ -729,7 +730,7 @@ Window
{ {
syncModel.exportAll(fileUrl); syncModel.exportAll(fileUrl);
CuraApplication.setDefaultPath("dialog_material_path", folder); CuraApplication.setDefaultPath("dialog_material_path", folder);
exportUsbButton.hasExported = true; materialsSyncDialog.hasExportedUsb = true;
} }
} }
} }