feat: enable coloring the buttons

This commit is contained in:
DaanSelen
2026-03-31 16:36:41 +02:00
parent 9e09842804
commit 480c386cab
+18 -1
View File
@@ -69,7 +69,13 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
) )
showBtn.Disable() showBtn.Disable()
actionBtn := widget.NewButton("Execute", func() { var actionBtn *widget.Button
actionBtn = widget.NewButton("Execute", func() {
showBtn.Disable()
actionBtn.Importance = widget.HighImportance
actionBtn.Refresh()
log.Println("beginning execution with external binary") log.Println("beginning execution with external binary")
ok, path := runner.FindMeshbookBinary() ok, path := runner.FindMeshbookBinary()
@@ -78,17 +84,28 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
} }
log.Println("kicking off goroutine") log.Println("kicking off goroutine")
actionBtn.Disable()
go func() { go func() {
ok, result = runner.RunMeshbook(path, *book, targEntry.Text) ok, result = runner.RunMeshbook(path, *book, targEntry.Text)
if !ok { if !ok {
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
actionBtn.Importance = widget.DangerImportance
actionBtn.Refresh()
}, true)
log.Println("something went wrong while running the meshbook, see above for details") log.Println("something went wrong while running the meshbook, see above for details")
} }
log.Println(result) log.Println(result)
fyne.CurrentApp().Driver().DoFromGoroutine(func() { fyne.CurrentApp().Driver().DoFromGoroutine(func() {
textEntry.SetText(result) textEntry.SetText(result)
actionBtn.Importance = widget.SuccessImportance
actionBtn.Refresh()
showBtn.Enable() showBtn.Enable()
}, true) }, true)
actionBtn.Enable()
}() }()
}) })