From 8f4fab40ea439b851934e8bf82ea54cb9bbecf1b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 18 Oct 2025 09:23:02 -0500 Subject: gui opens again --- argv.template.go | 17 ++++++++--------- main.go | 12 ++++++++++-- structs.go | 8 ++++++-- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/argv.template.go b/argv.template.go index 5ca2ff7..a4dd38a 100644 --- a/argv.template.go +++ b/argv.template.go @@ -10,11 +10,9 @@ import ( "go.wit.com/dev/alexflint/arg" "go.wit.com/gui" + "go.wit.com/lib/fhelp" ) -// this must be global until further development and abstraction -var argvpp *arg.Parser // the go-arg parser of the command line - func (args) InitArgv() (string, string, string) { return APPNAME, BUILDTIME, VERSION } @@ -22,25 +20,26 @@ func (args) InitArgv() (string, string, string) { // this function will send the current argv PB to go-args for parsing func (args) ParseFlags(flags []string) error { var err error - if argvpp == nil { + if me.pp == nil { // log.Info("Parse Flags GOT flags:", flags) - argvpp, err = arg.ParseFlags(flags, &argv) + me.pp, err = arg.ParseFlags(flags, &argv) // panic("got to the app's ParseFlags()") } else { - panic("argvpp was not nil") + panic("me.pp was not nil") } return err } // this will print the help for the subcmd func (args) WriteHelpForAutocomplete(part string, subcmd ...string) error { - return argvpp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, part, subcmd...) + return me.pp.WriteHelpForAutocomplete(os.Stderr, os.Stdout, part, subcmd...) } func (args) InitGui() error { // panic("got here") arg.Register(&gui.ArgvGui) - // me.myGui = gui.New() + // me.gui = gui.PreInit() + me.myGui = fhelp.Gui() return nil } @@ -49,7 +48,7 @@ func (args) Help() string { } func (args) MustParse() error { - argvpp = arg.MustParse(&argv) + me.pp = arg.MustParse(&argv) return nil } diff --git a/main.go b/main.go index c92965e..197f465 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ var computers *gui.Node var colors *gui.Node func main() { - me := new(mainType) + me = new(mainType) me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args helloworld() @@ -32,7 +32,15 @@ func main() { // This initializes the first window and some widgets func helloworld() { - mainWindow = gui.RawWindow("primary helloworld window").SetProgName("BASEWIN1") + if me.myGui == nil { + panic("gui is nil") + } + me.myGui.Start() + // me.gui = gui.PreInit() + // me.myGui = fhelp.Gui() + me.gui = me.myGui.Init() + mainWindow = me.gui.RawWindow("primary helloworld window").SetProgName("BASEWIN1") + mainWindow.Show() box := mainWindow.NewBox("vbox", false) group := box.NewGroup("choices") diff --git a/structs.go b/structs.go index e98287e..7caffda 100644 --- a/structs.go +++ b/structs.go @@ -4,7 +4,9 @@ package main import ( + "go.wit.com/dev/alexflint/arg" "go.wit.com/gui" + "go.wit.com/lib/fhelp" "go.wit.com/lib/protobuf/argvpb" ) @@ -12,6 +14,8 @@ var me *mainType // this app's variables type mainType struct { - argv *argvpb.Argv // shell autocomplete - gui *gui.Node // the gui toolkit handle + argv *argvpb.Argv // shell autocomplete + pp *arg.Parser // the go-arg parser of the command line + gui *gui.Node // the gui toolkit handle + myGui *fhelp.GuiPrep } -- cgit v1.2.3