gui is improved
This commit is contained in:
parent
6cee7c5420
commit
0e6ef50ad2
89
doGui.go
89
doGui.go
|
@ -4,6 +4,8 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"os/user"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/debugger"
|
"go.wit.com/lib/debugger"
|
||||||
|
@ -51,13 +53,13 @@ func doGui() {
|
||||||
|
|
||||||
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
||||||
globalBuildOptions(vbox2)
|
globalBuildOptions(vbox2)
|
||||||
me.summary = submitPatchesBox(vbox2)
|
// me.summary = submitPatchesBox(vbox2)
|
||||||
|
|
||||||
me.repos = makeRepoView()
|
me.repos = makeRepoView()
|
||||||
|
|
||||||
// processing is done. update the repo summary box
|
// processing is done. update the repo summary box
|
||||||
me.summary.Update()
|
// me.summary.Update()
|
||||||
me.summary.submitB.Disable()
|
// me.summary.submitB.Disable()
|
||||||
|
|
||||||
me.Enable()
|
me.Enable()
|
||||||
|
|
||||||
|
@ -65,6 +67,85 @@ func doGui() {
|
||||||
me.repos.View.Watchdog(func() {
|
me.repos.View.Watchdog(func() {
|
||||||
log.Info("Watchdog in doGui()")
|
log.Info("Watchdog in doGui()")
|
||||||
// processing is done. update the repo summary box
|
// processing is done. update the repo summary box
|
||||||
me.summary.Update()
|
// me.summary.Update()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func globalBuildOptions(vbox *gui.Node) {
|
||||||
|
group1 := vbox.NewGroup("Forge Settings")
|
||||||
|
grid := group1.NewGrid("buildOptions", 0, 0)
|
||||||
|
|
||||||
|
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||||
|
me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
|
||||||
|
grid.NextRow()
|
||||||
|
me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home")
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
|
usr, _ := user.Current()
|
||||||
|
homeDir, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Error getting home directory:", err)
|
||||||
|
homeDir = "/home/autotypist"
|
||||||
|
}
|
||||||
|
me.userHomePwd.SetText(homeDir)
|
||||||
|
srcDir := filepath.Join(homeDir, "go/src")
|
||||||
|
me.goSrcPwd.SetText(srcDir)
|
||||||
|
|
||||||
|
// use ENV GIT_AUTHOR
|
||||||
|
me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author")
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
|
if os.Getenv("GIT_AUTHOR_NAME") == "" {
|
||||||
|
me.gitAuthor.SetText("ENV GIT_AUTHOR_NAME is unset")
|
||||||
|
} else {
|
||||||
|
author := os.Getenv("GIT_AUTHOR_NAME")
|
||||||
|
author += " <" + os.Getenv("GIT_AUTHOR_EMAIL") + ">"
|
||||||
|
me.gitAuthor.SetText(author)
|
||||||
|
}
|
||||||
|
|
||||||
|
// select the branch you want to test, build and develop against
|
||||||
|
// this lets you select your user branch, but, when you are happy
|
||||||
|
// you can merge everything into the devel branch and make sure it actually
|
||||||
|
// works. Then, when that is good, merge and version everything in master
|
||||||
|
me.setBranchB = grid.NewButton("set current branch to:", func() {
|
||||||
|
targetName := me.newBranch.String()
|
||||||
|
log.Warn("setting all branches to", targetName)
|
||||||
|
if targetName == "devel" {
|
||||||
|
if err := doAllCheckoutDevel(); err != nil {
|
||||||
|
log.Info("switching to devel branches failed")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if targetName == "master" {
|
||||||
|
if err := doAllCheckoutMaster(); err != nil {
|
||||||
|
log.Info("switching to master branches failed")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// just assume user
|
||||||
|
if err := doAllCheckoutUser(); err != nil {
|
||||||
|
log.Info("switching to user branches failed")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
me.newBranch = grid.NewCombobox()
|
||||||
|
me.newBranch.AddText("master")
|
||||||
|
me.newBranch.AddText("devel")
|
||||||
|
me.newBranch.AddText(usr.Username)
|
||||||
|
me.newBranch.SetText(usr.Username)
|
||||||
|
|
||||||
|
// checking this will automatically make the branches off of devel
|
||||||
|
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
|
||||||
|
grid.NextRow()
|
||||||
|
|
||||||
|
grid.NewButton("Repo Window", func() {
|
||||||
|
if me.repos.Hidden() {
|
||||||
|
me.repos.Show()
|
||||||
|
} else {
|
||||||
|
me.repos.Hide()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
grid.NewButton("Patches Window", func() {
|
||||||
|
me.patchWin.once.Do(me.patchWin.initWindow)
|
||||||
|
me.patchWin.Toggle()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ type mainType struct {
|
||||||
// displays a summary of all the repos
|
// displays a summary of all the repos
|
||||||
// has total dirty, total read-only
|
// has total dirty, total read-only
|
||||||
// total patches, etc
|
// total patches, etc
|
||||||
summary *patchSummary
|
// summary *patchSummary
|
||||||
|
|
||||||
// when switch to user or devel branches, autocreate them
|
// when switch to user or devel branches, autocreate them
|
||||||
autoCreateBranches *gui.Node
|
autoCreateBranches *gui.Node
|
||||||
|
|
|
@ -2,11 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
|
||||||
"go.wit.com/lib/gadgets"
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -44,88 +40,3 @@ func quickCmd(fullpath string, cmd []string) bool {
|
||||||
log.Warn("quickCmd() output = ", result.Stdout)
|
log.Warn("quickCmd() output = ", result.Stdout)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func globalBuildOptions(vbox *gui.Node) {
|
|
||||||
group1 := vbox.NewGroup("Forge Settings")
|
|
||||||
grid := group1.NewGrid("buildOptions", 0, 0)
|
|
||||||
|
|
||||||
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
|
||||||
me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
|
|
||||||
grid.NextRow()
|
|
||||||
me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home")
|
|
||||||
grid.NextRow()
|
|
||||||
|
|
||||||
usr, _ := user.Current()
|
|
||||||
homeDir, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
log.Warn("Error getting home directory:", err)
|
|
||||||
homeDir = "/home/autotypist"
|
|
||||||
}
|
|
||||||
me.userHomePwd.SetText(homeDir)
|
|
||||||
srcDir := filepath.Join(homeDir, "go/src")
|
|
||||||
me.goSrcPwd.SetText(srcDir)
|
|
||||||
|
|
||||||
// use ENV GIT_AUTHOR
|
|
||||||
me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author")
|
|
||||||
grid.NextRow()
|
|
||||||
|
|
||||||
if os.Getenv("GIT_AUTHOR_NAME") == "" {
|
|
||||||
me.gitAuthor.SetText("ENV GIT_AUTHOR_NAME is unset")
|
|
||||||
} else {
|
|
||||||
author := os.Getenv("GIT_AUTHOR_NAME")
|
|
||||||
author += " <" + os.Getenv("GIT_AUTHOR_EMAIL") + ">"
|
|
||||||
me.gitAuthor.SetText(author)
|
|
||||||
}
|
|
||||||
|
|
||||||
// select the branch you want to test, build and develop against
|
|
||||||
// this lets you select your user branch, but, when you are happy
|
|
||||||
// you can merge everything into the devel branch and make sure it actually
|
|
||||||
// works. Then, when that is good, merge and version everything in master
|
|
||||||
me.setBranchB = grid.NewButton("set current branch to:", func() {
|
|
||||||
targetName := me.newBranch.String()
|
|
||||||
log.Warn("setting all branches to", targetName)
|
|
||||||
if targetName == "devel" {
|
|
||||||
if err := doAllCheckoutDevel(); err != nil {
|
|
||||||
log.Info("switching to devel branches failed")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if targetName == "master" {
|
|
||||||
if err := doAllCheckoutMaster(); err != nil {
|
|
||||||
log.Info("switching to master branches failed")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// just assume user
|
|
||||||
if err := doAllCheckoutUser(); err != nil {
|
|
||||||
log.Info("switching to user branches failed")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
me.newBranch = grid.NewCombobox()
|
|
||||||
me.newBranch.AddText("master")
|
|
||||||
me.newBranch.AddText("devel")
|
|
||||||
me.newBranch.AddText(usr.Username)
|
|
||||||
me.newBranch.SetText(usr.Username)
|
|
||||||
|
|
||||||
// checking this will automatically make the branches off of devel
|
|
||||||
me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true)
|
|
||||||
grid.NextRow()
|
|
||||||
|
|
||||||
grid.NewButton("Show Repos", func() {
|
|
||||||
if me.repos.Hidden() {
|
|
||||||
me.repos.Show()
|
|
||||||
} else {
|
|
||||||
me.repos.Hide()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
grid.NewButton("patches window", func() {
|
|
||||||
me.patchWin.once.Do(me.patchWin.initWindow)
|
|
||||||
me.patchWin.Toggle()
|
|
||||||
})
|
|
||||||
grid.NewButton("update patch summary", func() {
|
|
||||||
me.summary.Update()
|
|
||||||
})
|
|
||||||
grid.NewButton("test add", func() {
|
|
||||||
me.patchWin.initGroup()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
65
windowNew.go
65
windowNew.go
|
@ -4,19 +4,20 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
)
|
)
|
||||||
|
|
||||||
type patchesWindow struct {
|
type patchesWindow struct {
|
||||||
once sync.Once
|
once sync.Once
|
||||||
win *gadgets.BasicWindow
|
win *gadgets.BasicWindow
|
||||||
stackBox *gui.Node
|
stack *gui.Node
|
||||||
|
|
||||||
// the top box of the repolist window
|
// the top box of the repolist window
|
||||||
shelf *gui.Node
|
shelf *gui.Node
|
||||||
|
|
||||||
|
summary *patchSummary
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) Hidden() bool {
|
func (r *patchesWindow) Hidden() bool {
|
||||||
|
@ -40,76 +41,54 @@ func (r *patchesWindow) Hide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) Disable() {
|
func (r *patchesWindow) Disable() {
|
||||||
r.stackBox.Disable()
|
r.stack.Disable()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) Enable() {
|
func (r *patchesWindow) Enable() {
|
||||||
r.stackBox.Enable()
|
r.stack.Enable()
|
||||||
}
|
}
|
||||||
|
|
||||||
// you can only have one of these
|
// you can only have one of these
|
||||||
func (r *patchesWindow) initWindow() {
|
func (r *patchesWindow) initWindow() {
|
||||||
// sync.Once()
|
// sync.Once()
|
||||||
r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/")
|
r.win = gadgets.RawBasicWindow("Forge Patchesets")
|
||||||
r.win.Make()
|
r.win.Make()
|
||||||
|
|
||||||
r.stackBox = r.win.Box().NewBox("bw vbox", false)
|
r.stack = r.win.Box().NewBox("bw vbox", false)
|
||||||
// me.reposwin.Draw()
|
// me.reposwin.Draw()
|
||||||
r.win.Custom = func() {
|
r.win.Custom = func() {
|
||||||
log.Warn("Repo Window close. Do something here?")
|
log.Warn("Patchset Window close. setting hidden=true")
|
||||||
// sets the hidden flag to false so Toggle() works
|
// sets the hidden flag to false so Toggle() works
|
||||||
r.win.Hide()
|
r.win.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
r.shelf = r.initGroup()
|
r.shelf = r.initGroup()
|
||||||
submitPatchesBox(r.shelf)
|
r.summary = submitPatchesBox(r.stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *patchesWindow) initGroup() *gui.Node {
|
func (r *patchesWindow) initGroup() *gui.Node {
|
||||||
// reposbox.SetExpand(false)
|
// reposbox.SetExpand(false)
|
||||||
group1 := r.stackBox.NewGroup("Filter:")
|
group1 := r.stack.NewGroup("stuff")
|
||||||
|
|
||||||
hbox := group1.Box()
|
vbox := group1.Box()
|
||||||
// hbox.Horizontal()
|
// hbox.Horizontal()
|
||||||
hbox.Vertical()
|
vbox.Vertical()
|
||||||
|
|
||||||
box2 := hbox.Box().Horizontal()
|
hbox := vbox.Box().Horizontal()
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dirty := box2.NewCheckbox("dirty")
|
dirty := hbox.NewCheckbox("dirty")
|
||||||
dirty.Custom = func() {
|
dirty.Custom = func() {
|
||||||
log.Info("filter dirty =", dirty.Checked())
|
log.Info("filter dirty =", dirty.Checked())
|
||||||
}
|
}
|
||||||
|
|
||||||
box2.NewButton("merge user to devel", func() {
|
hbox.NewButton("update patch summary", func() {
|
||||||
r.Disable()
|
r.summary.Update()
|
||||||
defer r.Enable()
|
})
|
||||||
|
hbox.NewButton("test add", func() {
|
||||||
|
me.patchWin.initGroup()
|
||||||
})
|
})
|
||||||
|
|
||||||
box2.NewButton("test master merge", func() {
|
return vbox
|
||||||
r.Disable()
|
|
||||||
r.Enable()
|
|
||||||
})
|
|
||||||
|
|
||||||
box2.NewButton("show apps", func() {
|
|
||||||
})
|
|
||||||
box2.NewButton("re-init forge", func() {
|
|
||||||
log.Info("re-scanning now")
|
|
||||||
})
|
|
||||||
box2.NewButton("ConfigSave()", func() {
|
|
||||||
})
|
|
||||||
box2.NewButton("Table()", func() {
|
|
||||||
me.found = new(gitpb.Repos)
|
|
||||||
loop := me.forge.Repos.All()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Next()
|
|
||||||
me.found.AppendByGoPath(repo)
|
|
||||||
}
|
|
||||||
me.forge.PrintHumanTable(me.found)
|
|
||||||
})
|
|
||||||
box2.NewButton("Prep for release()", func() {
|
|
||||||
})
|
|
||||||
|
|
||||||
return box2
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue