switch mode button logic
This commit is contained in:
parent
1ea717ce36
commit
37c6d5a6b5
55
doGui.go
55
doGui.go
|
@ -104,7 +104,7 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
|
||||
vbox := box.NewVerticalBox("BOX2")
|
||||
|
||||
group1 := vbox.NewGroup("Forge Settings")
|
||||
group1 := vbox.NewGroup("Current Settings")
|
||||
grid := group1.NewGrid("buildOptions", 0, 0)
|
||||
|
||||
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||
|
@ -137,34 +137,37 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
me.forgeMode = gadgets.NewOneLiner(grid, "Forge mode")
|
||||
me.forgeMode.SetText(me.forge.GetMode())
|
||||
|
||||
// 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("Switch mode (git checkout)", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
})
|
||||
|
||||
/*
|
||||
me.setBranchB = grid.NewButton("git repos", func() {
|
||||
t := me.forge.Repos.NewTable()
|
||||
fp := t.AddFullPath("Full Path")
|
||||
fp.Custom( func() {
|
||||
log.Info("this is the full path")
|
||||
})
|
||||
t.AddMasterVersion("master version")
|
||||
|
||||
t.Show()
|
||||
})
|
||||
*/
|
||||
|
||||
me.newBranch = grid.NewDropdown()
|
||||
me.newBranch.AddText("master")
|
||||
me.newBranch.AddText("devel")
|
||||
me.newBranch.AddText(me.forge.Config.GetUsername())
|
||||
me.newBranch.Custom = func() {
|
||||
me.setBranchB.Disable()
|
||||
// toggle global values shared by the command line and the gui for doCheckout()
|
||||
switch me.newBranch.String() {
|
||||
case "master":
|
||||
if me.forge.Config.Mode != forgepb.ForgeMode_MASTER {
|
||||
me.setBranchB.Enable()
|
||||
}
|
||||
case "devel":
|
||||
if me.forge.Config.Mode != forgepb.ForgeMode_DEVEL {
|
||||
me.setBranchB.Enable()
|
||||
}
|
||||
default:
|
||||
if me.forge.Config.Mode != forgepb.ForgeMode_USER {
|
||||
me.setBranchB.Enable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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("Switch mode", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
|
||||
switch me.newBranch.String() {
|
||||
case "master":
|
||||
forgeSwitchMode(forgepb.ForgeMode_MASTER)
|
||||
|
@ -173,7 +176,10 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
default:
|
||||
forgeSwitchMode(forgepb.ForgeMode_USER)
|
||||
}
|
||||
}
|
||||
|
||||
me.setBranchB.Disable()
|
||||
})
|
||||
me.setBranchB.Disable()
|
||||
|
||||
switch me.forge.Config.Mode {
|
||||
case forgepb.ForgeMode_MASTER:
|
||||
|
@ -387,7 +393,6 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
grid.NewButton("Configure", func() {
|
||||
log.Info("add a forge config window here")
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// sets the text in the labels in the window
|
||||
|
|
Loading…
Reference in New Issue