gui testing and cleanups

This commit is contained in:
Jeff Carr 2025-01-20 02:30:31 -06:00
parent d9c4d18b16
commit 6cee7c5420
5 changed files with 29 additions and 25 deletions

View File

@ -31,7 +31,7 @@ func doGui() {
me.patchWin = new(patchesWindow) me.patchWin = new(patchesWindow)
me.mainWindow = gadgets.RawBasicWindow("Forge: (this doesn't work yet)") me.mainWindow = gadgets.RawBasicWindow("Forge: (this kinda works sometimes)")
me.mainWindow.Make() me.mainWindow.Make()
me.mainWindow.Show() me.mainWindow.Show()
me.mainWindow.Custom = func() { me.mainWindow.Custom = func() {

View File

@ -111,12 +111,21 @@ func globalBuildOptions(vbox *gui.Node) {
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
grid.NextRow() grid.NextRow()
grid.NewButton("Show Repos", func() {
if me.repos.Hidden() {
me.repos.Show()
} else {
me.repos.Hide()
}
})
grid.NewButton("patches window", func() { grid.NewButton("patches window", func() {
me.patchWin.once.Do(me.patchWin.initWindow) me.patchWin.once.Do(me.patchWin.initWindow)
me.patchWin.Toggle() me.patchWin.Toggle()
})
grid.NewButton("update patch summary", func() {
me.summary.Update()
})
grid.NewButton("test add", func() {
me.patchWin.initGroup() me.patchWin.initGroup()
}) })
grid.NewButton("hide patches window", func() {
me.patchWin.Hide()
})
} }

View File

@ -11,12 +11,12 @@ import (
) )
type patchesWindow struct { type patchesWindow struct {
once sync.Once once sync.Once
win *gadgets.BasicWindow win *gadgets.BasicWindow
box *gui.Node stackBox *gui.Node
// the top box of the repolist window // the top box of the repolist window
topbox *gui.Node shelf *gui.Node
} }
func (r *patchesWindow) Hidden() bool { func (r *patchesWindow) Hidden() bool {
@ -27,7 +27,7 @@ func (r *patchesWindow) Toggle() {
if r.Hidden() { if r.Hidden() {
r.Show() r.Show()
} else { } else {
r.Show() r.Hide()
} }
} }
@ -40,11 +40,11 @@ func (r *patchesWindow) Hide() {
} }
func (r *patchesWindow) Disable() { func (r *patchesWindow) Disable() {
r.box.Disable() r.stackBox.Disable()
} }
func (r *patchesWindow) Enable() { func (r *patchesWindow) Enable() {
r.box.Enable() r.stackBox.Enable()
} }
// you can only have one of these // you can only have one of these
@ -53,18 +53,21 @@ func (r *patchesWindow) initWindow() {
r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/") r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/")
r.win.Make() r.win.Make()
r.box = r.win.Box().NewBox("bw vbox", false) r.stackBox = r.win.Box().NewBox("bw vbox", false)
// me.reposwin.Draw() // me.reposwin.Draw()
r.win.Custom = func() { r.win.Custom = func() {
log.Warn("Repo Window close. Do something here?") log.Warn("Repo Window close. Do something here?")
// sets the hidden flag to false so Toggle() works
r.win.Hide()
} }
r.topbox = r.initGroup() r.shelf = r.initGroup()
submitPatchesBox(r.shelf)
} }
func (r *patchesWindow) initGroup() *gui.Node { func (r *patchesWindow) initGroup() *gui.Node {
// reposbox.SetExpand(false) // reposbox.SetExpand(false)
group1 := r.box.NewGroup("Filter:") group1 := r.stackBox.NewGroup("Filter:")
hbox := group1.Box() hbox := group1.Box()
// hbox.Horizontal() // hbox.Horizontal()

View File

@ -116,20 +116,10 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
applyPatchset(pset) applyPatchset(pset)
}) })
s.grid.NewButton("Show Repos", func() {
s.Update()
if me.repos.Hidden() {
me.repos.Show()
} else {
me.repos.Hide()
}
})
// disable these until there are not dirty repos // disable these until there are not dirty repos
// s.reason.Disable() // s.reason.Disable()
s.submitB.Disable() s.submitB.Disable()
s.grid.NextRow() s.grid.NextRow()
return s return s
} }

View File

@ -54,7 +54,9 @@ func makeRepoView() *repoWindow {
r.box = r.win.Box().NewBox("bw vbox", false) r.box = r.win.Box().NewBox("bw vbox", false)
// me.reposwin.Draw() // me.reposwin.Draw()
r.win.Custom = func() { r.win.Custom = func() {
log.Warn("Repo Window close. Do something here?") log.Warn("Repo Window close. hidden=true")
// sets the hidden flag to false so Toggle() works
r.win.Hide()
} }
r.topbox = r.repoMenu() r.topbox = r.repoMenu()