Compare commits

..

No commits in common. "269490693ec8a153ab7d6718d9ecd7e09b6c322d" and "15bcdb006e14840bae125a98ff479038e37eb47a" have entirely different histories.

4 changed files with 86 additions and 108 deletions

69
main.go
View File

@ -49,22 +49,25 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
log.Warn("status window doesn't exist")
return
}
log.Warn("status window exists. trying Show() here")
newRepo.status.Show()
log.Warn("status window exists. trying Update() here")
newRepo.status.Toggle()
})
grid.NewButton("Show()", func () {
grid.NewButton("TestDraw()", func () {
if newRepo.status == nil {
log.Warn("status window doesn't exist")
return
}
log.Warn("status window exists. trying TestDraw() here")
newRepo.status.Show()
newRepo.status.TestDraw()
})
if path == "" {
newRepo.cButton.Hide()
newRepo.pButton.Hide()
}
newRepo.status = repostatus.New(myGui, newRepo.path)
newRepo.status.Horizontal()
newRepo.status.Make()
newRepo.status.Make2()
newRepo.status.SetMasterName(master)
newRepo.status.SetDevelName(devel)
newRepo.status.SetUserName(user)
@ -75,25 +78,25 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
// This creates a window
func repoworld() {
reposwin = gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.")
reposwin.Make()
win := gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.")
reposbox = reposwin.Box().NewBox("bw vbox", false)
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
reposgrid = reposgroup.NewGrid("test", 11, 1)
box := win.Box().NewBox("bw vbox", false)
// box2 := win.Box().NewBox("bw vbox", false)
group := box.NewGroup("go repositories (read from ~/.config/myrepolist)")
grid := group.NewGrid("test", 11, 1)
reposgrid.NewLabel("")
reposgrid.NewLabel("branch")
reposgrid.NewLabel("last tag")
reposgrid.NewLabel("Current Version")
// reposgrid.NewLabel("tags")
reposgrid.NewLabel("master")
reposgrid.NewLabel("devel")
reposgrid.NewLabel("user")
reposgrid.NewLabel("Status")
reposgrid.NewLabel("commit")
reposgrid.NewLabel("Toggle()")
reposgrid.NewLabel("Draw()")
grid.NewLabel("")
grid.NewLabel("branch")
grid.NewLabel("last tag")
grid.NewLabel("Current Version")
// grid.NewLabel("tags")
grid.NewLabel("master")
grid.NewLabel("devel")
grid.NewLabel("user")
grid.NewLabel("Status")
grid.NewLabel("commit")
grid.NewLabel("Toggle()")
grid.NewLabel("Draw()")
repos := myrepolist()
for _, line := range repos {
@ -103,28 +106,8 @@ func repoworld() {
if dbranch == "" { dbranch = "devel" }
usr, _ := user.Current()
if ubranch == "" { ubranch = usr.Username }
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
addRepo(grid, path, mbranch, dbranch, ubranch)
}
box2 := reposwin.Box().NewBox("bw vbox", false)
box2.NewButton("reposgrid.Margin()", func () {
log.Warn("reposgrid.Margin() RUN NOW")
reposgrid.Margin()
log.Warn("reposgrid.Pad() RUN NOW")
reposgrid.Pad()
})
box2.NewButton("status.Update() all", func () {
for _, repo := range allrepos {
repo.status.Update()
}
})
box2.NewButton("rescan all", func () {
for _, repo := range allrepos {
repo.newScan()
}
})
reposwin.Draw()
win.Draw()
}

View File

@ -7,6 +7,7 @@ import (
"go.wit.com/log"
"go.wit.com/gui/gadgets/repostatus"
"go.wit.com/apps/control-panel-dns/smartwindow"
)
@ -61,3 +62,53 @@ func myrepolist() []string {
lines := strings.Split(out, "\n")
return lines
}
func (r *repo) newScan() bool {
if r.status == nil {
log.Warn("repo.status = nil. not initialized for some reason")
return false
}
// r.scan()
if repostatus.VerifyLocalGoRepo(r.getPath()) {
log.Warn("repo actually exists", r.getPath())
} else {
log.Warn("repo does not exist", r.getPath())
return false
}
mn := r.status.GetMasterName()
mv := r.status.GetMasterVersion()
r.masterVersion.Set(mn + " " + mv)
dn := r.status.GetDevelName()
dv := r.status.GetDevelVersion()
r.develVersion.Set(dn + " " + dv)
un := r.status.GetUserName()
uv := r.status.GetUserVersion()
r.jcarrVersion.Set(un + " " + uv)
cbname := r.status.GetCurrentBranchName()
cbversion := r.status.GetCurrentBranchVersion()
ltversion := r.status.GetLastTagVersion()
r.lastLabel.Set(cbname + " " + cbversion)
r.vLabel.Set(cbname + " " + ltversion)
if r.status.CheckDirty() {
log.Warn("CheckDirty() true")
r.dirtyLabel.Set("dirty")
return false
}
log.Warn("CheckDirty() no")
r.dirtyLabel.Set("not dirty")
if r.status.CheckBranches() {
log.Warn("Branches are Perfect")
r.dirtyLabel.SetText("PEFECT")
return true
} else {
log.Warn("Branches are not Perfect")
r.dirtyLabel.SetText("merge")
}
return false
}

58
scan.go
View File

@ -1,58 +0,0 @@
// This is a simple example
package main
import (
"go.wit.com/log"
"go.wit.com/gui/gadgets/repostatus"
)
func (r *repo) newScan() bool {
if r.status == nil {
log.Warn("repo.status = nil. not initialized for some reason")
return false
}
// r.scan()
if repostatus.VerifyLocalGoRepo(r.getPath()) {
log.Warn("repo actually exists", r.getPath())
} else {
log.Warn("repo does not exist", r.getPath())
return false
}
mn := r.status.GetMasterName()
mv := r.status.GetMasterVersion()
r.masterVersion.Set(mn + "\n" + mv)
dn := r.status.GetDevelName()
dv := r.status.GetDevelVersion()
r.develVersion.Set(dn + "\n" + dv)
un := r.status.GetUserName()
uv := r.status.GetUserVersion()
r.jcarrVersion.Set(un + "\n" + uv)
cbname := r.status.GetCurrentBranchName()
cbversion := r.status.GetCurrentBranchVersion()
ltversion := r.status.GetLastTagVersion()
r.lastLabel.Set(cbname + "\n" + cbversion)
r.vLabel.Set(cbname + "\n" + ltversion)
if r.status.CheckDirty() {
log.Warn("CheckDirty() true")
r.dirtyLabel.Set("dirty")
return false
}
log.Warn("CheckDirty() no")
r.dirtyLabel.Set("not dirty")
if r.status.CheckBranches() {
log.Warn("Branches are Perfect")
r.dirtyLabel.SetText("PEFECT")
return true
} else {
log.Warn("Branches are not Perfect")
r.dirtyLabel.SetText("merge")
}
return false
}

View File

@ -1,18 +1,20 @@
// watch all your go git repos
// This is a simple example
package main
import (
// "os/user"
// "io/ioutil"
// "strings"
// "go.wit.com/log"
"go.wit.com/gui/gui"
"go.wit.com/gui/gadgets"
// "go.wit.com/gui/gadgets"
"go.wit.com/gui/gadgets/repostatus"
// "go.wit.com/apps/control-panel-dns/smartwindow"
)
// the main window nodes
var myGui *gui.Node
var reposwin *gadgets.BasicWindow
var reposbox *gui.Node
var reposgrid *gui.Node
var reposgroup *gui.Node
var allrepos []*repo