clearer gui. hopefully
This commit is contained in:
parent
d953ae8db6
commit
c5b6539c3b
104
doGui.go
104
doGui.go
|
@ -14,6 +14,7 @@ import (
|
|||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -124,28 +125,14 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
|
||||
me.forgeMode = gadgets.NewOneLiner(grid, "Forge mode")
|
||||
me.forgeMode.SetText(me.forge.GetMode())
|
||||
grid.NextRow()
|
||||
|
||||
// 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("git checkout", func() {
|
||||
me.setBranchB = grid.NewButton("Switch mode (git checkout)", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
|
||||
if me.autoCreateBranches.Checked() {
|
||||
argv.Force = true
|
||||
} else {
|
||||
argv.Force = false
|
||||
}
|
||||
|
||||
// do the checkout
|
||||
if err := doCheckoutShared(); err != nil {
|
||||
log.Info("checkout error:", err)
|
||||
} else {
|
||||
log.Info("checkout was ok")
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
|
@ -165,26 +152,41 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
me.newBranch.AddText("master")
|
||||
me.newBranch.AddText("devel")
|
||||
me.newBranch.AddText(me.forge.Config.GetUsername())
|
||||
me.newBranch.SetText(me.forge.Config.GetUsername())
|
||||
me.argvCheckoutUser = true
|
||||
me.newBranch.Custom = func() {
|
||||
// toggle global values shared by the command line and the gui for doCheckout()
|
||||
me.argvCheckoutUser = false
|
||||
me.argvCheckoutDevel = false
|
||||
me.argvCheckoutMaster = false
|
||||
switch me.newBranch.String() {
|
||||
case "master":
|
||||
me.argvCheckoutMaster = true
|
||||
forgeSwitchMode(forgepb.ForgeMode_MASTER)
|
||||
case "devel":
|
||||
me.argvCheckoutDevel = true
|
||||
forgeSwitchMode(forgepb.ForgeMode_DEVEL)
|
||||
default:
|
||||
me.argvCheckoutUser = true
|
||||
forgeSwitchMode(forgepb.ForgeMode_USER)
|
||||
}
|
||||
log.Info("forged changed to default:", me.newBranch.String())
|
||||
}
|
||||
|
||||
// checking this will automatically make the branches off of devel
|
||||
me.autoCreateBranches = grid.NewCheckbox("auto create branches").SetChecked(true)
|
||||
switch me.forge.Config.Mode {
|
||||
case forgepb.ForgeMode_MASTER:
|
||||
me.newBranch.SetText("master")
|
||||
case forgepb.ForgeMode_DEVEL:
|
||||
me.newBranch.SetText("devel")
|
||||
case forgepb.ForgeMode_USER:
|
||||
me.newBranch.SetText(me.forge.Config.GetUsername())
|
||||
default:
|
||||
me.newBranch.SetText(me.forge.Config.GetUsername())
|
||||
}
|
||||
|
||||
grid.NextRow()
|
||||
|
||||
groupM := vbox.NewGroup("Mode Windows")
|
||||
gridM := groupM.RawGrid()
|
||||
me.modeReleaseW = gridM.NewButton("Release Window", func() {
|
||||
log.Info("todo: move releaser here")
|
||||
log.Info("for now, run guireleaser")
|
||||
})
|
||||
me.modePatchW = gridM.NewButton("Patch Window", func() {
|
||||
})
|
||||
me.modeUserW = gridM.NewButton("Hack Window", func() {
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
group2 := vbox.NewGroup("Repos")
|
||||
|
@ -298,14 +300,14 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
win.Disable()
|
||||
defer win.Enable()
|
||||
|
||||
mergeUserToDevel(me.autoCreateBranches.Checked())
|
||||
mergeUserToDevel(true)
|
||||
})
|
||||
|
||||
grid.NewButton("merge to master", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
|
||||
mergeDevelToMaster(me.autoCreateBranches.Checked())
|
||||
mergeDevelToMaster(true)
|
||||
})
|
||||
|
||||
grid.NewButton("merge all", func() {
|
||||
|
@ -321,7 +323,7 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
log.Info("checkout was ok")
|
||||
}
|
||||
|
||||
mergeUserToDevel(me.autoCreateBranches.Checked())
|
||||
mergeUserToDevel(true)
|
||||
|
||||
me.argvCheckoutUser = false
|
||||
me.argvCheckoutDevel = false
|
||||
|
@ -332,7 +334,7 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
log.Info("checkout was ok")
|
||||
}
|
||||
|
||||
mergeDevelToMaster(me.autoCreateBranches.Checked())
|
||||
mergeDevelToMaster(true)
|
||||
})
|
||||
|
||||
group3 := vbox.NewGroup("work in progress")
|
||||
|
@ -359,6 +361,48 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
})
|
||||
}
|
||||
|
||||
// sets the text in the labels in the window
|
||||
// and hides and shows the buttons
|
||||
func forgeSwitchMode(newMode forgepb.ForgeMode) {
|
||||
if newMode == me.forge.Config.Mode {
|
||||
log.Info("you are already on", newMode.String())
|
||||
return
|
||||
}
|
||||
me.forge.Config.Mode = newMode
|
||||
|
||||
me.forgeMode.SetText(me.forge.GetMode())
|
||||
|
||||
me.argvCheckoutUser = false
|
||||
me.argvCheckoutDevel = false
|
||||
me.argvCheckoutMaster = false
|
||||
|
||||
me.modeReleaseW.Disable()
|
||||
me.modePatchW.Disable()
|
||||
me.modeUserW.Disable()
|
||||
|
||||
switch newMode {
|
||||
case forgepb.ForgeMode_MASTER:
|
||||
me.argvCheckoutMaster = true
|
||||
me.newBranch.SetText("master")
|
||||
me.modeReleaseW.Enable()
|
||||
case forgepb.ForgeMode_DEVEL:
|
||||
me.argvCheckoutDevel = true
|
||||
me.newBranch.SetText("devel")
|
||||
me.modePatchW.Enable()
|
||||
case forgepb.ForgeMode_USER:
|
||||
me.newBranch.SetText(me.forge.Config.GetUsername())
|
||||
me.argvCheckoutUser = true
|
||||
me.modeUserW.Enable()
|
||||
default:
|
||||
me.newBranch.SetText(me.forge.Config.GetUsername())
|
||||
me.argvCheckoutUser = true
|
||||
me.modeUserW.Enable()
|
||||
}
|
||||
|
||||
me.forge.SetConfigSave(true)
|
||||
me.forge.ConfigSave()
|
||||
}
|
||||
|
||||
// this is the magic that generates a window directly from the protocol buffer
|
||||
func makeStandardReposGrid(pb *gitpb.Repos) *gitpb.ReposTable {
|
||||
t := pb.NewTable("testDirty")
|
||||
|
|
11
structs.go
11
structs.go
|
@ -57,14 +57,6 @@ type mainType struct {
|
|||
gitAuthor *gadgets.OneLiner // ENV GIT_AUTHOR NAME and EMAIL
|
||||
forgeMode *gadgets.OneLiner // is the user in 'master', 'devel' or 'user' branches
|
||||
|
||||
// displays a summary of all the repos
|
||||
// has total dirty, total read-only
|
||||
// total patches, etc
|
||||
// summary *patchSummary
|
||||
|
||||
// when switch to user or devel branches, autocreate them
|
||||
autoCreateBranches *gui.Node
|
||||
|
||||
// these hold the branches that the user can switch all
|
||||
// the repositories to them
|
||||
newBranch *gui.Node // deprecate?
|
||||
|
@ -74,6 +66,9 @@ type mainType struct {
|
|||
repoDevelMergeB *gui.Node // "merge to devel" repos button
|
||||
repoWritableB *gui.Node // "what repos are writable" repos button
|
||||
demoB *gui.Node // opens the demo
|
||||
modeReleaseW *gui.Node // opens the release window
|
||||
modePatchW *gui.Node // opens the patch window
|
||||
modeUserW *gui.Node // opens the user/hack window
|
||||
|
||||
argvCheckoutUser bool // shared between the GUI and the command line tools
|
||||
argvCheckoutDevel bool // shared between the GUI and the command line tools
|
||||
|
|
Loading…
Reference in New Issue