diff options
-rw-r--r-- | cmd/rescribe/gui.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/rescribe/gui.go b/cmd/rescribe/gui.go index f4ac9bd..d5a132f 100644 --- a/cmd/rescribe/gui.go +++ b/cmd/rescribe/gui.go @@ -281,7 +281,6 @@ func startGui(log log.Logger, cmd string, training string, tessdir string) error fmt.Printf("\nAbort\n") cancel() progressBar.SetValue(0.0) - gobtn.SetText("Process OCR") for _, v := range []fyne.Disableable{folderBtn, pdfBtn, gbookBtn, trainingOpts, gobtn} { v.Enable() } @@ -361,7 +360,6 @@ func startGui(log log.Logger, cmd string, training string, tessdir string) error fmt.Fprintf(os.Stderr, msg) progressBar.SetValue(0.0) - gobtn.SetText("Process OCR") for _, v := range []fyne.Disableable{folderBtn, pdfBtn, gbookBtn, trainingOpts, gobtn} { v.Enable() } @@ -388,8 +386,9 @@ func startGui(log log.Logger, cmd string, training string, tessdir string) error fmt.Fprintf(os.Stderr, msg) } + cancel() + ctx, cancel = context.WithCancel(context.Background()) progressBar.SetValue(0.0) - gobtn.SetText("Process OCR") for _, v := range []fyne.Disableable{folderBtn, pdfBtn, gbookBtn, trainingOpts, gobtn} { v.Enable() } @@ -404,8 +403,9 @@ func startGui(log log.Logger, cmd string, training string, tessdir string) error dialog.ShowError(errors.New(msg), myWindow) fmt.Fprintf(os.Stderr, msg) + cancel() + ctx, cancel = context.WithCancel(context.Background()) progressBar.SetValue(0.0) - gobtn.SetText("Process OCR") for _, v := range []fyne.Disableable{folderBtn, pdfBtn, gbookBtn, trainingOpts, gobtn} { v.Enable() } @@ -430,12 +430,13 @@ func startGui(log log.Logger, cmd string, training string, tessdir string) error return } if err != nil { + cancel() + ctx, cancel = context.WithCancel(context.Background()) msg := fmt.Sprintf("Error during processing: %v\n", err) dialog.ShowError(errors.New(msg), myWindow) fmt.Fprintf(os.Stderr, msg) progressBar.SetValue(0.0) - gobtn.SetText("Process OCR") for _, v := range []fyne.Disableable{folderBtn, pdfBtn, gbookBtn, trainingOpts, gobtn} { v.Enable() } @@ -444,7 +445,6 @@ func startGui(log log.Logger, cmd string, training string, tessdir string) error } progressBar.SetValue(1.0) - gobtn.SetText("Process OCR") for _, v := range []fyne.Disableable{folderBtn, pdfBtn, gbookBtn, trainingOpts, gobtn} { v.Enable() |