chore: update the code for design and error checking

This commit is contained in:
DaanSelen
2026-04-01 09:35:43 +02:00
parent 43920472f0
commit 969fc17171
+22 -14
View File
@@ -5,7 +5,6 @@ import (
"fyne.io/fyne/v2" "fyne.io/fyne/v2"
"fyne.io/fyne/v2/container" "fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
runner "patchworks/src/modules/runner" runner "patchworks/src/modules/runner"
@@ -44,10 +43,15 @@ func MakeInput(targEntry *widget.Entry, book *string) *fyne.Container {
bookList, // center fills bookList, // center fills
) )
inputBox := container.NewVBox( inputBox := container.NewBorder(
targetBox, targetBox,
nil, nil, nil,
bookBox, bookBox,
) )
//inputBox := container.NewVBox(
// targetBox,
// bookBox,
//)
//inputBox := container.New( //inputBox := container.New(
// layout.NewGridLayoutWithColumns(2), // layout.NewGridLayoutWithColumns(2),
// targetBox, // column 1 // targetBox, // column 1
@@ -92,26 +96,30 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
go func() { go func() {
ok, result = runner.RunMeshbook(path, *book, targEntry.Text) ok, result = runner.RunMeshbook(path, *book, targEntry.Text)
if !ok { if !ok {
log.Println("assuming failed state")
fyne.CurrentApp().Driver().DoFromGoroutine(func() { fyne.CurrentApp().Driver().DoFromGoroutine(func() {
actionBtn.Importance = widget.DangerImportance actionBtn.Importance = widget.DangerImportance
actionBtn.Refresh() actionBtn.Refresh()
}, true) }, true)
log.Println("something went wrong while running the meshbook, see above for details") } else {
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
textEntry.SetText(result)
actionBtn.Importance = widget.SuccessImportance
actionBtn.Refresh()
showBtn.Enable()
}, true)
} }
log.Println(result)
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
textEntry.SetText(result)
actionBtn.Importance = widget.SuccessImportance
actionBtn.Refresh()
showBtn.Enable()
}, true)
fyne.CurrentApp().Driver().DoFromGoroutine(func() { fyne.CurrentApp().Driver().DoFromGoroutine(func() {
actionBtn.Enable() actionBtn.Enable()
}, true) }, true)
if len(result) > 0 {
log.Println(result)
}
}() }()
}) })
@@ -132,8 +140,8 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
bottomBox := container.NewHBox( bottomBox := container.NewHBox(
actionWrap, // left actionWrap, // left
showWrap, showWrap,
layout.NewSpacer(), // flexible space //layout.NewSpacer(), // flexible space
cancelWrap, // right cancelWrap, // right
) )
return bottomBox return bottomBox
} }