more code reorg

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-30 13:57:17 -06:00
parent de78a20295
commit 62e1f8389c
2 changed files with 62 additions and 66 deletions

66
main.go
View File

@ -4,13 +4,11 @@ package main
import (
"embed"
"fmt"
"strings"
"time"
"go.wit.com/log"
"go.wit.com/gui"
"go.wit.com/lib/gui/repostatus"
)
//go:embed resources/*
@ -63,73 +61,9 @@ 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)
globalDisplayOptions(box)
// globalBuildOptions(box)
// globalTestingOptions(box)
// globalResetOptions(box)
}

View File

@ -6,6 +6,7 @@ import (
"os/user"
"strings"
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
@ -132,3 +133,64 @@ func repoworld() {
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
}