used a blind widget
This commit is contained in:
parent
240da22087
commit
47d27e4166
|
@ -156,7 +156,6 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
|
|||
newRepo.Status.Build()
|
||||
})
|
||||
}
|
||||
newRepo.goState = r.blind.NewLabel("in the blind")
|
||||
case "guireleaser":
|
||||
newRepo.targetV = newRepo.Status.MirrorTargetVersion()
|
||||
grid.Append(newRepo.targetV)
|
||||
|
|
19
common.go
19
common.go
|
@ -2,6 +2,7 @@ package repolist
|
|||
|
||||
import (
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
|
@ -74,11 +75,23 @@ func (r *Repo) IsDirty() 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()
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -139,3 +152,7 @@ func (r *Repo) DeleteTag(t *repostatus.Tag) bool {
|
|||
r.Status.DeleteTag(t)
|
||||
return true
|
||||
}
|
||||
|
||||
func (rl *RepoList) MirrorShownCount() *gui.Node {
|
||||
return gui.RawMirror(rl.shownCount)
|
||||
}
|
||||
|
|
23
scan.go
23
scan.go
|
@ -2,6 +2,7 @@ package repolist
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
|
@ -11,15 +12,37 @@ func (r *RepoList) SetAutoScan(b bool) {
|
|||
me.autoScan = b
|
||||
}
|
||||
|
||||
func (r *RepoList) RegisterHideFunction(f func (* Repo)) {
|
||||
me.hideFunction = f
|
||||
}
|
||||
|
||||
func (r *RepoList) ScanRepositories() (int, string) {
|
||||
var i int
|
||||
var shown int
|
||||
t := TimeFunction(func() {
|
||||
for _, repo := range me.allrepos {
|
||||
i += 1
|
||||
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)
|
||||
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)
|
||||
return i, s
|
||||
}
|
||||
|
|
|
@ -24,19 +24,21 @@ type RepoList struct {
|
|||
allrepos map[string]*Repo
|
||||
viewName string
|
||||
|
||||
// reposwin *gadgets.BasicWindow
|
||||
reposbox *gui.Node
|
||||
reposgrid *gui.Node
|
||||
reposgroup *gui.Node
|
||||
|
||||
// put things here that can't be seen
|
||||
blind *gui.Node
|
||||
|
||||
shownCount *gui.Node
|
||||
hideFunction func(*Repo)
|
||||
}
|
||||
|
||||
type Repo struct {
|
||||
hidden bool
|
||||
lasttagrev string
|
||||
lasttag string
|
||||
// lasttag string
|
||||
giturl string
|
||||
|
||||
pLabel *gui.Node // path label
|
||||
|
|
|
@ -27,6 +27,8 @@ func AutotypistView(parent *gui.Node) *RepoList {
|
|||
me.reposgrid.NewLabel("Current").SetProgName("CurrentName")
|
||||
me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
|
||||
me.reposgrid.NextRow()
|
||||
|
||||
me.blind = gui.RawBox()
|
||||
me.shownCount = me.blind.NewLabel("showCount")
|
||||
return me
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ func GuireleaserView(parent *gui.Node) *RepoList {
|
|||
me.reposgrid.NewLabel("git State")
|
||||
me.reposgrid.NewLabel("GO State")
|
||||
me.reposgrid.NextRow()
|
||||
|
||||
me.blind = gui.RawBox()
|
||||
me.shownCount = me.blind.NewLabel("showCount")
|
||||
return me
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue