better function names
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
0fd60847fc
commit
0adbbecdac
30
action.go
30
action.go
|
@ -205,8 +205,8 @@ func (n *node) Delete() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func rawAction(a *widget.Action) {
|
func processAction(a *widget.Action) {
|
||||||
log.Log(INFO, "rawAction() START a.ActionType =", a.ActionType, "a.Value", a.Value)
|
log.Log(INFO, "processAction() START a.ActionType =", a.ActionType, "a.Value", a.Value)
|
||||||
|
|
||||||
if a.ActionType == widget.ToolkitInit {
|
if a.ActionType == widget.ToolkitInit {
|
||||||
Init()
|
Init()
|
||||||
|
@ -219,10 +219,10 @@ func rawAction(a *widget.Action) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Warn("andlabs rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId, a.ActionType)
|
log.Warn("andlabs processAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId, a.ActionType)
|
||||||
switch a.WidgetType {
|
switch a.WidgetType {
|
||||||
case widget.Flag:
|
case widget.Flag:
|
||||||
log.Log(ERROR, "rawAction() RE-IMPLEMENT LOG FLAGS")
|
log.Log(ERROR, "processAction() RE-IMPLEMENT LOG FLAGS")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,26 +233,20 @@ func rawAction(a *widget.Action) {
|
||||||
n := me.treeRoot.FindWidgetId(a.WidgetId)
|
n := me.treeRoot.FindWidgetId(a.WidgetId)
|
||||||
|
|
||||||
if a.ActionType == widget.Add {
|
if a.ActionType == widget.Add {
|
||||||
me.treeRoot.ListWidgets()
|
|
||||||
// ui.QueueMain(func() {
|
|
||||||
add(a)
|
add(a)
|
||||||
// })
|
|
||||||
// TODO: remove this artificial delay
|
|
||||||
// sleep(.001)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.ActionType == widget.Dump {
|
if a.ActionType == widget.Dump {
|
||||||
log.Log(NOW, "rawAction() Dump =", a.ActionType, a.WidgetType, n.State.ProgName)
|
log.Log(NOW, "processAction() Dump =", a.ActionType, a.WidgetType, n.State.ProgName)
|
||||||
// me.rootNode.listChildren(true)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if n == nil {
|
if n == nil {
|
||||||
log.Error(errors.New("andlabs rawAction() ERROR findWidgetId found nil"), a.ActionType, a.WidgetType)
|
log.Error(errors.New("andlabs processAction() ERROR findWidgetId found nil"), a.ActionType, a.WidgetType)
|
||||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
log.Log(NOW, "processAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
||||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType)
|
log.Log(NOW, "processAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType)
|
||||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
log.Log(NOW, "processAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
||||||
me.treeRoot.ListWidgets()
|
me.treeRoot.ListWidgets()
|
||||||
return
|
return
|
||||||
panic("findWidgetId found nil for id = " + string(a.WidgetId))
|
panic("findWidgetId found nil for id = " + string(a.WidgetId))
|
||||||
|
@ -301,10 +295,10 @@ func rawAction(a *widget.Action) {
|
||||||
case widget.Delete:
|
case widget.Delete:
|
||||||
n.Delete()
|
n.Delete()
|
||||||
case widget.Move:
|
case widget.Move:
|
||||||
log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType)
|
log.Log(NOW, "processAction() attempt to move() =", a.ActionType, a.WidgetType)
|
||||||
*/
|
*/
|
||||||
default:
|
default:
|
||||||
log.Log(ERROR, "rawAction() Unknown =", a.ActionType, a.WidgetType)
|
log.Log(ERROR, "processAction() Unknown =", a.ActionType, a.WidgetType)
|
||||||
}
|
}
|
||||||
log.Log(INFO, "rawAction() END =", a.ActionType, a.WidgetType)
|
log.Log(INFO, "processAction() END =", a.ActionType, a.WidgetType)
|
||||||
}
|
}
|
||||||
|
|
1
add.go
1
add.go
|
@ -13,7 +13,6 @@ func add(a *widget.Action) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// n := addNode(a)
|
|
||||||
n := me.myTree.AddNode(a)
|
n := me.myTree.AddNode(a)
|
||||||
|
|
||||||
p := n.Parent
|
p := n.Parent
|
||||||
|
|
16
main.go
16
main.go
|
@ -18,6 +18,8 @@ var uiMain sync.Once
|
||||||
var muAction sync.Mutex
|
var muAction sync.Mutex
|
||||||
|
|
||||||
func queueMain(currentA widget.Action) {
|
func queueMain(currentA widget.Action) {
|
||||||
|
/*
|
||||||
|
// this never happends
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Warn("YAHOOOO Recovered in queueMain() application:", r)
|
log.Warn("YAHOOOO Recovered in queueMain() application:", r)
|
||||||
|
@ -27,8 +29,15 @@ func queueMain(currentA widget.Action) {
|
||||||
me.myTree.DoToolkitPanic()
|
me.myTree.DoToolkitPanic()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
*/
|
||||||
|
// andlabs puts this inside the gofunction over there
|
||||||
|
// probably this should be changed around here
|
||||||
|
// and only andlabs stuff should be sent there?
|
||||||
|
// it's easier to code it this way however
|
||||||
|
// also, if it dies here, it get's caught
|
||||||
|
// usually, this is where it dies
|
||||||
ui.QueueMain(func() {
|
ui.QueueMain(func() {
|
||||||
rawAction(¤tA)
|
processAction(¤tA)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +52,10 @@ func guiMain() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
ui.Main(func() {
|
ui.Main(func() {
|
||||||
demoUI()
|
// this is a bad hack for now.
|
||||||
|
// a better way would be to spawn ui.Main on the first actual window
|
||||||
|
// that is supposed to be displayed
|
||||||
|
placeholderUI()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
updateui.go
12
updateui.go
|
@ -11,6 +11,18 @@ import (
|
||||||
|
|
||||||
var count int
|
var count int
|
||||||
|
|
||||||
|
func placeholderUI() {
|
||||||
|
mainWindow := ui.NewWindow("libui placeholder", 640, 480, true)
|
||||||
|
mainWindow.OnClosing(func(*ui.Window) bool {
|
||||||
|
ui.Quit()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
ui.OnShouldQuit(func() bool {
|
||||||
|
mainWindow.Destroy()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func demoUI() {
|
func demoUI() {
|
||||||
mainWindow := ui.NewWindow("libui Updating UI", 640, 480, true)
|
mainWindow := ui.NewWindow("libui Updating UI", 640, 480, true)
|
||||||
mainWindow.OnClosing(func(*ui.Window) bool {
|
mainWindow.OnClosing(func(*ui.Window) bool {
|
||||||
|
|
|
@ -28,7 +28,7 @@ func newWindow(p, n *tree.Node) {
|
||||||
win.OnClosing(func(*ui.Window) bool {
|
win.OnClosing(func(*ui.Window) bool {
|
||||||
// show(n, false)
|
// show(n, false)
|
||||||
me.myTree.DoWindowCloseEvent(n)
|
me.myTree.DoWindowCloseEvent(n)
|
||||||
return false
|
return true
|
||||||
})
|
})
|
||||||
newt.uiWindow = win
|
newt.uiWindow = win
|
||||||
newt.uiControl = win
|
newt.uiControl = win
|
||||||
|
|
Loading…
Reference in New Issue