hammer please

This commit is contained in:
Jeff Carr 2025-01-30 09:09:47 -06:00
parent 965d6cb6a9
commit 18caa7869b
1 changed files with 11 additions and 27 deletions

View File

@ -3,7 +3,6 @@ package main
import (
"fmt"
"strconv"
"sync"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/forgepb"
@ -13,21 +12,15 @@ import (
)
type patchesWindow 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
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
}
type patchSummary struct {
grid *gui.Node
// updateB *gui.Node
// docsB *gui.Node
// gitPushB *gui.Node
// gitPullB *gui.Node
grid *gui.Node
checkB *gui.Node
totalOL *gadgets.OneLiner
dirtyOL *gadgets.OneLiner
@ -57,17 +50,8 @@ func (r *patchesWindow) Hide() {
r.win.Hide()
}
func (r *patchesWindow) Disable() {
r.stack.Disable()
}
func (r *patchesWindow) Enable() {
r.stack.Enable()
}
// you can only have one of these
func (r *patchesWindow) initWindow() {
// sync.Once()
r.win = gadgets.RawBasicWindow("Forge Patchesets")
r.win.Make()
@ -183,12 +167,11 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {
r.setgrid.NextRow()
}
// does not run any commands
// will update this from the current state of the protobuf
func (s *patchSummary) Update() {
var total, dirty, readonly, rw int
// var userT int // , develT, masterT int
// var userP, develP, masterP int
// broken after move to forge protobuf
// figure out the totals
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
@ -202,9 +185,10 @@ func (s *patchSummary) Update() {
rw += 1
}
}
// send the values to the GUI toolkit
s.totalOL.SetText(strconv.Itoa(total) + " repos")
s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos")
s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos")
s.rw.SetText(fmt.Sprintf("%d repos", rw))
// s.totalUserRepos.SetText(strconv.Itoa(userT) + " repos")
}