start converting over to using a direct pb grid
This commit is contained in:
parent
efd0373c21
commit
ce938cc73b
23
doGui.go
23
doGui.go
|
@ -370,6 +370,29 @@ func drawWindow(win *gadgets.BasicWindow) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is the magic that generates a window directly from the protocol buffer
|
||||||
|
func makeStandardReposGrid(pb *gitpb.Repos) *gitpb.ReposTable {
|
||||||
|
t := pb.NewTable("testDirty")
|
||||||
|
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
|
||||||
|
return r.GetGoPath()
|
||||||
|
})
|
||||||
|
// t.Custom = func() {
|
||||||
|
// log.Info("close grid?")
|
||||||
|
// }
|
||||||
|
sf.Custom = func(r *gitpb.Repo) {
|
||||||
|
log.Info("do button click on", r.GetGoPath())
|
||||||
|
}
|
||||||
|
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
|
||||||
|
return repo.NewestTime()
|
||||||
|
})
|
||||||
|
t.AddMasterVersion()
|
||||||
|
t.AddDevelVersion()
|
||||||
|
t.AddUserVersion()
|
||||||
|
t.AddCurrentBranchName()
|
||||||
|
t.AddState()
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
// this is the magic that generates a window directly from the protocol buffer
|
// this is the magic that generates a window directly from the protocol buffer
|
||||||
func makeStandardReposWindow(pb *gitpb.Repos) {
|
func makeStandardReposWindow(pb *gitpb.Repos) {
|
||||||
t := pb.NewTable("testDirty")
|
t := pb.NewTable("testDirty")
|
||||||
|
|
|
@ -6,7 +6,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
|
@ -86,46 +85,54 @@ func makeRepoProblemsWindow() *repoProblemsWindow {
|
||||||
found = develBehindMasterProblem()
|
found = develBehindMasterProblem()
|
||||||
txt = fmt.Sprintf("devel is behind master (%d)", found.Len())
|
txt = fmt.Sprintf("devel is behind master (%d)", found.Len())
|
||||||
grid.NewButton(txt, func() {
|
grid.NewButton(txt, func() {
|
||||||
found := develBehindMasterProblem()
|
win := gadgets.RawBasicWindow("devel branches that are out of sync with master")
|
||||||
win := gadgets.RawBasicWindow("pbgrid in window")
|
|
||||||
win.Make()
|
win.Make()
|
||||||
win.Show()
|
win.Show()
|
||||||
box := win.Box().NewBox("bw vbox", false)
|
|
||||||
|
|
||||||
win.Custom = func() {
|
win.Custom = func() {
|
||||||
// sets the hidden flag to false so Toggle() works
|
// sets the hidden flag to false so Toggle() works
|
||||||
win.Hide()
|
win.Hide()
|
||||||
}
|
}
|
||||||
|
box := win.Box().NewBox("bw vbox", false)
|
||||||
|
|
||||||
t := found.NewTable("testDirty")
|
found := develBehindMasterProblem()
|
||||||
|
group := box.NewGroup("test buttons")
|
||||||
|
group.NewButton("hello", func() {
|
||||||
|
log.Info("world")
|
||||||
|
})
|
||||||
|
group.NewButton("list", func() {
|
||||||
|
log.Info("world")
|
||||||
|
})
|
||||||
|
|
||||||
|
t := makeStandardReposGrid(found)
|
||||||
t.SetParent(box)
|
t.SetParent(box)
|
||||||
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
|
|
||||||
return r.GetGoPath()
|
|
||||||
})
|
|
||||||
// t.Custom = func() {
|
|
||||||
// log.Info("close grid?")
|
|
||||||
// }
|
|
||||||
sf.Custom = func(r *gitpb.Repo) {
|
|
||||||
log.Info("do button click on", r.GetGoPath())
|
|
||||||
}
|
|
||||||
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
|
|
||||||
return repo.NewestTime()
|
|
||||||
})
|
|
||||||
t.AddMasterVersion()
|
|
||||||
t.AddDevelVersion()
|
|
||||||
t.AddUserVersion()
|
|
||||||
t.AddCurrentBranchName()
|
|
||||||
t.AddState()
|
|
||||||
t.ShowTable()
|
t.ShowTable()
|
||||||
|
|
||||||
// makeStandardReposWindow(found, box)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
found = remoteUserBranchProblem()
|
found = remoteUserBranchProblem()
|
||||||
txt = fmt.Sprintf("user branch is remote (%d)", found.Len())
|
txt = fmt.Sprintf("user branch is remote (%d)", found.Len())
|
||||||
grid.NewButton(txt, func() {
|
grid.NewButton(txt, func() {
|
||||||
|
win := gadgets.RawBasicWindow("repos that seem to have remote user branches")
|
||||||
|
win.Make()
|
||||||
|
win.Show()
|
||||||
|
win.Custom = func() {
|
||||||
|
// sets the hidden flag to false so Toggle() works
|
||||||
|
win.Hide()
|
||||||
|
}
|
||||||
|
box := win.Box().NewBox("bw vbox", false)
|
||||||
|
|
||||||
found := remoteUserBranchProblem()
|
found := remoteUserBranchProblem()
|
||||||
makeStandardReposWindow(found)
|
group := box.NewGroup("test buttons")
|
||||||
|
group.NewButton("git branch delete", func() {
|
||||||
|
all := found.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
log.Info("git branch -D jcarr", repo.GetGoPath())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t := makeStandardReposGrid(found)
|
||||||
|
t.SetParent(box)
|
||||||
|
t.ShowTable()
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.NewButton("unknown branches", func() {
|
grid.NewButton("unknown branches", func() {
|
||||||
|
|
Loading…
Reference in New Issue