summaryrefslogtreecommitdiff
path: root/doGui.go
blob: 961e2a6d6cb2a3ff19444c1fbd6e8fd6a83d582f (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

import (
	"os"

	"go.wit.com/lib/gadgets"
	"go.wit.com/lib/gui/shell"
	"go.wit.com/log"
)

// An app to submit patches for the 30 GO GUI repos

func doGui() {
	log.Warn("init basicWindow state")
	win := gadgets.RawBasicWindow("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)
	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() {
		readControlFile(me.repo)
	})

	group1.NewButton("write control file", func() {
		writeDebianControlFile(me.repo)
	})

	group1.NewButton("update gui", func() {
		updateControl(cbox)
	})

	group1.NewButton("dump repo.Control", func() {
		// log.Info("CONTROL:", me.repo.Control)
		for v := range me.repo.Control {
			log.Info("CONTROL:", v, me.repo.Control[v])
		}
	})

	group1.NewButton("Make .deb", func() {
		win.Disable()
		if ok, err := buildPackage(me.repo); ok {
			log.Info("build worked")
			os.Exit(0)
		} else {
			log.Warn("build failed", err)
		}
		win.Enable()
	})

	win.Show()
}