done on this part of the GUI for now I think

This commit is contained in:
Jeff Carr 2025-01-30 09:38:28 -06:00
parent 7779d01854
commit 80df33888a
3 changed files with 44 additions and 50 deletions

View File

@ -15,18 +15,14 @@ type patchesWindow struct {
win *gadgets.BasicWindow // the patches window
stack *gui.Node // the top box set as vertical
grid *gui.Node // the list of available patches
summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset
checkB *gui.Node
reason *gadgets.BasicEntry // the name of the patchset
submitB *gui.Node // the submit patchet button
psetgrid *gui.Node // the list of each patchset
totalOL *gadgets.OneLiner
dirtyOL *gadgets.OneLiner
readonlyOL *gadgets.OneLiner
rw *gadgets.OneLiner
reason *gadgets.BasicEntry
submitB *gui.Node
}
type patchSummary struct {
// checkB *gui.Node
}
func (r *patchesWindow) Hidden() bool {
@ -62,7 +58,7 @@ func (r *patchesWindow) initWindow() {
r.win.Hide()
}
r.grid = r.stack.NewGrid("", 0, 0)
r.grid = r.stack.RawGrid()
r.submitPatchesBox()
// update the stats about the repos and patches
@ -71,7 +67,7 @@ func (r *patchesWindow) initWindow() {
g := r.stack.NewGroup("Patchset List")
// add the grid
r.setgrid = g.NewGrid("", 0, 0)
r.psetgrid = g.RawGrid()
}
func (r *patchesWindow) submitPatchesBox() {
@ -89,7 +85,7 @@ func (r *patchesWindow) submitPatchesBox() {
r.rw = gadgets.NewOneLiner(grid, "r/w")
grid.NextRow()
// make the 'widget group' for the buttons at the bottom of the window
// now, make the 'widget group' and the buttons at the bottom of the window
group1 = r.stack.NewGroup("Patchset Create")
grid = group1.RawGrid()
@ -122,7 +118,6 @@ func (r *patchesWindow) submitPatchesBox() {
log.Info(err)
return
}
// line := "somedate " + s.reason.String() + " Author: me" + pset.GitAuthorEmail
r.addPatchsetNew(pset)
})
grid.NewButton("Get Patchset List", func() {
@ -131,7 +126,6 @@ func (r *patchesWindow) submitPatchesBox() {
return
} else {
log.Info("got psets len", len(psets.Patchsets))
// all := psets.All()
all := psets.SortByName()
for all.Scan() {
pset := all.Next()
@ -145,24 +139,22 @@ func (r *patchesWindow) submitPatchesBox() {
}
func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
r.setgrid.NewLabel(pset.Name)
r.setgrid.NewLabel(pset.Comment)
r.setgrid.NewLabel(pset.GitAuthorName)
r.psetgrid.NewLabel(pset.Name)
r.psetgrid.NewLabel(pset.Comment)
r.psetgrid.NewLabel(pset.GitAuthorName)
var win *patchWindow
r.setgrid.NewButton("View", func() {
r.psetgrid.NewButton("View", func() {
// has the window already been created?
if win != nil {
// it has been already created. just show it
win.Toggle()
log.Info("TRYING TO TOGGLE WINDOW")
return
}
win = makePatchWindow(pset)
win.Show()
})
r.setgrid.NextRow()
r.psetgrid.NextRow()
}
// will update this from the current state of the protobuf

View File

@ -12,14 +12,14 @@ import (
)
type patchWindow struct {
once sync.Once // only init() the window once
win *gadgets.BasicWindow // the patches window
stack *gui.Node // the top box set as vertical
shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches
summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset
pset *forgepb.Patchset // the patchset in question
once sync.Once // only init() the window once
win *gadgets.BasicWindow // the patches window
stack *gui.Node // the top box set as vertical
shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches
// summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset
pset *forgepb.Patchset // the patchset in question
}
// todo: autogenerate these or make them standared 'gui' package functions
@ -75,17 +75,26 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
grid := pw.stack.NewGrid("", 0, 0)
grid.NewLabel("Patchset Details:")
grid.NewLabel(pset.GitAuthorName)
grid.NewLabel(pset.GitAuthorEmail)
grid.NextRow()
grid.NewLabel("start branch: " + pset.StartBranchName)
grid.NewLabel(pset.StartBranchHash)
grid.NextRow()
grid.NewLabel("end branch: " + pset.EndBranchName)
grid.NewLabel(pset.EndBranchHash)
grid.NextRow()
grid.NewButton("Extract files to disk", func() {
g := pw.stack.NewGroup("PatchSet List")
// make a grid to put the list of git repos that have patches
// in this particular patchset
grid = g.NewGrid("", 0, 0)
grid.NewLabel("repo")
grid.NewLabel("patch name")
grid.NewLabel("Applied in current branch?")
grid.NewLabel("start hash")
grid.NewLabel("")
grid.NewButton("Extract", func() {
if err := savePatchset(pset); err != nil {
log.Info("Save err:", err)
return
@ -105,19 +114,10 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
applyPatchset(pset)
}
})
g := pw.stack.NewGroup("PatchSet List")
// make a grid and a header
filegrid := g.NewGrid("", 0, 0)
filegrid.NewLabel("repo")
filegrid.NewLabel("patch name")
filegrid.NewLabel("Applied in current branch?")
filegrid.NewLabel("start hash")
filegrid.NextRow()
grid.NextRow()
// add the patches to the grid
pw.addPatchset(filegrid, pset)
pw.addPatchset(grid, pset)
return pw
}
@ -164,6 +164,8 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
win = makeRepoPatchWindow(repo, patches)
win.Show()
})
grid.NewCheckbox("").SetChecked(true)
grid.NewCheckbox("").SetChecked(true)
grid.NextRow()
}
}

View File

@ -12,14 +12,14 @@ import (
)
type repoPatchWindow struct {
once sync.Once // only init() the window once
win *gadgets.BasicWindow // the patches window
stack *gui.Node // the top box set as vertical
shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches
summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset
pset *forgepb.Patchset // the patchset in question
once sync.Once // only init() the window once
win *gadgets.BasicWindow // the patches window
stack *gui.Node // the top box set as vertical
shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches
// summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset
pset *forgepb.Patchset // the patchset in question
}
// todo: autogenerate these or make them standared 'gui' package functions