fixing gocui plugin exit()

This commit is contained in:
Jeff Carr 2025-09-03 17:31:22 -05:00
parent f6803f07f1
commit e896cae995
5 changed files with 40 additions and 16 deletions

View File

@ -38,8 +38,10 @@ andlabs: clean install
forge --gui andlabs --gui-verbose forge --gui andlabs --gui-verbose
gocui: install gocui: install
forge --gui gocui --gui-verbose --gui-file ../../toolkits/gocui/gocui.so >/tmp/forge.log 2>&1 forge --gui gocui
# forge --gui gocui --gui-verbose --debugger
gocui-verbose: install
forge --gui gocui --gui-verbose >/tmp/forge.log 2>&1
goimports: goimports:
reset reset

View File

@ -21,6 +21,7 @@ func doConfig() {
log.Info("todo") log.Info("todo")
okExit("") okExit("")
} }
if argv.Config.Register != "" { if argv.Config.Register != "" {
if err := doRegister(argv.Config.Register); err == nil { if err := doRegister(argv.Config.Register); err == nil {
okExit("attempting to register " + argv.Config.Register) okExit("attempting to register " + argv.Config.Register)
@ -51,6 +52,9 @@ func doConfig() {
os.Exit(0) os.Exit(0)
} }
log.Info("config.PathLock =", me.forge.Config.PathLock)
log.Info("config.GoSrc =", me.forge.Config.GoSrc)
me.forge.ConfigPrintTable() me.forge.ConfigPrintTable()
okExit("") okExit("")
} }

View File

@ -92,23 +92,39 @@ func doGui() {
log.Printf("rill repos.Reload() took (%s)\n", shell.FormatDuration(time.Since(now))) log.Printf("rill repos.Reload() took (%s)\n", shell.FormatDuration(time.Since(now)))
os.Exit(0) os.Exit(0)
} }
drawWindow(mainWindow) drawWindow(mainWindow)
// sits here forever // sits here forever
debug() debug()
} }
func drawWindow(win *gadgets.GenericWindow) { func drawWindow(win *gadgets.GenericWindow) {
grid := win.Group.RawGrid() grid := win.Group.RawGrid()
me.goSrcPwd = gadgets.NewOneLiner(grid, "Working Directory") if me.forge.Config.GetPathLock() {
grid.NewLabel("") me.goSrcPwd = gadgets.NewOneLiner(grid, "Working Directory")
me.goSrcPwd.SetText(me.forge.GetGoSrc())
} else {
me.goSrcEdit = gadgets.NewBasicEntry(grid, "Working Directory")
me.goSrcEdit.SetText(me.forge.GetGoSrc())
me.goSrcEdit.Custom = func() {
log.Info("updating text to", me.goSrcEdit.String())
}
}
lockpath := grid.NewCheckbox("Lock").SetChecked(me.forge.Config.PathLock)
lockpath.Custom = func() {
if lockpath.IsChecked() {
log.Info("lock working directory")
me.forge.Config.PathLock = true
} else {
log.Info("unlock working directory")
me.forge.Config.PathLock = false
}
me.forge.Config.ConfigSave()
okExit("you must restart forge after changing the Path Lock")
}
grid.NextRow() grid.NextRow()
me.goSrcPwd.SetText(me.forge.GetGoSrc())
// use ENV GIT_AUTHOR // use ENV GIT_AUTHOR
me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author") me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author")
grid.NextRow() grid.NextRow()

View File

@ -6,18 +6,19 @@ package main
import ( import (
"os" "os"
"go.wit.com/gui"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log" "go.wit.com/log"
) )
func okExit(thing string) { func okExit(thing string) {
if thing != "" { gui.UnloadToolkits()
log.Info("forge exit:", thing, "ok")
}
if configSave { if configSave {
me.forge.SetConfigSave(configSave) me.forge.SetConfigSave(configSave)
} }
// log.Info("Finished go-clean on", check.GetGoPath(), "ok") if thing != "" {
log.Info("forge exit:", thing, "ok")
}
me.forge.Exit() me.forge.Exit()
} }

View File

@ -31,10 +31,11 @@ type mainType struct {
urlbase string // base URL urlbase string // base URL
mainWindow *gadgets.BasicWindow mainWindow *gadgets.BasicWindow
mainbox *gui.Node // the main box. enable/disable this mainbox *gui.Node // the main box. enable/disable this
autoDryRun *gui.Node // checkbox for --dry-run autoDryRun *gui.Node // checkbox for --dry-run
goSrcPwd *gadgets.OneLiner // what is being used as primary directory for your work goSrcPwd *gadgets.OneLiner // what is being used as primary directory for your work
gitAuthor *gadgets.OneLiner // ENV GIT_AUTHOR NAME and EMAIL goSrcEdit *gadgets.BasicEntry // what is being used as primary directory for your work
gitAuthor *gadgets.OneLiner // ENV GIT_AUTHOR NAME and EMAIL
// these hold the branches that the user can switch all the repositories to them // these hold the branches that the user can switch all the repositories to them
reposWinB *gui.Node // button that opens the repos window reposWinB *gui.Node // button that opens the repos window