2024-01-09 01:16:00 -06:00
|
|
|
// This is a simple example
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-09 02:00:51 -06:00
|
|
|
"go.wit.com/log"
|
|
|
|
|
2024-01-09 01:16:00 -06:00
|
|
|
"go.wit.com/gui/gui"
|
|
|
|
"go.wit.com/gui/gadgets"
|
|
|
|
"go.wit.com/apps/control-panel-dns/smartwindow"
|
|
|
|
)
|
|
|
|
|
|
|
|
var myGui *gui.Node
|
|
|
|
|
2024-01-09 02:22:01 -06:00
|
|
|
var allrepos []*repo
|
|
|
|
|
|
|
|
type repo struct {
|
|
|
|
path string
|
2024-01-09 08:35:07 -06:00
|
|
|
lasttagrev string
|
|
|
|
lasttag string
|
|
|
|
tags []string
|
2024-01-09 02:22:01 -06:00
|
|
|
|
|
|
|
pLabel *gui.Node // path label
|
|
|
|
bLabel *gui.Node // branch label
|
2024-01-09 08:35:07 -06:00
|
|
|
lastLabel *gui.Node // last tagged version label
|
2024-01-09 02:22:01 -06:00
|
|
|
vLabel *gui.Node // version label
|
2024-01-09 08:41:32 -06:00
|
|
|
tagsDrop *gui.Node // list of all tags
|
2024-01-09 09:56:33 -06:00
|
|
|
dirtyLabel *gui.Node // git state (dirty or not?)
|
|
|
|
|
|
|
|
masterVersion *gui.Node // the master branch version
|
|
|
|
develVersion *gui.Node // the devel branch version
|
|
|
|
jcarrVersion *gui.Node // the jcarr branch version
|
2024-01-09 02:22:01 -06:00
|
|
|
|
|
|
|
cButton *gui.Node // commit button
|
|
|
|
pButton *gui.Node // push button
|
|
|
|
}
|
|
|
|
|
2024-01-09 01:16:00 -06:00
|
|
|
func main() {
|
|
|
|
myGui = gui.New().Default()
|
|
|
|
|
|
|
|
helloworld()
|
2024-01-09 09:56:33 -06:00
|
|
|
checkrepos()
|
|
|
|
for _, r := range allrepos {
|
|
|
|
r.checkoutBranch("master")
|
|
|
|
r.checkoutBranch("devel")
|
|
|
|
r.checkoutBranch("jcarr")
|
|
|
|
}
|
2024-01-09 01:16:00 -06:00
|
|
|
gui.Watchdog()
|
|
|
|
}
|
|
|
|
|
2024-01-09 02:22:01 -06:00
|
|
|
func addRepo(grid *gui.Node, path string) *repo {
|
|
|
|
newRepo := new(repo)
|
|
|
|
|
|
|
|
newRepo.path = path
|
|
|
|
newRepo.pLabel = grid.NewLabel(path)
|
2024-01-09 08:35:07 -06:00
|
|
|
newRepo.bLabel = grid.NewLabel("")
|
|
|
|
newRepo.lastLabel = grid.NewLabel("")
|
2024-01-09 08:41:32 -06:00
|
|
|
newRepo.tagsDrop = grid.NewDropdown("tags")
|
2024-01-09 08:35:07 -06:00
|
|
|
newRepo.vLabel = grid.NewLabel("")
|
2024-01-09 09:56:33 -06:00
|
|
|
|
|
|
|
newRepo.masterVersion = grid.NewLabel("")
|
|
|
|
newRepo.develVersion = grid.NewLabel("")
|
|
|
|
newRepo.jcarrVersion = grid.NewLabel("")
|
|
|
|
newRepo.dirtyLabel = grid.NewLabel("")
|
2024-01-09 02:22:01 -06:00
|
|
|
|
|
|
|
newRepo.cButton = grid.NewButton("commit", func () {
|
|
|
|
log.Println("commit")
|
2024-01-09 02:00:51 -06:00
|
|
|
})
|
2024-01-09 08:35:07 -06:00
|
|
|
newRepo.pButton = grid.NewButton("push", func () {
|
2024-01-09 02:22:01 -06:00
|
|
|
log.Println("push")
|
2024-01-09 02:00:51 -06:00
|
|
|
})
|
2024-01-09 08:35:07 -06:00
|
|
|
if path == "" { return newRepo }
|
2024-01-09 02:22:01 -06:00
|
|
|
allrepos = append(allrepos, newRepo)
|
|
|
|
return newRepo
|
2024-01-09 02:00:51 -06:00
|
|
|
}
|
|
|
|
|
2024-01-09 01:16:00 -06:00
|
|
|
// This creates a window
|
|
|
|
func helloworld() {
|
|
|
|
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
|
|
|
|
|
2024-01-09 02:00:51 -06:00
|
|
|
box := win.Box().NewBox("bw vbox", false)
|
2024-01-09 09:35:54 -06:00
|
|
|
box2 := win.Box().NewBox("bw vbox", false)
|
2024-01-09 02:00:51 -06:00
|
|
|
group := box.NewGroup("test")
|
2024-01-09 09:56:33 -06:00
|
|
|
grid := group.NewGrid("test", 11, 1)
|
2024-01-09 02:00:51 -06:00
|
|
|
|
2024-01-09 08:35:07 -06:00
|
|
|
grid.NewLabel("go repo")
|
|
|
|
grid.NewLabel("branch")
|
|
|
|
grid.NewLabel("last tag")
|
2024-01-09 02:00:51 -06:00
|
|
|
grid.NewLabel("Version")
|
2024-01-09 09:56:33 -06:00
|
|
|
grid.NewLabel("tags")
|
|
|
|
grid.NewLabel("master")
|
|
|
|
grid.NewLabel("devel")
|
|
|
|
grid.NewLabel("jcarr")
|
2024-01-09 02:00:51 -06:00
|
|
|
grid.NewLabel("is dirty?")
|
|
|
|
grid.NewLabel("commit")
|
|
|
|
grid.NewLabel("push to")
|
|
|
|
|
2024-01-09 08:35:07 -06:00
|
|
|
addRepo(grid, "go.wit.com/log")
|
2024-01-09 02:00:51 -06:00
|
|
|
addRepo(grid, "go.wit.com/arg")
|
|
|
|
addRepo(grid, "go.wit.com/spew")
|
|
|
|
addRepo(grid, "go.wit.com/shell")
|
|
|
|
addRepo(grid, "")
|
2024-01-09 08:35:07 -06:00
|
|
|
addRepo(grid, "go.wit.com/gui/gui")
|
|
|
|
addRepo(grid, "go.wit.com/gui/widget")
|
|
|
|
addRepo(grid, "go.wit.com/gui/toolkits")
|
|
|
|
addRepo(grid, "go.wit.com/gui/debugger")
|
2024-01-09 02:00:51 -06:00
|
|
|
addRepo(grid, "go.wit.com/gui/gadgets")
|
2024-01-09 08:35:07 -06:00
|
|
|
addRepo(grid, "go.wit.com/gui/digitalocean")
|
|
|
|
addRepo(grid, "go.wit.com/gui/cloudflare")
|
2024-01-09 02:00:51 -06:00
|
|
|
|
2024-01-09 09:35:54 -06:00
|
|
|
box2.NewButton("checkout jcarr (all repos)", func () {
|
|
|
|
for _, r := range allrepos {
|
|
|
|
r.checkoutBranch("jcarr")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
box2.NewButton("checkout devel (all repos)", func () {
|
|
|
|
for _, r := range allrepos {
|
|
|
|
r.checkoutBranch("devel")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
box2.NewButton("checkout master (all repos)", func () {
|
|
|
|
for _, r := range allrepos {
|
|
|
|
r.checkoutBranch("master")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
box2.NewButton("hello", func () {
|
2024-01-09 01:16:00 -06:00
|
|
|
log.Println("world")
|
|
|
|
hellosmart()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// This creates a window
|
|
|
|
func hellosmart() {
|
|
|
|
win := smartwindow.New()
|
|
|
|
win.SetParent(myGui)
|
|
|
|
win.InitWindow()
|
|
|
|
win.Title("helloworld golang wit/gui window")
|
|
|
|
win.Vertical()
|
|
|
|
win.SetDraw(smartDraw)
|
|
|
|
win.Make()
|
|
|
|
|
2024-01-09 02:00:51 -06:00
|
|
|
win.Box().NewButton("test smartwindow", func () {
|
2024-01-09 01:16:00 -06:00
|
|
|
log.Println("smart")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func smartDraw(sw *smartwindow.SmartWindow) {
|
|
|
|
sw.Box().NewButton("hello", func () {
|
|
|
|
log.Println("smart")
|
|
|
|
})
|
|
|
|
}
|