diff options
| author | Jeff Carr <[email protected]> | 2025-09-11 15:26:29 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-11 15:26:29 -0500 |
| commit | 6acc0b4f8bd793ae394060981ff10c43eab0bed6 (patch) | |
| tree | 967be85c214f23b5a1fe11533944105d62d6906b /windowControlBox.go | |
| parent | ec661807da8b201cd51e544aee59e8de21aeb0df (diff) | |
mv
Diffstat (limited to 'windowControlBox.go')
| -rw-r--r-- | windowControlBox.go | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/windowControlBox.go b/windowControlBox.go new file mode 100644 index 0000000..c5637a2 --- /dev/null +++ b/windowControlBox.go @@ -0,0 +1,124 @@ +package main + +import ( + "os" + + "go.wit.com/gui" + "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.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) + 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("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() + }) + + return win +} + +// This initializes the control box +func newControl(parent *gui.Node) *controlBox { + var c *controlBox + c = new(controlBox) + c.group = parent.NewGroup("choices") + c.grid = c.group.NewGrid("gridiron", 8, 1) + + c.Package = gadgets.NewOneLiner(c.grid, "Package") + c.grid.NextRow() + + c.Source = gadgets.NewOneLiner(c.grid, "Source") + c.grid.NextRow() + + c.Version = gadgets.NewOneLiner(c.grid, "Version") + c.grid.NextRow() + + c.Architecture = gadgets.NewBasicDropdown(c.grid, "Architecture") + c.Architecture.AddText("all") + c.Architecture.AddText("riscv64") + c.Architecture.AddText("amd64") + c.Architecture.AddText("arm64") + c.Architecture.AddText("ppc64") + c.Architecture.AddText("i386") + c.Architecture.AddText("sparc64") + c.Architecture.AddText("alpha") + c.Architecture.SetText("riscv64") + c.grid.NextRow() + + c.InstallPath = gadgets.NewBasicCombobox(c.grid, "Install Path") + c.InstallPath.AddText("/usr/bin") + c.InstallPath.AddText("/usr/local/bin") + c.InstallPath.AddText("/bin") + c.InstallPath.AddText("/opt/<pkg>/bin") + c.InstallPath.SetText("/usr/bin") + c.grid.NextRow() + + c.Maintainer = gadgets.NewOneLiner(c.grid, "Maintainer") + c.grid.NextRow() + + c.Packager = gadgets.NewBasicEntry(c.grid, "Packager") + c.grid.NextRow() + + c.GoPath = gadgets.NewBasicEntry(c.grid, "GoPath") + c.grid.NextRow() + + c.URL = gadgets.NewBasicEntry(c.grid, "URL") + c.grid.NextRow() + + c.Depends = gadgets.NewOneLiner(c.grid, "Depends") + c.grid.NextRow() + + c.BuildDepends = gadgets.NewOneLiner(c.grid, "Build-Depends") + c.grid.NextRow() + + c.Recommends = gadgets.NewOneLiner(c.grid, "Recommends") + c.grid.NextRow() + + c.Conflicts = gadgets.NewBasicEntry(c.grid, "Conflicts") + c.grid.NextRow() + + c.Description = gadgets.NewOneLiner(c.grid, "Description") + c.grid.NextRow() + + return c +} + +func updateControl(c *controlBox) { + c.URL.SetText(me.repo.URL) +} |
