chore: update code to basic functionality

This commit is contained in:
DaanSelen
2026-03-31 13:26:14 +02:00
parent ae7d816f8f
commit 31d3ee8886
3 changed files with 31 additions and 9 deletions
+1
View File
@@ -5,4 +5,5 @@ import "fyne.io/fyne/v2"
var ( var (
entrySize fyne.Size = fyne.NewSize(300, 50) entrySize fyne.Size = fyne.NewSize(300, 50)
buttonSize fyne.Size = fyne.NewSize(250, 50) buttonSize fyne.Size = fyne.NewSize(250, 50)
windowSize fyne.Size = fyne.NewSize(1280, 720)
) )
+24 -3
View File
@@ -53,6 +53,26 @@ func MakeInput(targEntry *widget.Entry, book *string) *fyne.Container {
} }
func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Container { func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Container {
var result string
showBtn := widget.NewButton("Show Results", func() {
log.Println("showing output")
w := app.NewWindow("Result Display")
w.Resize(windowSize)
textEntry := widget.NewMultiLineEntry()
textEntry.SetText(result)
w.SetContent(container.NewScroll(textEntry))
w.Show()
})
showWrap := container.NewGridWrap(
buttonSize,
showBtn,
)
showBtn.Disable()
actionBtn := widget.NewButton("Execute", func() { actionBtn := widget.NewButton("Execute", func() {
log.Println("beginning execution with external binary") log.Println("beginning execution with external binary")
@@ -60,11 +80,11 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
if !ok { if !ok {
log.Println("something went wrong while looking for the binary, see above for details") log.Println("something went wrong while looking for the binary, see above for details")
} }
ok, result := runner.RunMeshbook(path, *book, targEntry.Text) ok, result = runner.RunMeshbook(path, *book, targEntry.Text)
if !ok { if !ok {
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) showBtn.Enable()
}) })
actionWrap := container.NewGridWrap( actionWrap := container.NewGridWrap(
@@ -82,7 +102,8 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
) )
bottomBox := container.NewHBox( bottomBox := container.NewHBox(
actionWrap, // left actionWrap, // left
showWrap,
layout.NewSpacer(), // flexible space layout.NewSpacer(), // flexible space
cancelWrap, // right cancelWrap, // right
) )
+6 -6
View File
@@ -37,6 +37,7 @@ func FindMeshbookBinary() (bool, string) {
if binaryFound { if binaryFound {
return true, binaryPath return true, binaryPath
} else { } else {
log.Println("binary not found!")
return false, "" return false, ""
} }
} }
@@ -46,18 +47,17 @@ func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
if len(bookPath) == 0 { if len(bookPath) == 0 {
args = []string{"--help"} args = []string{"--help"}
} else { } else {
args = []string{"--nograce", "-mb", bookPath, "--group", targGroup} args = []string{"--nograce", "--silent", "-mb", bookPath, "--group", targGroup}
} }
log.Printf("running with parameters: %v", args) log.Printf("running with parameters: %v", args)
cmd := exec.Command(binPath, args...) cmd := exec.Command(binPath, args...)
cOut, err := cmd.CombinedOutput() outputData, err := cmd.CombinedOutput()
if err != nil { if err != nil {
log.Printf("something went wrong when running the command: %v", err) log.Printf("something went wrong when running the command: %v", err)
log.Printf("captured output: %s", string(cOut)) log.Printf("captured output: %s", string(outputData))
return false, "" return false, string(outputData)
} }
log.Printf("captured output: %s", string(cOut)) return true, string(outputData)
return true, ""
} }