summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--argv.go2
-rw-r--r--init.go16
-rw-r--r--pluginCheck.go8
-rw-r--r--structs.go24
5 files changed, 27 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 1728c7c..1365e93 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/argv.go b/argv.go
index 5bc4243..8637176 100644
--- a/argv.go
+++ b/argv.go
@@ -36,7 +36,7 @@ func InitArg() {
if argGui.GuiPluginHack != "" {
// does os.Exec() and does not return
- testPluginAndExit()
+ TestPluginAndExit()
}
}
diff --git a/init.go b/init.go
index 87df3c7..10cdcb4 100644
--- a/init.go
+++ b/init.go
@@ -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)
diff --git a/structs.go b/structs.go
index c393037..e8fc0a4 100644
--- a/structs.go
+++ b/structs.go
@@ -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
}
/*