used a blind widget

This commit is contained in:
Jeff Carr 2024-02-19 19:43:21 -06:00
parent 240da22087
commit 47d27e4166
6 changed files with 50 additions and 5 deletions

View File

@ -156,7 +156,6 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
newRepo.Status.Build() newRepo.Status.Build()
}) })
} }
newRepo.goState = r.blind.NewLabel("in the blind")
case "guireleaser": case "guireleaser":
newRepo.targetV = newRepo.Status.MirrorTargetVersion() newRepo.targetV = newRepo.Status.MirrorTargetVersion()
grid.Append(newRepo.targetV) grid.Append(newRepo.targetV)

View File

@ -2,6 +2,7 @@ package repolist
import ( import (
"go.wit.com/lib/gui/repostatus" "go.wit.com/lib/gui/repostatus"
"go.wit.com/gui"
"go.wit.com/log" "go.wit.com/log"
) )
@ -74,11 +75,23 @@ func (r *Repo) IsDirty() bool {
} }
func (r *Repo) ReadOnly() bool { func (r *Repo) ReadOnly() bool {
if r == nil {
log.Warn("ReadOnly() repo == nil")
return false
}
if r.Status == nil {
log.Warn("ReadOnly() repo.Status == nil")
return false
}
return r.Status.ReadOnly() return r.Status.ReadOnly()
} }
func (r *Repo) LastTag() string { func (r *Repo) LastTag() string {
return r.Status.GetLastTagVersion() if r == nil {
log.Warn("LastTag() repo == nil")
return ""
}
return r.lastTag.String()
} }
// returns the state of the GO go.mod and go.sum files // returns the state of the GO go.mod and go.sum files
@ -139,3 +152,7 @@ func (r *Repo) DeleteTag(t *repostatus.Tag) bool {
r.Status.DeleteTag(t) r.Status.DeleteTag(t)
return true return true
} }
func (rl *RepoList) MirrorShownCount() *gui.Node {
return gui.RawMirror(rl.shownCount)
}

23
scan.go
View File

@ -2,6 +2,7 @@ package repolist
import ( import (
"fmt" "fmt"
"strconv"
"strings" "strings"
"go.wit.com/log" "go.wit.com/log"
@ -11,15 +12,37 @@ func (r *RepoList) SetAutoScan(b bool) {
me.autoScan = b me.autoScan = b
} }
func (r *RepoList) RegisterHideFunction(f func (* Repo)) {
me.hideFunction = f
}
func (r *RepoList) ScanRepositories() (int, string) { func (r *RepoList) ScanRepositories() (int, string) {
var i int var i int
var shown int
t := TimeFunction(func() { t := TimeFunction(func() {
for _, repo := range me.allrepos { for _, repo := range me.allrepos {
i += 1 i += 1
repo.NewScan() repo.NewScan()
if me.hideFunction == nil {
// application didn't register a hide function
} else {
me.hideFunction(repo)
}
}
var hidden int
for _, repo := range me.allrepos {
if repo.Hidden() {
hidden += 1
} else {
shown += 1
}
} }
}) })
s := fmt.Sprint(t) s := fmt.Sprint(t)
tmp := strconv.Itoa(shown) + " repos shown"
log.Info("Setting shownCount to", tmp)
me.shownCount.SetText(tmp)
log.Info("Scanned", i, "repositories. todo: count/show changes in", s) log.Info("Scanned", i, "repositories. todo: count/show changes in", s)
return i, s return i, s
} }

View File

@ -24,19 +24,21 @@ type RepoList struct {
allrepos map[string]*Repo allrepos map[string]*Repo
viewName string viewName string
// reposwin *gadgets.BasicWindow
reposbox *gui.Node reposbox *gui.Node
reposgrid *gui.Node reposgrid *gui.Node
reposgroup *gui.Node reposgroup *gui.Node
// put things here that can't be seen // put things here that can't be seen
blind *gui.Node blind *gui.Node
shownCount *gui.Node
hideFunction func(*Repo)
} }
type Repo struct { type Repo struct {
hidden bool hidden bool
lasttagrev string lasttagrev string
lasttag string // lasttag string
giturl string giturl string
pLabel *gui.Node // path label pLabel *gui.Node // path label

View File

@ -27,6 +27,8 @@ func AutotypistView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("Current").SetProgName("CurrentName") me.reposgrid.NewLabel("Current").SetProgName("CurrentName")
me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion") me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
me.reposgrid.NextRow() me.reposgrid.NextRow()
me.blind = gui.RawBox() me.blind = gui.RawBox()
me.shownCount = me.blind.NewLabel("showCount")
return me return me
} }

View File

@ -26,6 +26,8 @@ func GuireleaserView(parent *gui.Node) *RepoList {
me.reposgrid.NewLabel("git State") me.reposgrid.NewLabel("git State")
me.reposgrid.NewLabel("GO State") me.reposgrid.NewLabel("GO State")
me.reposgrid.NextRow() me.reposgrid.NextRow()
me.blind = gui.RawBox() me.blind = gui.RawBox()
me.shownCount = me.blind.NewLabel("showCount")
return me return me
} }