diff options
| author | Jeff Carr <[email protected]> | 2025-09-09 02:04:56 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-09 02:04:56 -0500 | 
| commit | e799a19b2cca024cb8effa0da7c97de580d7118c (patch) | |
| tree | 304d73cedb885fb40e54242fed4804c13878765d | |
| parent | 3a0f307270baf3eaecd8e21468e4580400d42587 (diff) | |
working on the GUI init processv0.22.54
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | argv.go | 2 | ||||
| -rw-r--r-- | init.go | 16 | ||||
| -rw-r--r-- | pluginCheck.go | 8 | ||||
| -rw-r--r-- | structs.go | 24 | 
5 files changed, 27 insertions, 24 deletions
@@ -6,6 +6,7 @@ all:  	@echo "This is the interface to the GUI GO plugin (ncurses, GTK, etc)"  	@echo  	@echo "note: Feb 2025. this is experimental. being rewritten to use protobufs" +	@echo "note: Sep 2025. still experimental. being refactored to be able to further test protobufs"  	@echo  	@make  goimports vet @@ -36,7 +36,7 @@ func InitArg() {  	if argGui.GuiPluginHack != "" {  		// does os.Exec() and does not return -		testPluginAndExit() +		TestPluginAndExit()  	}  } @@ -43,7 +43,7 @@ func initNew() {  	me.guiChan = make(chan widget.Action, 1)  	version, err := getGuiVersion() -	log.Println("GO GUI version", version, showVersion()+"<Bromeliaceae>", err) +	log.Printf("go.wit.com/gui %s %s %v\n", version, showVersion(), err)  	if version == "" {  		log.Warn("Warning: compiled without version", err)  		log.Sleep(1) @@ -106,9 +106,9 @@ func getGuiVersion() (string, error) {  		// log.Println("GUI build $GUIVERSION", found)  		return found, nil  	} -	found = "pre-v1-GO111" +	found = "pre-v1"  	// log.Println("GUI build version:", found) -	return found, errors.New("GO111 developer build") +	return found, errors.New("CUI colortest line")  }  // lookup the widget by the id sent from the toolkit @@ -325,7 +325,7 @@ func New() *Node {  	*/  	if argGui.GuiPluginHack != "" {  		// does os.Exec() and does not return -		testPluginAndExit() +		TestPluginAndExit()  	}  	if argGui.GuiVerbose { @@ -336,6 +336,12 @@ func New() *Node {  	return me.rootNode  } +func PreInit(postMustParse func(string) string) *Node { +	initNew() +	me.postMustParse = postMustParse +	return me.rootNode +} +  func NoGui() bool {  	return argGui.NoGui  } @@ -346,7 +352,7 @@ func (n *Node) Default() (string, error) {  	// used to check if plugins load or not  	if argGui.GuiPluginHack != "" {  		// does os.Exec() and does not return -		testPluginAndExit() +		TestPluginAndExit()  		os.Exit(0)  	} diff --git a/pluginCheck.go b/pluginCheck.go index 6dc072d..f1514a3 100644 --- a/pluginCheck.go +++ b/pluginCheck.go @@ -60,6 +60,7 @@ func checkPluginCompatibility(pluginPath string) error {  	return nil  } +/*  // tests the plugin file will load  func testPluginOld() {  	_, err := plugin.Open(argGui.GuiPluginHack) @@ -70,17 +71,20 @@ func testPluginOld() {  	log.Log(PLUG, "plugin.Open() SUCCESS loading plugin =", argGui.GuiPluginHack)  	os.Exit(0)  } +*/  func CheckPlugin() string {  	if argGui.GuiPluginHack != "" {  		// does os.Exec() and does not return -		testPluginAndExit() +		TestPluginAndExit()  	}  	return "boo"  }  // loads the plugin, then exits with 0 or -1 -func testPluginAndExit() { +// this is a workaround for GO plugins not cleaning up correctly after +// an attempt to load them +func TestPluginAndExit() {  	log.Log(WARN, "TEST plugin START", argGui.GuiPluginHack)  	absPath, err := filepath.Abs(argGui.GuiPluginHack) @@ -26,23 +26,15 @@ import (  var me guiConfig  type guiConfig struct { -	// a toolkit requirement. never allow more than one per program -	initOnce sync.Once - -	rootNode *Node // This is the master node. The Binary Tree starts here +	rootNode      *Node               // This is the master node. The Binary Tree starts here +	resFS         embed.FS            // option to pass in compiled plugins as embedded files +	guiChan       chan widget.Action  // sets the chan for the plugins to call back too +	tables        []*guipb.Tables     // a list of active protobuf tables +	postMustParse func(string) string // used to get the final go-arg values after all user configuration is finished +	counter       int                 // used to make unique WidgetId's. this is a fun variable, but kinda dumb and should go +	appPlugin     string              // deprecate. what the application would like the default GUI plugin to be +	widgets       *guipb.Widgets      // switch to this and/or tree below  	// tree     *guipb.Tree     // the protobuf. switch to this. deprecate rootNode -	widgets *guipb.Widgets  // don't use this I think -	counter int             // used to make unique WidgetId's -	tables  []*guipb.Tables // a list of active protobuf tables - -	// sets the chan for the plugins to call back too -	guiChan chan widget.Action - -	// option to pass in compiled plugins as embedded files -	resFS embed.FS - -	// what the application would like the default GUI plugin to be -	appPlugin string  }  /*  | 
