andlabs is still broken
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
e34ec5efbf
commit
821e6d823a
|
@ -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()`
|
||||
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -97,10 +97,6 @@ func (n *Node) DebugTab(title string) *Node {
|
|||
startS("gocui")
|
||||
})
|
||||
|
||||
g2.NewButton("Redraw(gocui)", func () {
|
||||
Redraw("gocui")
|
||||
})
|
||||
|
||||
return newN
|
||||
}
|
||||
|
||||
|
|
7
main.go
7
main.go
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
38
redraw.go
38
redraw.go
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue