go-deb/stateWindow.go

54 lines
1.2 KiB
Go

// This window, when it's hidden, still exists to the application
// so it can be treated as if it really exists
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
func makebasicWindow() *gadgets.BasicWindow {
log.Warn("init basicWindow state")
basicWindow = gadgets.NewBasicWindow(myGui, "Create .deb files for GO applications")
basicWindow.Make()
basicWindow.Custom = func() {
log.Info("got to close")
os.Exit(0)
}
box1 := basicWindow.Box()
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() {
cBox.readControlFile()
})
group1.NewButton("Make .deb", func() {
basicWindow.Disable()
if ok, err := cBox.buildPackage(); ok {
log.Info("build worked")
} else {
log.Warn("build failed", err)
}
basicWindow.Enable()
})
group1.NewButton("open repo", func() {
cBox.status.Update()
cBox.status.Toggle()
})
return basicWindow
}