package main import ( "sync" "go.wit.com/lib/gadgets" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" "go.wit.com/gui" ) type patchesWindow struct { once sync.Once win *gadgets.BasicWindow stackBox *gui.Node // the top box of the repolist window shelf *gui.Node } func (r *patchesWindow) Hidden() bool { return r.win.Hidden() } func (r *patchesWindow) Toggle() { if r.Hidden() { r.Show() } else { r.Hide() } } func (r *patchesWindow) Show() { r.win.Show() } func (r *patchesWindow) Hide() { r.win.Hide() } func (r *patchesWindow) Disable() { r.stackBox.Disable() } func (r *patchesWindow) Enable() { r.stackBox.Enable() } // you can only have one of these func (r *patchesWindow) initWindow() { // sync.Once() r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/") r.win.Make() r.stackBox = r.win.Box().NewBox("bw vbox", false) // me.reposwin.Draw() r.win.Custom = func() { log.Warn("Repo Window close. Do something here?") // sets the hidden flag to false so Toggle() works r.win.Hide() } r.shelf = r.initGroup() submitPatchesBox(r.shelf) } func (r *patchesWindow) initGroup() *gui.Node { // reposbox.SetExpand(false) group1 := r.stackBox.NewGroup("Filter:") hbox := group1.Box() // hbox.Horizontal() hbox.Vertical() box2 := hbox.Box().Horizontal() /* */ dirty := box2.NewCheckbox("dirty") dirty.Custom = func() { log.Info("filter dirty =", dirty.Checked()) } box2.NewButton("merge user to devel", func() { r.Disable() defer r.Enable() }) box2.NewButton("test master merge", func() { r.Disable() r.Enable() }) box2.NewButton("show apps", func() { }) box2.NewButton("re-init forge", func() { log.Info("re-scanning now") }) box2.NewButton("ConfigSave()", func() { }) box2.NewButton("Table()", func() { me.found = new(gitpb.Repos) loop := me.forge.Repos.All() for loop.Scan() { repo := loop.Next() me.found.AppendByGoPath(repo) } me.forge.PrintHumanTable(me.found) }) box2.NewButton("Prep for release()", func() { }) return box2 }