margin works

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-14 10:36:46 -06:00
parent 85d74dd70d
commit 269490693e
2 changed files with 32 additions and 34 deletions

50
main.go
View File

@ -75,27 +75,25 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
// This creates a window // This creates a window
func repoworld() { func repoworld() {
win := gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.") reposwin = gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.")
win.Make() reposwin.Make()
box := win.Box().NewBox("bw vbox", false) reposbox = reposwin.Box().NewBox("bw vbox", false)
// box2 := win.Box().NewBox("bw vbox", false) reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
group := box.NewGroup("go repositories (read from ~/.config/myrepolist)") reposgrid = reposgroup.NewGrid("test", 11, 1)
grid := group.NewGrid("test", 11, 1)
grid.Margin()
grid.NewLabel("") reposgrid.NewLabel("")
grid.NewLabel("branch") reposgrid.NewLabel("branch")
grid.NewLabel("last tag") reposgrid.NewLabel("last tag")
grid.NewLabel("Current Version") reposgrid.NewLabel("Current Version")
// grid.NewLabel("tags") // reposgrid.NewLabel("tags")
grid.NewLabel("master") reposgrid.NewLabel("master")
grid.NewLabel("devel") reposgrid.NewLabel("devel")
grid.NewLabel("user") reposgrid.NewLabel("user")
grid.NewLabel("Status") reposgrid.NewLabel("Status")
grid.NewLabel("commit") reposgrid.NewLabel("commit")
grid.NewLabel("Toggle()") reposgrid.NewLabel("Toggle()")
grid.NewLabel("Draw()") reposgrid.NewLabel("Draw()")
repos := myrepolist() repos := myrepolist()
for _, line := range repos { for _, line := range repos {
@ -105,13 +103,15 @@ func repoworld() {
if dbranch == "" { dbranch = "devel" } if dbranch == "" { dbranch = "devel" }
usr, _ := user.Current() usr, _ := user.Current()
if ubranch == "" { ubranch = usr.Username } if ubranch == "" { ubranch = usr.Username }
addRepo(grid, path, mbranch, dbranch, ubranch) addRepo(reposgrid, path, mbranch, dbranch, ubranch)
} }
box2 := win.Box().NewBox("bw vbox", false) box2 := reposwin.Box().NewBox("bw vbox", false)
box2.NewButton("grid.Margin()", func () { box2.NewButton("reposgrid.Margin()", func () {
grid.Margin() log.Warn("reposgrid.Margin() RUN NOW")
grid.Pad() reposgrid.Margin()
log.Warn("reposgrid.Pad() RUN NOW")
reposgrid.Pad()
}) })
box2.NewButton("status.Update() all", func () { box2.NewButton("status.Update() all", func () {
@ -126,5 +126,5 @@ func repoworld() {
} }
}) })
win.Draw() reposwin.Draw()
} }

View File

@ -1,20 +1,18 @@
// This is a simple example // watch all your go git repos
package main package main
import ( import (
// "os/user"
// "io/ioutil"
// "strings"
// "go.wit.com/log"
"go.wit.com/gui/gui" "go.wit.com/gui/gui"
// "go.wit.com/gui/gadgets" "go.wit.com/gui/gadgets"
"go.wit.com/gui/gadgets/repostatus" "go.wit.com/gui/gadgets/repostatus"
// "go.wit.com/apps/control-panel-dns/smartwindow"
) )
// the main window nodes
var myGui *gui.Node var myGui *gui.Node
var reposwin *gadgets.BasicWindow
var reposbox *gui.Node
var reposgrid *gui.Node
var reposgroup *gui.Node
var allrepos []*repo var allrepos []*repo