repolist count widet works

This commit is contained in:
Jeff Carr 2024-02-19 19:41:48 -06:00
parent 87b3e5fafc
commit bc644664bc
2 changed files with 46 additions and 43 deletions

View File

@ -9,49 +9,45 @@ import (
"go.wit.com/log" "go.wit.com/log"
) )
func globalDisplaySetRepoState() { func hideFunction(r *repolist.Repo) {
for _, repo := range repolist.AllRepos() { if r.Status.IsDirty() {
if repo.Status.IsDirty() { r.Show()
repo.Show() return
continue
}
if me.autoHideReadOnly.Checked() {
if repo.Status.ReadOnly() {
repo.Hide()
continue
}
}
if me.autoHidePerfect.Checked() {
if repo.IsPerfect() {
repo.Hide()
continue
}
}
repo.Show()
} }
if me.autoHideReadOnly.Checked() {
if r.Status.ReadOnly() {
r.Hide()
return
}
}
if me.autoHidePerfect.Checked() {
if r.IsPerfect() {
r.Hide()
return
}
}
r.Show()
} }
func globalDisplayShow() { func hideFunction2(repo *repolist.Repo) {
for _, repo := range repolist.AllRepos() { if me.autoHideReadOnly.Checked() {
if me.autoHideReadOnly.Checked() { if repo.Status.ReadOnly() {
if repo.Status.ReadOnly() { return
continue
}
} }
if me.autoHidePerfect.Checked() {
if repo.IsPerfect() {
continue
}
}
repo.Show()
} }
if me.autoHidePerfect.Checked() {
if repo.IsPerfect() {
return
}
}
repo.Show()
} }
func globalDisplayOptions(vbox *gui.Node) { func globalDisplayOptions(vbox *gui.Node) {
group1 := vbox.NewGroup("Global Display Options") group1 := vbox.NewGroup("Global Display Options")
group1.NewButton("Show Repository Window", func() { group1.NewButton("Show Repository Window", func() {
globalDisplaySetRepoState() // globalDisplaySetRepoState()
if me.repos.Hidden() { if me.repos.Hidden() {
me.repos.Show() me.repos.Show()
} else { } else {
@ -61,19 +57,18 @@ func globalDisplayOptions(vbox *gui.Node) {
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true) me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() { me.autoHideReadOnly.Custom = func() {
if me.autoHideReadOnly.Checked() { me.repos.View.RegisterHideFunction(hideFunction)
globalDisplaySetRepoState() me.repos.View.ScanRepositories()
} else {
globalDisplayShow()
}
} }
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true) me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() { me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() { if me.autoHidePerfect.Checked() {
globalDisplaySetRepoState() me.repos.View.RegisterHideFunction(hideFunction)
me.repos.View.ScanRepositories()
} else { } else {
globalDisplayShow() me.repos.View.RegisterHideFunction(hideFunction2)
me.repos.View.ScanRepositories()
} }
} }
scanbox := group1.Box().Horizontal() scanbox := group1.Box().Horizontal()

View File

@ -9,8 +9,12 @@ import (
) )
type repoWindow struct { type repoWindow struct {
win *gadgets.BasicWindow win *gadgets.BasicWindow
box *gui.Node box *gui.Node
// the top box of the repolist window
topbox *gui.Node
View *repolist.RepoList View *repolist.RepoList
} }
@ -50,10 +54,13 @@ func makeRepoView() *repoWindow {
log.Warn("Should I do something special here?") log.Warn("Should I do something special here?")
} }
r.repoAllButtons() r.topbox = r.repoAllButtons()
r.View = repolist.AutotypistView(r.box) r.View = repolist.AutotypistView(r.box)
showncount := r.View.MirrorShownCount()
r.topbox.Append(showncount)
r.View.RegisterHideFunction(hideFunction)
return r return r
} }
@ -74,7 +81,7 @@ func (r *repoWindow) showApps() {
} }
} }
func (r *repoWindow) repoAllButtons() { func (r *repoWindow) repoAllButtons() *gui.Node {
// reposbox.SetExpand(false) // reposbox.SetExpand(false)
group1 := r.box.NewGroup("Run on all repos:") group1 := r.box.NewGroup("Run on all repos:")
@ -132,6 +139,7 @@ func (r *repoWindow) repoAllButtons() {
log.Info("every build worked !!!") log.Info("every build worked !!!")
log.Info("") log.Info("")
}) })
return box2
} }
func (r *repoWindow) mergeAllDevelToMain() bool { func (r *repoWindow) mergeAllDevelToMain() bool {