removing "patch summary" struct
This commit is contained in:
parent
18caa7869b
commit
7779d01854
|
@ -17,10 +17,6 @@ type patchesWindow struct {
|
||||||
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
|
||||||
}
|
|
||||||
|
|
||||||
type patchSummary struct {
|
|
||||||
grid *gui.Node
|
|
||||||
checkB *gui.Node
|
checkB *gui.Node
|
||||||
totalOL *gadgets.OneLiner
|
totalOL *gadgets.OneLiner
|
||||||
dirtyOL *gadgets.OneLiner
|
dirtyOL *gadgets.OneLiner
|
||||||
|
@ -30,6 +26,9 @@ type patchSummary struct {
|
||||||
submitB *gui.Node
|
submitB *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type patchSummary struct {
|
||||||
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) Hidden() bool {
|
func (r *patchesWindow) Hidden() bool {
|
||||||
return r.win.Hidden()
|
return r.win.Hidden()
|
||||||
}
|
}
|
||||||
|
@ -64,10 +63,10 @@ func (r *patchesWindow) initWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
r.grid = r.stack.NewGrid("", 0, 0)
|
r.grid = r.stack.NewGrid("", 0, 0)
|
||||||
r.summary = r.submitPatchesBox(r.stack)
|
r.submitPatchesBox()
|
||||||
|
|
||||||
// update the stats about the repos and patches
|
// update the stats about the repos and patches
|
||||||
r.summary.Update()
|
r.Update()
|
||||||
|
|
||||||
g := r.stack.NewGroup("Patchset List")
|
g := r.stack.NewGroup("Patchset List")
|
||||||
|
|
||||||
|
@ -75,27 +74,27 @@ func (r *patchesWindow) initWindow() {
|
||||||
r.setgrid = g.NewGrid("", 0, 0)
|
r.setgrid = g.NewGrid("", 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
func (r *patchesWindow) submitPatchesBox() {
|
||||||
s := new(patchSummary)
|
// s := new(patchSummary)
|
||||||
group1 := box.NewGroup("Repo Summary")
|
group1 := r.stack.NewGroup("Repo Summary")
|
||||||
s.grid = group1.RawGrid()
|
grid := group1.RawGrid()
|
||||||
|
|
||||||
// make the header table for repo stats
|
// make the header table for repo stats
|
||||||
s.totalOL = gadgets.NewOneLiner(s.grid, "Total")
|
r.totalOL = gadgets.NewOneLiner(grid, "Total")
|
||||||
s.grid.NextRow()
|
grid.NextRow()
|
||||||
s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty")
|
r.dirtyOL = gadgets.NewOneLiner(grid, "dirty")
|
||||||
s.grid.NextRow()
|
grid.NextRow()
|
||||||
s.readonlyOL = gadgets.NewOneLiner(s.grid, "read-only")
|
r.readonlyOL = gadgets.NewOneLiner(grid, "read-only")
|
||||||
s.grid.NextRow()
|
grid.NextRow()
|
||||||
s.rw = gadgets.NewOneLiner(s.grid, "r/w")
|
r.rw = gadgets.NewOneLiner(grid, "r/w")
|
||||||
s.grid.NextRow()
|
grid.NextRow()
|
||||||
|
|
||||||
// make the 'widget group' for the buttons at the bottom of the window
|
// make the 'widget group' for the buttons at the bottom of the window
|
||||||
group1 = box.NewGroup("Patchset Create")
|
group1 = r.stack.NewGroup("Patchset Create")
|
||||||
s.grid = group1.RawGrid()
|
grid = group1.RawGrid()
|
||||||
|
|
||||||
s.grid.NewButton("current patch summary", func() {
|
grid.NewButton("current patch summary", func() {
|
||||||
s.Update()
|
r.Update()
|
||||||
pset, err := me.forge.MakeDevelPatchSet("current patches")
|
pset, err := me.forge.MakeDevelPatchSet("current patches")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("patchset creation failed", err)
|
log.Info("patchset creation failed", err)
|
||||||
|
@ -109,16 +108,16 @@ func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
win.Show()
|
win.Show()
|
||||||
})
|
})
|
||||||
|
|
||||||
s.reason = gadgets.NewBasicEntry(s.grid, "Patchset name:")
|
r.reason = gadgets.NewBasicEntry(grid, "Patchset name:")
|
||||||
s.reason.Custom = func() {
|
r.reason.Custom = func() {
|
||||||
if s.reason.String() != "" {
|
if r.reason.String() != "" {
|
||||||
s.submitB.Enable()
|
r.submitB.Enable()
|
||||||
} else {
|
} else {
|
||||||
s.submitB.Disable()
|
r.submitB.Disable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.submitB = s.grid.NewButton("Submit", func() {
|
r.submitB = grid.NewButton("Submit", func() {
|
||||||
pset, err := me.forge.SubmitDevelPatchSet(s.reason.String())
|
pset, err := me.forge.SubmitDevelPatchSet(r.reason.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info(err)
|
log.Info(err)
|
||||||
return
|
return
|
||||||
|
@ -126,7 +125,7 @@ func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
// line := "somedate " + s.reason.String() + " Author: me" + pset.GitAuthorEmail
|
// line := "somedate " + s.reason.String() + " Author: me" + pset.GitAuthorEmail
|
||||||
r.addPatchsetNew(pset)
|
r.addPatchsetNew(pset)
|
||||||
})
|
})
|
||||||
s.grid.NewButton("Get Patchset List", func() {
|
grid.NewButton("Get Patchset List", func() {
|
||||||
if psets, err := me.forge.GetPatchesets(); err != nil {
|
if psets, err := me.forge.GetPatchesets(); err != nil {
|
||||||
log.Info("Get Patchsets failed", err)
|
log.Info("Get Patchsets failed", err)
|
||||||
return
|
return
|
||||||
|
@ -141,9 +140,8 @@ func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
s.submitB.Disable()
|
r.submitB.Disable()
|
||||||
s.grid.NextRow()
|
grid.NextRow()
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
|
@ -168,7 +166,7 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// will update this from the current state of the protobuf
|
// will update this from the current state of the protobuf
|
||||||
func (s *patchSummary) Update() {
|
func (r *patchesWindow) Update() {
|
||||||
var total, dirty, readonly, rw int
|
var total, dirty, readonly, rw int
|
||||||
|
|
||||||
// figure out the totals
|
// figure out the totals
|
||||||
|
@ -187,8 +185,8 @@ func (s *patchSummary) Update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the values to the GUI toolkit
|
// send the values to the GUI toolkit
|
||||||
s.totalOL.SetText(strconv.Itoa(total) + " repos")
|
r.totalOL.SetText(strconv.Itoa(total) + " repos")
|
||||||
s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos")
|
r.dirtyOL.SetText(strconv.Itoa(dirty) + " repos")
|
||||||
s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos")
|
r.readonlyOL.SetText(strconv.Itoa(readonly) + " repos")
|
||||||
s.rw.SetText(fmt.Sprintf("%d repos", rw))
|
r.rw.SetText(fmt.Sprintf("%d repos", rw))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue