andlabs is still broken

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-08 12:08:57 -05:00
parent e34ec5efbf
commit 821e6d823a
6 changed files with 15 additions and 50 deletions

View File

@ -144,16 +144,12 @@ and allow the 'go-arg' command line args to override the defaults
loads and initializes a toolkit (andlabs/ui, gocui, etc)
### func [Main](/main.go#L197)
### func [Main](/main.go#L198)
`func Main(f func())`
This should not pass a function
### func [Redraw](/redraw.go#L9)
`func Redraw(s string)`
### func [SetDebug](/debug.go#L28)
`func SetDebug(s bool)`
@ -166,7 +162,7 @@ This should not pass a function
`func ShowDebugValues()`
### func [StandardExit](/main.go#L250)
### func [StandardExit](/main.go#L251)
`func StandardExit()`

View File

@ -34,8 +34,6 @@ func main() {
buttonWindow()
log.Println("Main() END")
time.Sleep(1 * time.Second)
// gui.StartS("gocui")
// gui.Redraw("gocui")
gui.Watchdog()
gui.StandardExit()
}
@ -72,7 +70,6 @@ func buttonWindow() {
// this set the xterm and mate-terminal window title. maybe works generally?
fmt.Println("\033]0;" + title + "blah \007")
gui.LoadPlugin("gocui")
gui.Redraw("gocui")
})
g.NewButton("Load 'andlabs'", func () {

View File

@ -97,10 +97,6 @@ func (n *Node) DebugTab(title string) *Node {
startS("gocui")
})
g2.NewButton("Redraw(gocui)", func () {
Redraw("gocui")
})
return newN
}

View File

@ -184,12 +184,13 @@ func startS(name string) *Node {
if (aplug == nil) {
return Config.rootNode
}
/*
// will this really work on mswindows & macos?
f := func() {
}
go Main(f)
*/
sleep(1) // temp hack until chan communication is setup
Config.rootNode.Redraw(aplug)
return Config.rootNode
}
@ -203,8 +204,8 @@ func Main(f func()) {
if (os.Getenv("DISPLAY") == "") {
InitPlugins([]string{"gocui"})
} else {
InitPlugins([]string{"andlabs", "gocui"})
// InitPlugins([]string{"gocui", "andlabs"})
// InitPlugins([]string{"andlabs", "gocui"})
InitPlugins([]string{"gocui", "andlabs"})
}
for _, aplug := range allPlugins {

View File

@ -118,7 +118,10 @@ func LoadToolkit(name string) *aplug {
log(debugPlugin, "gui.LoadToolkit() END", newPlug.name, filename)
newPlug.Init()
Config.rootNode.Redraw(newPlug)
newPlug.pluginChan = newPlug.PluginChannel()
// TODO: find a new way to do this that is locking, safe and accurate
Config.rootNode.redraw(newPlug)
newPlug.LoadOk = true
return newPlug
}

View File

@ -6,32 +6,15 @@ import (
// This recreates the whole GUI for a plugin
func Redraw(s string) {
var p *aplug
log(logNow, "attempt to feed the binary tree to", s)
for _, aplug := range allPlugins {
log("Loaded plugin:", aplug.name, aplug.filename)
if (aplug.name == s) {
log("Found plugin:", aplug.name, aplug.filename)
p = aplug
}
}
if (p == nil) {
log("Plugin", s, "is not loaded")
return
}
Config.rootNode.Redraw(p)
}
// func (n *Node) ListChildren(dump bool, dropdown *Node, mapNodes map[string]*Node) {
func (n *Node) Redraw(p *aplug) {
func (n *Node) redraw(p *aplug) {
if (n == nil) {
return
}
n.redo(p)
for _, child := range n.children {
child.Redraw(p)
child.redraw(p)
}
return
}
@ -48,8 +31,7 @@ func (n *Node) redo(plug *aplug) {
a.WidgetType = n.WidgetType
a.WidgetId = n.id
// used for Windows
// used for new Windows
a.Width = n.Width
a.Height = n.Height
@ -57,7 +39,7 @@ func (n *Node) redo(plug *aplug) {
a.X = n.X
a.Y = n.Y
// used for grids and tables
// implement here for grids and tables ?
// a.NextX = n.NextX
// a.NextY = n.NextY
@ -72,16 +54,6 @@ func (n *Node) redo(plug *aplug) {
a.ParentId = n.parent.id
}
plug.pluginChan = plug.PluginChannel()
// plug.Action(a)
if (plug.pluginChan == nil) {
log(debugNow, "Action() ERRRRRRROR pluginChan == nil", plug.name)
} else {
log(debugNow, "Action() SEND pluginChan", plug.name)
log(debugNow, "Action() SEND pluginChan", plug.name)
log(debugNow, "Action() SEND pluginChan", plug.name)
plug.pluginChan <- *a
}
plug.pluginChan <- *a
sleep(.5)
}