parent
8f44a292c8
commit
3516829fe4
|
@ -110,7 +110,7 @@ func globalDisplayOptions(box *gui.Node) {
|
|||
}
|
||||
}
|
||||
|
||||
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false)
|
||||
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
|
||||
me.autoHidePerfect.Custom = func() {
|
||||
if me.autoHidePerfect.Checked() {
|
||||
globalDisplaySetRepoState()
|
||||
|
|
129
main.go
129
main.go
|
@ -4,15 +4,11 @@ package main
|
|||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"os/user"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
||||
//go:embed resources/*
|
||||
|
@ -28,7 +24,12 @@ func main() {
|
|||
me.myGui.Default()
|
||||
|
||||
autotypistWindow()
|
||||
repoworld()
|
||||
repolistWindow()
|
||||
|
||||
for _, repo := range me.allrepos {
|
||||
repo.status.Update()
|
||||
repo.newScan()
|
||||
}
|
||||
|
||||
// scan repos every 30 seconds
|
||||
// check every second for the checkbox changing
|
||||
|
@ -60,67 +61,6 @@ func main() {
|
|||
})
|
||||
}
|
||||
|
||||
func addRepo(grid *gui.Node, path string, master string, devel string, user string) {
|
||||
_, ok := me.allrepos[path]
|
||||
if ok {
|
||||
log.Info("addRepo() already had path", path)
|
||||
return
|
||||
}
|
||||
|
||||
newRepo := new(repo)
|
||||
|
||||
path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user
|
||||
if path == "" {
|
||||
log.Warn("addRepo() got empty path", path, master, devel, user)
|
||||
return
|
||||
}
|
||||
|
||||
if repostatus.VerifyLocalGoRepo(path) {
|
||||
log.Verbose("newRepo actually exists", newRepo.getPath())
|
||||
} else {
|
||||
log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path, master, devel, user)
|
||||
return
|
||||
}
|
||||
|
||||
newRepo.path = path
|
||||
newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
|
||||
|
||||
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
||||
|
||||
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
|
||||
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||
|
||||
newRepo.dirtyLabel = grid.NewLabel("")
|
||||
newRepo.goSumStatus = grid.NewLabel("?")
|
||||
|
||||
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||
|
||||
newRepo.statusButton = grid.NewButton("Configure", func() {
|
||||
if newRepo.status == nil {
|
||||
log.Warn("status window doesn't exist")
|
||||
return
|
||||
}
|
||||
log.Warn("status window exists. trying TestDraw() here")
|
||||
newRepo.status.Toggle()
|
||||
/// newRepo.status.Update()
|
||||
})
|
||||
|
||||
// newRepo.status = repostatus.New(me.myGui, newRepo.path)
|
||||
newRepo.status = repostatus.NewRepoStatusWindow(newRepo.path)
|
||||
newRepo.hidden = false
|
||||
newRepo.status.SetMainWorkingName(master)
|
||||
newRepo.status.SetDevelWorkingName(devel)
|
||||
newRepo.status.SetUserWorkingName(user)
|
||||
/*
|
||||
newRepo.status.SetDevelBranchName(devel)
|
||||
newRepo.status.SetUserBranchName(user)
|
||||
newRepo.status.Update()
|
||||
newRepo.newScan()
|
||||
*/
|
||||
me.allrepos[path] = newRepo
|
||||
}
|
||||
|
||||
func autotypistWindow() {
|
||||
win := me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.")
|
||||
box := win.NewBox("bw hbox", true)
|
||||
|
@ -131,60 +71,3 @@ func autotypistWindow() {
|
|||
globalResetOptions(box)
|
||||
|
||||
}
|
||||
|
||||
// This creates a window
|
||||
func repoworld() {
|
||||
reposwin = gadgets.NewBasicWindow(me.myGui, "All git repositories in ~/go/src/")
|
||||
reposwin.Make()
|
||||
|
||||
reposbox = reposwin.Box().NewBox("bw vbox", false)
|
||||
reposwin.Draw()
|
||||
reposwin.Custom = func() {
|
||||
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
||||
log.Warn("Should I do something special here?")
|
||||
}
|
||||
|
||||
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
||||
reposgrid = reposgroup.NewGrid("test", 9, 1)
|
||||
|
||||
reposgrid.NewLabel("") // path goes here
|
||||
|
||||
reposgrid.NewLabel("last tag").SetProgName("last tag")
|
||||
|
||||
reposgrid.NewLabel("master version")
|
||||
reposgrid.NewLabel("devel version")
|
||||
reposgrid.NewLabel("user version")
|
||||
|
||||
reposgrid.NewLabel("Status")
|
||||
reposgrid.NewLabel("go.sum")
|
||||
|
||||
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
||||
|
||||
reposgrid.NewLabel("Show()")
|
||||
|
||||
repos := myrepolist()
|
||||
for _, line := range repos {
|
||||
log.Verbose("repo =", line)
|
||||
path, mbranch, dbranch, ubranch := splitLine(line)
|
||||
if mbranch == "" {
|
||||
mbranch = "master"
|
||||
}
|
||||
if dbranch == "" {
|
||||
dbranch = "devel"
|
||||
}
|
||||
usr, _ := user.Current()
|
||||
if ubranch == "" {
|
||||
ubranch = usr.Username
|
||||
}
|
||||
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
|
||||
}
|
||||
|
||||
for i, path := range repostatus.ListGitDirectories() {
|
||||
// log.Info("addRepo()", i, path)
|
||||
tmp := strings.TrimPrefix(path, "/home/jcarr/go/src/")
|
||||
log.Info("addRepo()", i, tmp)
|
||||
addRepo(reposgrid, tmp, "master", "master", "master")
|
||||
}
|
||||
|
||||
reposwin.Toggle()
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ func createReleaseWindow() {
|
|||
repo := me.allrepos[path]
|
||||
// mt.Printf("%s: %s\n", key, myMap[key])
|
||||
|
||||
//// for _, repo := range me.allrepos {
|
||||
//// for _, repo := range me.allrepos {
|
||||
// goSumS := repo.getGoSumStatus()
|
||||
// dirtyS := repo.dirtyLabel.String()
|
||||
|
||||
|
|
124
repolist.go
124
repolist.go
|
@ -3,7 +3,13 @@ package main
|
|||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os/user"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func (r *repo) String() string {
|
||||
|
@ -70,3 +76,121 @@ func (r *repo) Show() {
|
|||
r.statusButton.Show()
|
||||
r.hidden = false
|
||||
}
|
||||
|
||||
// This creates a window
|
||||
func repolistWindow() {
|
||||
reposwin = gadgets.NewBasicWindow(me.myGui, "All git repositories in ~/go/src/")
|
||||
reposwin.Make()
|
||||
|
||||
reposbox = reposwin.Box().NewBox("bw vbox", false)
|
||||
reposwin.Draw()
|
||||
reposwin.Custom = func() {
|
||||
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
||||
log.Warn("Should I do something special here?")
|
||||
}
|
||||
|
||||
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
||||
reposgrid = reposgroup.NewGrid("test", 9, 1)
|
||||
|
||||
reposgrid.NewLabel("") // path goes here
|
||||
|
||||
reposgrid.NewLabel("last tag").SetProgName("last tag")
|
||||
|
||||
reposgrid.NewLabel("master version")
|
||||
reposgrid.NewLabel("devel version")
|
||||
reposgrid.NewLabel("user version")
|
||||
|
||||
reposgrid.NewLabel("Status")
|
||||
reposgrid.NewLabel("go.sum")
|
||||
|
||||
reposgrid.NewLabel("Current Version").SetProgName("Current Version")
|
||||
|
||||
reposgrid.NewLabel("Show()")
|
||||
|
||||
repos := myrepolist()
|
||||
for _, line := range repos {
|
||||
log.Verbose("repo =", line)
|
||||
path, mbranch, dbranch, ubranch := splitLine(line)
|
||||
if mbranch == "" {
|
||||
mbranch = "master"
|
||||
}
|
||||
if dbranch == "" {
|
||||
dbranch = "devel"
|
||||
}
|
||||
usr, _ := user.Current()
|
||||
if ubranch == "" {
|
||||
ubranch = usr.Username
|
||||
}
|
||||
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
|
||||
}
|
||||
|
||||
for i, path := range repostatus.ListGitDirectories() {
|
||||
// log.Info("addRepo()", i, path)
|
||||
tmp := strings.TrimPrefix(path, "/home/jcarr/go/src/")
|
||||
log.Info("addRepo()", i, tmp)
|
||||
addRepo(reposgrid, tmp, "master", "master", "master")
|
||||
}
|
||||
|
||||
reposwin.Toggle()
|
||||
}
|
||||
|
||||
func addRepo(grid *gui.Node, path string, master string, devel string, user string) {
|
||||
_, ok := me.allrepos[path]
|
||||
if ok {
|
||||
log.Info("addRepo() already had path", path)
|
||||
return
|
||||
}
|
||||
|
||||
newRepo := new(repo)
|
||||
|
||||
path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user
|
||||
if path == "" {
|
||||
log.Warn("addRepo() got empty path", path, master, devel, user)
|
||||
return
|
||||
}
|
||||
|
||||
if repostatus.VerifyLocalGoRepo(path) {
|
||||
log.Verbose("newRepo actually exists", newRepo.getPath())
|
||||
} else {
|
||||
log.Warn("repostatus.VerifyLocalGoRepo() failed for for", path, master, devel, user)
|
||||
return
|
||||
}
|
||||
|
||||
newRepo.path = path
|
||||
newRepo.pLabel = grid.NewLabel(path).SetProgName("path")
|
||||
|
||||
newRepo.lastTag = grid.NewLabel("").SetProgName("lastTag")
|
||||
|
||||
newRepo.masterVersion = grid.NewLabel("").SetProgName("masterVersion")
|
||||
newRepo.develVersion = grid.NewLabel("").SetProgName("develVersion")
|
||||
newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion")
|
||||
|
||||
newRepo.dirtyLabel = grid.NewLabel("")
|
||||
newRepo.goSumStatus = grid.NewLabel("?")
|
||||
|
||||
newRepo.vLabel = grid.NewLabel("").SetProgName("current")
|
||||
|
||||
newRepo.statusButton = grid.NewButton("Configure", func() {
|
||||
if newRepo.status == nil {
|
||||
log.Warn("status window doesn't exist")
|
||||
return
|
||||
}
|
||||
log.Warn("status window exists. trying TestDraw() here")
|
||||
newRepo.status.Toggle()
|
||||
/// newRepo.status.Update()
|
||||
})
|
||||
|
||||
// newRepo.status = repostatus.New(me.myGui, newRepo.path)
|
||||
newRepo.status = repostatus.NewRepoStatusWindow(newRepo.path)
|
||||
newRepo.hidden = false
|
||||
newRepo.status.SetMainWorkingName(master)
|
||||
newRepo.status.SetDevelWorkingName(devel)
|
||||
newRepo.status.SetUserWorkingName(user)
|
||||
/*
|
||||
newRepo.status.SetDevelBranchName(devel)
|
||||
newRepo.status.SetUserBranchName(user)
|
||||
newRepo.status.Update()
|
||||
newRepo.newScan()
|
||||
*/
|
||||
me.allrepos[path] = newRepo
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue