go-deb/stateWindow.go

49 lines
1.0 KiB
Go
Raw Permalink Normal View History

2024-02-11 01:00:05 -06:00
package main
import (
"os"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/shell"
2024-02-11 01:00:05 -06:00
"go.wit.com/log"
)
// This initializes the first window, a group and a button
2025-01-18 07:29:44 -06:00
// this is terribly old code. redo this all after widgets are switched to protobuf
2024-02-11 01:00:05 -06:00
func makebasicWindow() *gadgets.BasicWindow {
log.Warn("init basicWindow state")
2025-01-18 07:29:44 -06:00
win := gadgets.NewBasicWindow(me.myGui, "Create .deb files for GO applications")
win.Make()
win.Custom = func() {
2024-02-11 01:00:05 -06:00
log.Info("got to close")
os.Exit(0)
}
2025-01-18 07:29:44 -06:00
box1 := win.Box()
me.cBox = newControl(box1)
2024-02-11 01:00:05 -06:00
vbox := box1.Box().Horizontal()
group1 := vbox.NewGroup("controls").Horizontal() // Vertical()
2024-02-11 01:00:05 -06:00
group1.NewButton("go build", func() {
shell.Run([]string{"go", "build", "-v", "-x"})
})
group1.NewButton("read control file", func() {
2025-01-18 07:29:44 -06:00
me.cBox.readControlFile()
2024-02-11 01:00:05 -06:00
})
2024-02-11 01:00:05 -06:00
group1.NewButton("Make .deb", func() {
2025-01-18 07:29:44 -06:00
win.Disable()
if ok, err := me.cBox.buildPackage(); ok {
log.Info("build worked")
2024-11-16 09:49:49 -06:00
os.Exit(0)
} else {
2024-03-01 07:44:02 -06:00
log.Warn("build failed", err)
}
2025-01-18 07:29:44 -06:00
win.Enable()
2024-02-11 01:00:05 -06:00
})
2025-01-18 07:29:44 -06:00
return win
2024-02-11 01:00:05 -06:00
}