go-deb/stateWindow.go

49 lines
1.0 KiB
Go

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