diff --git a/mainwindow.go b/mainwindow.go index 5c24f1c..65a5885 100644 --- a/mainwindow.go +++ b/mainwindow.go @@ -7,6 +7,7 @@ import ( "strings" qt "github.com/mappu/miqt/qt6" + "github.com/mappu/miqt/qt6/mainthread" bolt "go.etcd.io/bbolt" ) @@ -186,13 +187,17 @@ func (this *MainWindow) onactionExport_database_as_zip_triggered() { return } - err := Bolt_ExportDatabaseToZip(dbPath, zipPath) - if err != nil { - this.alert(fmt.Sprintf("Error exporting database as zip: %s", err.Error())) - return - } + go func() { + err := Bolt_ExportDatabaseToZip(dbPath, zipPath) + mainthread.Start(func() { + if err != nil { + this.alert(fmt.Sprintf("Error exporting database as zip: %s", err.Error())) + return + } - this.alert("Exported as zip successfully.") + this.alert("Exported as zip successfully.") + }) + }() } func (this *MainWindow) onactionCreate_database_from_zip_triggered() { @@ -214,13 +219,17 @@ func (this *MainWindow) onactionCreate_database_from_zip_triggered() { return } - err := Bolt_ImportZipToDatabase(dbPath, zipPath) - if err != nil { - this.alert(fmt.Sprintf("Error importing database from zip %q: %s", zipPath, err.Error())) - return - } + go func() { + err := Bolt_ImportZipToDatabase(dbPath, zipPath) + mainthread.Start(func() { + if err != nil { + this.alert(fmt.Sprintf("Error importing database from zip %q: %s", zipPath, err.Error())) + return + } - this.alert("Imported zip to database successfully.") + this.alert("Imported zip to database successfully.") + }) + }() } func (this *MainWindow) refreshBucketTree(itm *qt.QTreeWidgetItem) {