summaryrefslogtreecommitdiff
path: root/stateWindow.go
blob: 7c4cd83259c301c89c9320e0cf5f1b63d80fa866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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")
			os.Exit(0)
		} else {
			log.Warn("build failed", err)
		}
		basicWindow.Enable()
	})

	group1.NewButton("open repo", func() {
		cBox.status.Update()
		cBox.status.Toggle()
	})

	return basicWindow
}