diff options
Diffstat (limited to 'windowReposNew.go')
| -rw-r--r-- | windowReposNew.go | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/windowReposNew.go b/windowReposNew.go index 0b7a969..994374c 100644 --- a/windowReposNew.go +++ b/windowReposNew.go @@ -7,6 +7,7 @@ package main import ( "sync" + "time" "go.wit.com/gui" "go.wit.com/lib/gadgets" @@ -63,7 +64,7 @@ func makeReposWinNew() *gadgets.GenericWindow { log.Info("table has uuid", t.GetUuid()) }) - grid.NewButton("writeable", func() { + grid.NewButton("with patches", func() { if t != nil { t.Delete() t = nil @@ -75,9 +76,55 @@ func makeReposWinNew() *gadgets.GenericWindow { if me.forge.Config.IsReadOnly(repo.GetGoPath()) { continue } + found.AppendByGoPath(repo) + } + // make the window for the first time + t = addWindowPB(insertWin, found) + f := func(repo *gitpb.Repo) { + log.Info("got to ReposTable.Custom() id =", repo.GetGoPath(), repo.GetCurrentVersion()) + } + t.Custom(f) + log.Info("table has uuid", t.GetUuid()) + }) + + grid.NewButton("favorites", func() { + if t != nil { + t.Delete() + t = nil + } + found := new(gitpb.Repos) + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + if !me.forge.Config.IsFavorite(repo.GetGoPath()) { + continue + } found.AppendByGoPath(repo) + } + + // make the window for the first time + t = addWindowPB(insertWin, found) + f := func(repo *gitpb.Repo) { + log.Info("got to ReposTable.Custom() id =", repo.GetGoPath(), repo.GetCurrentVersion()) + } + t.Custom(f) + log.Info("table has uuid", t.GetUuid()) + }) + grid.NewButton("writeable", func() { + if t != nil { + t.Delete() + t = nil + } + found := new(gitpb.Repos) + all := me.forge.Repos.SortByFullPath() + for all.Scan() { + repo := all.Next() + if me.forge.Config.IsReadOnly(repo.GetGoPath()) { + continue + } + found.AppendByGoPath(repo) } // make the window for the first time @@ -112,3 +159,34 @@ func makeReposWinNew() *gadgets.GenericWindow { return insertWin } + +func addWindowPB(win *gadgets.GenericWindow, pb *gitpb.Repos) *gitpb.ReposTable { + t := pb.NewTable("testForgeRepos") + t.NewUuid() + tbox := win.Bottom.Box().SetProgName("TBOX") + t.SetParent(tbox) + + sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string { + return r.GetGoPath() + }) + 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() + // hmm := t.AddMasterVersion() + // hmm.SetTitle("Master") + t.AddDevelVersion() + t.AddUserVersion() + t.AddCurrentBranchName() + t.AddState() + f := func(repo *gitpb.Repo) string { + log.Info("repo =", repo.GetGoPath(), repo.GetCurrentVersion()) + return repo.GetGoPath() + } + t.AddButtonFunc("cur version", f) + t.ShowTable() + return t +} |
