patch window

This commit is contained in:
Jeff Carr 2025-01-20 02:14:08 -06:00
parent 25b2e50f6b
commit d9c4d18b16
4 changed files with 125 additions and 1 deletions

View File

@ -29,6 +29,8 @@ func doGui() {
// debug()
me.patchWin = new(patchesWindow)
me.mainWindow = gadgets.RawBasicWindow("Forge: (this doesn't work yet)")
me.mainWindow.Make()
me.mainWindow.Show()

View File

@ -29,7 +29,8 @@ type mainType struct {
urlbase string // base URL
// our view of the repositories
repos *repoWindow
repos *repoWindow
patchWin *patchesWindow
mainWindow *gadgets.BasicWindow

View File

@ -110,4 +110,13 @@ func globalBuildOptions(vbox *gui.Node) {
// checking this will automatically make the branches off of devel
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
grid.NextRow()
grid.NewButton("patches window", func() {
me.patchWin.once.Do(me.patchWin.initWindow)
me.patchWin.Toggle()
me.patchWin.initGroup()
})
grid.NewButton("hide patches window", func() {
me.patchWin.Hide()
})
}

112
windowNew.go Normal file
View File

@ -0,0 +1,112 @@
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
box *gui.Node
// the top box of the repolist window
topbox *gui.Node
}
func (r *patchesWindow) Hidden() bool {
return r.win.Hidden()
}
func (r *patchesWindow) Toggle() {
if r.Hidden() {
r.Show()
} else {
r.Show()
}
}
func (r *patchesWindow) Show() {
r.win.Show()
}
func (r *patchesWindow) Hide() {
r.win.Hide()
}
func (r *patchesWindow) Disable() {
r.box.Disable()
}
func (r *patchesWindow) Enable() {
r.box.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.box = r.win.Box().NewBox("bw vbox", false)
// me.reposwin.Draw()
r.win.Custom = func() {
log.Warn("Repo Window close. Do something here?")
}
r.topbox = r.initGroup()
}
func (r *patchesWindow) initGroup() *gui.Node {
// reposbox.SetExpand(false)
group1 := r.box.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
}