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

View File

@ -17,7 +17,7 @@ type patchWindow struct {
stack *gui.Node // the top box set as vertical stack *gui.Node // the top box set as vertical
shelf *gui.Node // the first box in the stack, set as horizontal shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches grid *gui.Node // the list of available patches
summary *patchSummary // summary of current patches // summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset setgrid *gui.Node // the list of each patchset
pset *forgepb.Patchset // the patchset in question pset *forgepb.Patchset // the patchset in question
} }
@ -75,17 +75,26 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
grid := pw.stack.NewGrid("", 0, 0) grid := pw.stack.NewGrid("", 0, 0)
grid.NewLabel("Patchset Details:")
grid.NewLabel(pset.GitAuthorName) grid.NewLabel(pset.GitAuthorName)
grid.NewLabel(pset.GitAuthorEmail) grid.NewLabel(pset.GitAuthorEmail)
grid.NextRow()
grid.NewLabel("start branch: " + pset.StartBranchName) grid.NewLabel("start branch: " + pset.StartBranchName)
grid.NewLabel(pset.StartBranchHash) grid.NewLabel(pset.StartBranchHash)
grid.NextRow()
grid.NewLabel("end branch: " + pset.EndBranchName) grid.NewLabel("end branch: " + pset.EndBranchName)
grid.NewLabel(pset.EndBranchHash) grid.NewLabel(pset.EndBranchHash)
grid.NextRow() 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 { if err := savePatchset(pset); err != nil {
log.Info("Save err:", err) log.Info("Save err:", err)
return return
@ -105,19 +114,10 @@ func makePatchWindow(pset *forgepb.Patchset) *patchWindow {
applyPatchset(pset) applyPatchset(pset)
} }
}) })
grid.NextRow()
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()
// add the patches to the grid // add the patches to the grid
pw.addPatchset(filegrid, pset) pw.addPatchset(grid, pset)
return pw return pw
} }
@ -164,6 +164,8 @@ func (r *patchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
win = makeRepoPatchWindow(repo, patches) win = makeRepoPatchWindow(repo, patches)
win.Show() win.Show()
}) })
grid.NewCheckbox("").SetChecked(true)
grid.NewCheckbox("").SetChecked(true)
grid.NextRow() grid.NextRow()
} }
} }

View File

@ -17,7 +17,7 @@ type repoPatchWindow struct {
stack *gui.Node // the top box set as vertical stack *gui.Node // the top box set as vertical
shelf *gui.Node // the first box in the stack, set as horizontal shelf *gui.Node // the first box in the stack, set as horizontal
grid *gui.Node // the list of available patches grid *gui.Node // the list of available patches
summary *patchSummary // summary of current patches // summary *patchSummary // summary of current patches
setgrid *gui.Node // the list of each patchset setgrid *gui.Node // the list of each patchset
pset *forgepb.Patchset // the patchset in question pset *forgepb.Patchset // the patchset in question
} }