mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-16 07:40:44 -07:00
fix(ui): app should redraw in Goroutine
If error occurs when playing TTS, SetText would be called. But it's in Goroutine, so we need to call app.Draw to redraw the screen.
This commit is contained in:
parent
837196dbd4
commit
2d2834c6da
2
ui.go
2
ui.go
@ -510,6 +510,7 @@ func translateWindowHandler(event *tcell.EventKey) *tcell.EventKey {
|
||||
err := translator.PlayTTS(translator.GetSrcLang(), message)
|
||||
if err != nil {
|
||||
srcInput.SetText(err.Error(), true)
|
||||
app.Draw()
|
||||
}
|
||||
}()
|
||||
}
|
||||
@ -526,6 +527,7 @@ func translateWindowHandler(event *tcell.EventKey) *tcell.EventKey {
|
||||
err := translator.PlayTTS(translator.GetDstLang(), message)
|
||||
if err != nil {
|
||||
dstOutput.SetText(err.Error())
|
||||
app.Draw()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user