repostatus/draw.go

49 lines
1.3 KiB
Go
Raw Normal View History

2024-01-09 15:34:53 -06:00
package repostatus
import (
"go.wit.com/log"
"go.wit.com/gui/gadgets"
)
// creates the actual widgets.
// it's assumed you are always passing in a box
func draw(rs *RepoStatus) {
if ! rs.Ready() {return}
rs.group = rs.window.Box().NewGroup("What GO Knows It Has")
rs.grid = rs.group.NewGrid("gridnuts", 2, 2)
rs.grid.SetNext(1,1)
rs.path = gadgets.NewOneLiner(rs.grid, "path")
rs.currentBranch = gadgets.NewOneLiner(rs.grid, "branch")
rs.lasttag = gadgets.NewOneLiner(rs.grid, "last tag")
rs.currentVersion = gadgets.NewOneLiner(rs.grid, "Version")
rs.grid.NewLabel("tags")
rs.tagsDrop = rs.grid.NewDropdown("tags")
rs.masterBranch = gadgets.NewOneLiner(rs.grid, "master")
rs.develBranch = gadgets.NewOneLiner(rs.grid, "devel")
rs.jcarrBranch = gadgets.NewOneLiner(rs.grid, "jcarr")
rs.dirtyLabel = gadgets.NewOneLiner(rs.grid, "dirty")
rs.speed = gadgets.NewOneLiner(rs.grid, "refresh speed =")
rs.speedActual = gadgets.NewOneLiner(rs.grid, "speed actual =")
rs.grid.NewButton("update", func() {
rs.Update()
})
rs.grid.NewButton("recommend", func() {
log.Warn("Is repo dirty?", rs.dirtyLabel.Get())
log.Warn("list the known tags")
rs.populateTags()
log.Warn("Does master == devel? ")
log.Warn("Does devel == jcarr?")
log.Warn("Is repo pushed upstream? git.wit.org or github?")
})
rs.grid.Margin()
rs.grid.Pad()
}