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