import/export: use background thread
This commit is contained in:
parent
0ad7c03db0
commit
1725de6ace
@ -7,6 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
qt "github.com/mappu/miqt/qt6"
|
qt "github.com/mappu/miqt/qt6"
|
||||||
|
"github.com/mappu/miqt/qt6/mainthread"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -186,13 +187,17 @@ func (this *MainWindow) onactionExport_database_as_zip_triggered() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := Bolt_ExportDatabaseToZip(dbPath, zipPath)
|
go func() {
|
||||||
if err != nil {
|
err := Bolt_ExportDatabaseToZip(dbPath, zipPath)
|
||||||
this.alert(fmt.Sprintf("Error exporting database as zip: %s", err.Error()))
|
mainthread.Start(func() {
|
||||||
return
|
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() {
|
func (this *MainWindow) onactionCreate_database_from_zip_triggered() {
|
||||||
@ -214,13 +219,17 @@ func (this *MainWindow) onactionCreate_database_from_zip_triggered() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := Bolt_ImportZipToDatabase(dbPath, zipPath)
|
go func() {
|
||||||
if err != nil {
|
err := Bolt_ImportZipToDatabase(dbPath, zipPath)
|
||||||
this.alert(fmt.Sprintf("Error importing database from zip %q: %s", zipPath, err.Error()))
|
mainthread.Start(func() {
|
||||||
return
|
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) {
|
func (this *MainWindow) refreshBucketTree(itm *qt.QTreeWidgetItem) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user