moved to 'go.wit.com/log'
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
3c2da3f096
commit
02d1d9e50c
|
@ -3,6 +3,8 @@ package main
|
|||
import (
|
||||
"strconv"
|
||||
"github.com/andlabs/ui"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
|
@ -38,11 +40,11 @@ func (n *node) enable(b bool) {
|
|||
}
|
||||
|
||||
func (n *node) pad(at widget.ActionType) {
|
||||
log(logInfo, "pad() on WidgetId =", n.WidgetId)
|
||||
log.Log(INFO, "pad() on WidgetId =", n.WidgetId)
|
||||
|
||||
t := n.tk
|
||||
if (t == nil) {
|
||||
log(logError, "pad() toolkit struct == nil. for", n.WidgetId)
|
||||
log.Log(ERROR, "pad() toolkit struct == nil. for", n.WidgetId)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -103,9 +105,9 @@ func (n *node) pad(at widget.ActionType) {
|
|||
t.uiBox.SetPadded(false)
|
||||
}
|
||||
case widget.Textbox:
|
||||
log(debugError, "TODO: implement ActionType =", at)
|
||||
log.Log(ERROR, "TODO: implement ActionType =", at)
|
||||
default:
|
||||
log(debugError, "TODO: implement pad() for", at)
|
||||
log.Log(ERROR, "TODO: implement pad() for", at)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,29 +123,29 @@ func (n *node) move(newParent *node) {
|
|||
case widget.Grid:
|
||||
// t.uiGrid.SetPadded(true)
|
||||
case widget.Box:
|
||||
log(logInfo, "TODO: move() where =", p.ParentId)
|
||||
log(logInfo, "TODO: move() for widget =", n.WidgetId)
|
||||
log.Log(INFO, "TODO: move() where =", p.ParentId)
|
||||
log.Log(INFO, "TODO: move() for widget =", n.WidgetId)
|
||||
|
||||
stretchy = true
|
||||
if (p.tk.uiBox != nil) {
|
||||
p.tk.uiBox.Append(n.tk.uiControl, stretchy)
|
||||
}
|
||||
// log(debugNow, "is there a tParent parent? =", tParent.parent)
|
||||
// log.Log(NOW, "is there a tParent parent? =", tParent.parent)
|
||||
// tParent.uiBox.Delete(0)
|
||||
|
||||
// this didn't work:
|
||||
// tWidget.uiControl.Disable()
|
||||
// sleep(.8)
|
||||
default:
|
||||
log(logError, "TODO: need to implement move() for type =", n.WidgetType)
|
||||
log(logError, "TODO: need to implement move() for where =", p.ParentId)
|
||||
log(logError, "TODO: need to implement move() for widget =", n.WidgetId)
|
||||
log.Log(ERROR, "TODO: need to implement move() for type =", n.WidgetType)
|
||||
log.Log(ERROR, "TODO: need to implement move() for where =", p.ParentId)
|
||||
log.Log(ERROR, "TODO: need to implement move() for widget =", n.WidgetId)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *node) Delete() {
|
||||
p := n.parent
|
||||
log(debugNow, "uiDelete()", n.WidgetId, "to", p.WidgetId)
|
||||
log.Log(NOW, "uiDelete()", n.WidgetId, "to", p.WidgetId)
|
||||
|
||||
switch p.WidgetType {
|
||||
case widget.Group:
|
||||
|
@ -155,10 +157,10 @@ func (n *node) Delete() {
|
|||
case widget.Grid:
|
||||
// t.uiGrid.SetPadded(true)
|
||||
case widget.Box:
|
||||
log(debugNow, "tWidget.boxC =", p.Name)
|
||||
log(debugNow, "is there a tParent parent? =", p.parent)
|
||||
log.Log(NOW, "tWidget.boxC =", p.Name)
|
||||
log.Log(NOW, "is there a tParent parent? =", p.parent)
|
||||
if (p.tk.boxC < 1) {
|
||||
log(debugNow, "Can not delete from Box. already empty. tWidget.boxC =", p.tk.boxC)
|
||||
log.Log(NOW, "Can not delete from Box. already empty. tWidget.boxC =", p.tk.boxC)
|
||||
return
|
||||
}
|
||||
p.tk.uiBox.Delete(0)
|
||||
|
@ -169,14 +171,14 @@ func (n *node) Delete() {
|
|||
// sleep(.8)
|
||||
// tParent.uiBox.Append(tWidget.uiControl, stretchy)
|
||||
default:
|
||||
log(debugError, "TODO: need to implement uiDelete() for widget =", n.WidgetId, n.WidgetType)
|
||||
log(debugError, "TODO: need to implement uiDelete() for parent =", p.WidgetId, p.WidgetType)
|
||||
log.Log(ERROR, "TODO: need to implement uiDelete() for widget =", n.WidgetId, n.WidgetType)
|
||||
log.Log(ERROR, "TODO: need to implement uiDelete() for parent =", p.WidgetId, p.WidgetType)
|
||||
}
|
||||
}
|
||||
|
||||
func rawAction(a *widget.Action) {
|
||||
log(logInfo, "rawAction() START a.ActionType =", a.ActionType)
|
||||
log(logInfo, "rawAction() START a.S =", a.S)
|
||||
log.Log(INFO, "rawAction() START a.ActionType =", a.ActionType)
|
||||
log.Log(INFO, "rawAction() START a.S =", a.S)
|
||||
|
||||
if (a.ActionType == widget.InitToolkit) {
|
||||
// TODO: make sure to only do this once
|
||||
|
@ -188,10 +190,10 @@ func rawAction(a *widget.Action) {
|
|||
return
|
||||
}
|
||||
|
||||
log(logInfo, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId)
|
||||
log.Log(INFO, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId)
|
||||
switch a.WidgetType {
|
||||
case widget.Flag:
|
||||
flag(a)
|
||||
log.Log(ERROR, "rawAction() RE-IMPLEMENT LOG FLAGS")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -207,17 +209,17 @@ func rawAction(a *widget.Action) {
|
|||
}
|
||||
|
||||
if (a.ActionType == widget.Dump) {
|
||||
log(debugNow, "rawAction() Dump =", a.ActionType, a.WidgetType, n.Name)
|
||||
log.Log(NOW, "rawAction() Dump =", a.ActionType, a.WidgetType, n.Name)
|
||||
me.rootNode.listChildren(true)
|
||||
return
|
||||
}
|
||||
|
||||
if (n == nil) {
|
||||
me.rootNode.listChildren(true)
|
||||
log(true, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType)
|
||||
log(true, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
||||
log(true, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType)
|
||||
log(true, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType)
|
||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType)
|
||||
log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId)
|
||||
return
|
||||
panic("findWidgetId found nil for id = " + strconv.Itoa(a.WidgetId))
|
||||
}
|
||||
|
@ -255,11 +257,11 @@ func rawAction(a *widget.Action) {
|
|||
case widget.Delete:
|
||||
n.Delete()
|
||||
case widget.Move:
|
||||
log(debugNow, "rawAction() attempt to move() =", a.ActionType, a.WidgetType)
|
||||
log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType)
|
||||
newParent := me.rootNode.findWidgetId(a.ParentId)
|
||||
n.move(newParent)
|
||||
default:
|
||||
log(debugError, "rawAction() Unknown =", a.ActionType, a.WidgetType)
|
||||
log.Log(ERROR, "rawAction() Unknown =", a.ActionType, a.WidgetType)
|
||||
}
|
||||
log(logInfo, "rawAction() END =", a.ActionType, a.WidgetType)
|
||||
log.Log(INFO, "rawAction() END =", a.ActionType, a.WidgetType)
|
||||
}
|
||||
|
|
|
@ -4,15 +4,16 @@ import (
|
|||
"github.com/andlabs/ui"
|
||||
_ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func actionDump(b bool, a *widget.Action) {
|
||||
log(b, "actionDump() Widget.Type =", a.ActionType)
|
||||
log(b, "actionDump() Widget.S =", a.S)
|
||||
log(b, "actionDump() Widget.I =", a.I)
|
||||
log(b, "actionDump() WidgetId =", a.WidgetId)
|
||||
log(b, "actionDump() ParentId =", a.ParentId)
|
||||
log.Log(NOW, "actionDump() Widget.Type =", a.ActionType)
|
||||
log.Log(NOW, "actionDump() Widget.S =", a.S)
|
||||
log.Log(NOW, "actionDump() Widget.I =", a.I)
|
||||
log.Log(NOW, "actionDump() WidgetId =", a.WidgetId)
|
||||
log.Log(NOW, "actionDump() ParentId =", a.ParentId)
|
||||
}
|
||||
|
||||
func add(a *widget.Action) {
|
||||
|
@ -67,7 +68,7 @@ func add(a *widget.Action) {
|
|||
p.newImage(n)
|
||||
return
|
||||
default:
|
||||
log(debugError, "add() error TODO: ", n.WidgetType, n.Name)
|
||||
log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,21 +97,21 @@ func add(a *widget.Action) {
|
|||
// -- (0,1) -- (1,1) -- (1,1) --
|
||||
// -----------------------------
|
||||
func (p *node) place(n *node) bool {
|
||||
log(logInfo, "place() START", n.WidgetType, n.Name)
|
||||
log.Log(INFO, "place() START", n.WidgetType, n.Name)
|
||||
|
||||
if (p.tk == nil) {
|
||||
log(logError, "p.tk == nil", p.Name, p.ParentId, p.WidgetType, p.tk)
|
||||
log(logError, "n = ", n.Name, n.ParentId, n.WidgetType, n.tk)
|
||||
log.Log(ERROR, "p.tk == nil", p.Name, p.ParentId, p.WidgetType, p.tk)
|
||||
log.Log(ERROR, "n = ", n.Name, n.ParentId, n.WidgetType, n.tk)
|
||||
panic("p.tk == nil")
|
||||
}
|
||||
|
||||
log(logInfo, "place() switch", p.WidgetType)
|
||||
log.Log(INFO, "place() switch", p.WidgetType)
|
||||
switch p.WidgetType {
|
||||
case widget.Grid:
|
||||
log(logInfo, "place() Grid try at Parent X,Y =", n.X, n.Y)
|
||||
log.Log(INFO, "place() Grid try at Parent X,Y =", n.X, n.Y)
|
||||
n.tk.gridX = n.AtW - 1
|
||||
n.tk.gridY = n.AtH - 1
|
||||
log(logInfo, "place() Grid try at gridX,gridY", n.tk.gridX, n.tk.gridY)
|
||||
log.Log(INFO, "place() Grid try at gridX,gridY", n.tk.gridX, n.tk.gridY)
|
||||
// at the very end, subtract 1 from X & Y since andlabs/ui starts counting at zero
|
||||
p.tk.uiGrid.Append(n.tk.uiControl,
|
||||
n.tk.gridX, n.tk.gridY, 1, 1,
|
||||
|
@ -119,7 +120,7 @@ func (p *node) place(n *node) bool {
|
|||
case widget.Group:
|
||||
if (p.tk.uiBox == nil) {
|
||||
p.tk.uiGroup.SetChild(n.tk.uiControl)
|
||||
log(logInfo, "place() hack Group to use this as the box?", n.Name, n.WidgetType)
|
||||
log.Log(INFO, "place() hack Group to use this as the box?", n.Name, n.WidgetType)
|
||||
p.tk.uiBox = n.tk.uiBox
|
||||
} else {
|
||||
p.tk.uiBox.Append(n.tk.uiControl, stretchy)
|
||||
|
@ -127,23 +128,23 @@ func (p *node) place(n *node) bool {
|
|||
return true
|
||||
case widget.Tab:
|
||||
if (p.tk.uiTab == nil) {
|
||||
log(logError, "p.tk.uiTab == nil for n.WidgetId =", n.WidgetId, "p.tk =", p.tk)
|
||||
log.Log(ERROR, "p.tk.uiTab == nil for n.WidgetId =", n.WidgetId, "p.tk =", p.tk)
|
||||
panic("p.tk.uiTab == nil")
|
||||
}
|
||||
if (n.tk.uiControl == nil) {
|
||||
log(logError, "n.tk.uiControl == nil for n.WidgetId =", n.WidgetId, "n.tk =", n.tk)
|
||||
log.Log(ERROR, "n.tk.uiControl == nil for n.WidgetId =", n.WidgetId, "n.tk =", n.tk)
|
||||
panic("n.tk.uiControl == nil")
|
||||
}
|
||||
log(logError, "CHECK LOGIC ON THIS. APPENDING directly into a window without a tab")
|
||||
// log(logError, "THIS SHOULD NEVER HAPPEN ??????? trying to place() node=", n.WidgetId, n.Name, n.Text, n.WidgetType)
|
||||
// log(logError, "THIS SHOULD NEVER HAPPEN ??????? trying to place() on parent=", p.WidgetId, p.Name, p.Text, p.WidgetType)
|
||||
log.Log(ERROR, "CHECK LOGIC ON THIS. APPENDING directly into a window without a tab")
|
||||
// log.Log(ERROR, "THIS SHOULD NEVER HAPPEN ??????? trying to place() node=", n.WidgetId, n.Name, n.Text, n.WidgetType)
|
||||
// log.Log(ERROR, "THIS SHOULD NEVER HAPPEN ??????? trying to place() on parent=", p.WidgetId, p.Name, p.Text, p.WidgetType)
|
||||
// panic("n.tk.uiControl == nil")
|
||||
p.tk.uiTab.Append(n.Text, n.tk.uiControl)
|
||||
p.tk.boxC += 1
|
||||
return true
|
||||
case widget.Box:
|
||||
log(logInfo, "place() uiBox =", p.tk.uiBox)
|
||||
log(logInfo, "place() uiControl =", n.tk.uiControl)
|
||||
log.Log(INFO, "place() uiBox =", p.tk.uiBox)
|
||||
log.Log(INFO, "place() uiControl =", n.tk.uiControl)
|
||||
p.tk.uiBox.Append(n.tk.uiControl, stretchy)
|
||||
p.tk.boxC += 1
|
||||
return true
|
||||
|
@ -151,7 +152,7 @@ func (p *node) place(n *node) bool {
|
|||
p.tk.uiWindow.SetChild(n.tk.uiControl)
|
||||
return true
|
||||
default:
|
||||
log(debugError, "place() how? Parent =", p.WidgetId, p.WidgetType)
|
||||
log.Log(ERROR, "place() how? Parent =", p.WidgetId, p.WidgetType)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -7,13 +7,9 @@ import (
|
|||
|
||||
// make new Box here
|
||||
func (p *node) newBox(n *node) {
|
||||
log(debugToolkit, "newBox()", n.Name)
|
||||
|
||||
newt := new(guiWidget)
|
||||
var box *ui.Box
|
||||
|
||||
log(debugToolkit, "rawBox() create", n.Name)
|
||||
|
||||
if (n.B) {
|
||||
box = ui.NewHorizontalBox()
|
||||
} else {
|
||||
|
|
|
@ -6,14 +6,7 @@ import (
|
|||
)
|
||||
|
||||
func (p *node) newButton(n *node) {
|
||||
log(debugToolkit, "newButton() START", n.Name)
|
||||
|
||||
t := p.tk
|
||||
if (t == nil) {
|
||||
log(debugToolkit, "newButton() toolkit struct == nil. name=", n.Name)
|
||||
return
|
||||
}
|
||||
|
||||
newt := new(guiWidget)
|
||||
|
||||
b := ui.NewButton(n.Text)
|
||||
|
@ -27,5 +20,4 @@ func (p *node) newButton(n *node) {
|
|||
|
||||
n.tk = newt
|
||||
p.place(n)
|
||||
log(debugToolkit, "newButton() END", n.Name)
|
||||
}
|
||||
|
|
|
@ -7,14 +7,12 @@ import (
|
|||
|
||||
func (p *node) newCheckbox(n *node) {
|
||||
newt := new(guiWidget)
|
||||
log(debugToolkit, "newCheckbox()", n.Name, n.WidgetType)
|
||||
|
||||
newt.uiCheckbox = ui.NewCheckbox(n.Text)
|
||||
newt.uiControl = newt.uiCheckbox
|
||||
|
||||
newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) {
|
||||
n.B = newt.checked()
|
||||
log(debugChange, "val =", n.B)
|
||||
n.doUserEvent()
|
||||
})
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
func (p *node) newCombobox(n *node) {
|
||||
newt := new(guiWidget)
|
||||
log(debugToolkit, "newCombobox() START", n.Name)
|
||||
|
||||
cb := ui.NewEditableCombobox()
|
||||
newt.uiEditableCombobox = cb
|
||||
|
@ -29,7 +28,6 @@ func (p *node) newCombobox(n *node) {
|
|||
func (t *guiWidget) AddComboboxName(title string) {
|
||||
t.uiEditableCombobox.Append(title)
|
||||
if (t.val == nil) {
|
||||
log(debugToolkit, "make map didn't work")
|
||||
return
|
||||
}
|
||||
t.val[t.c] = title
|
||||
|
|
|
@ -2,7 +2,9 @@ package main
|
|||
|
||||
import (
|
||||
"strconv"
|
||||
"go.wit.com/gui/widget"
|
||||
|
||||
"go.wit.com/log"
|
||||
// "go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
var defaultBehavior bool = true
|
||||
|
@ -27,8 +29,8 @@ var debugError bool = true
|
|||
func setDefaultBehavior(s bool) {
|
||||
defaultBehavior = s
|
||||
if (defaultBehavior) {
|
||||
log(debugToolkit, "Setting this toolkit to use the default behavior.")
|
||||
log(debugToolkit, "This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.")
|
||||
log.Log(NOW, "Setting this toolkit to use the default behavior.")
|
||||
log.Log(NOW, "This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.")
|
||||
stretchy = false
|
||||
padded = true
|
||||
menubar = true
|
||||
|
@ -36,53 +38,44 @@ func setDefaultBehavior(s bool) {
|
|||
canvas = false
|
||||
bookshelf = true // 99% of the time, things make a vertical stack of objects
|
||||
} else {
|
||||
log(debugToolkit, "This toolkit is set to ignore the default behavior.")
|
||||
log.Log(NOW, "This toolkit is set to ignore the default behavior.")
|
||||
}
|
||||
}
|
||||
|
||||
func ShowDebug () {
|
||||
log(true, "debugToolkit =", debugToolkit)
|
||||
log(true, "debugChange =", debugChange)
|
||||
log(true, "debugAction =", debugPlugin)
|
||||
log(true, "debugFlags =", debugFlags)
|
||||
log(true, "debugNow =", debugNow)
|
||||
log(true, "debugError =", debugError)
|
||||
}
|
||||
|
||||
func (t *guiWidget) Dump(b bool) {
|
||||
if ! b {
|
||||
return
|
||||
}
|
||||
log(b, "Name = ", t.Width, t.Height)
|
||||
log.Log(NOW, "Name = ", t.Width, t.Height)
|
||||
if (t.uiBox != nil) {
|
||||
log(b, "uiBox =", t.uiBox)
|
||||
log.Log(NOW, "uiBox =", t.uiBox)
|
||||
}
|
||||
if (t.uiButton != nil) {
|
||||
log(b, "uiButton =", t.uiButton)
|
||||
log.Log(NOW, "uiButton =", t.uiButton)
|
||||
}
|
||||
if (t.uiCombobox != nil) {
|
||||
log(b, "uiCombobox =", t.uiCombobox)
|
||||
log.Log(NOW, "uiCombobox =", t.uiCombobox)
|
||||
}
|
||||
if (t.uiWindow != nil) {
|
||||
log(b, "uiWindow =", t.uiWindow)
|
||||
log.Log(NOW, "uiWindow =", t.uiWindow)
|
||||
}
|
||||
if (t.uiTab != nil) {
|
||||
log(b, "uiTab =", t.uiTab)
|
||||
log.Log(NOW, "uiTab =", t.uiTab)
|
||||
}
|
||||
if (t.uiGroup != nil) {
|
||||
log(b, "uiGroup =", t.uiGroup)
|
||||
log.Log(NOW, "uiGroup =", t.uiGroup)
|
||||
}
|
||||
if (t.uiEntry != nil) {
|
||||
log(b, "uiEntry =", t.uiEntry)
|
||||
log.Log(NOW, "uiEntry =", t.uiEntry)
|
||||
}
|
||||
if (t.uiMultilineEntry != nil) {
|
||||
log(b, "uiMultilineEntry =", t.uiMultilineEntry)
|
||||
log.Log(NOW, "uiMultilineEntry =", t.uiMultilineEntry)
|
||||
}
|
||||
if (t.uiSlider != nil) {
|
||||
log(b, "uiSlider =", t.uiSlider)
|
||||
log.Log(NOW, "uiSlider =", t.uiSlider)
|
||||
}
|
||||
if (t.uiCheckbox != nil) {
|
||||
log(b, "uiCheckbox =", t.uiCheckbox)
|
||||
log.Log(NOW, "uiCheckbox =", t.uiCheckbox)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,49 +85,11 @@ func GetDebugToolkit () bool {
|
|||
}
|
||||
*/
|
||||
|
||||
func flag(a *widget.Action) {
|
||||
// should set the checkbox to this value
|
||||
switch a.S {
|
||||
case "Quiet":
|
||||
logInfo = a.B
|
||||
logVerbose = a.B
|
||||
logWarn = a.B
|
||||
logError = a.B
|
||||
case "Error":
|
||||
logError = a.B
|
||||
case "Info":
|
||||
logInfo = a.B
|
||||
case "Verbose":
|
||||
logInfo = a.B
|
||||
logVerbose = a.B
|
||||
logWarn = a.B
|
||||
logError = a.B
|
||||
debugToolkit = a.B
|
||||
debugChange = a.B
|
||||
debugPlugin = a.B
|
||||
debugFlags = a.B
|
||||
case "Toolkit":
|
||||
debugToolkit = a.B
|
||||
case "Change":
|
||||
debugChange = a.B
|
||||
case "Plugin":
|
||||
debugPlugin = a.B
|
||||
case "Flags":
|
||||
debugFlags = a.B
|
||||
case "Now":
|
||||
debugNow = a.B
|
||||
case "Show":
|
||||
ShowDebug()
|
||||
default:
|
||||
log(debugError, "Can't set unknown flag", a.S)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *node) dumpWidget(b bool) {
|
||||
var info, d string
|
||||
|
||||
if (n == nil) {
|
||||
log(debugError, "dumpWidget() node == nil")
|
||||
log.Log(ERROR, "dumpWidget() node == nil")
|
||||
return
|
||||
}
|
||||
info = n.WidgetType.String()
|
||||
|
@ -145,7 +100,7 @@ func (n *node) dumpWidget(b bool) {
|
|||
for i := 0; i < listChildrenDepth; i++ {
|
||||
tabs = tabs + defaultPadding
|
||||
}
|
||||
log(b, tabs + d)
|
||||
log.Log(NOW, tabs + d)
|
||||
}
|
||||
|
||||
var defaultPadding string = " "
|
||||
|
|
|
@ -2,19 +2,22 @@ package main
|
|||
|
||||
// if you include more than just this import
|
||||
// then your plugin might be doing something un-ideal (just a guess from 2023/02/27)
|
||||
import "go.wit.com/gui/widget"
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
// delete the child widget from the parent
|
||||
// p = parent, c = child
|
||||
func (n *node) destroy() {
|
||||
pId := n.parent.WidgetId
|
||||
cId := n.WidgetId
|
||||
log(logNow, "delete()", pId, cId)
|
||||
log.Log(NOW, "delete()", pId, cId)
|
||||
|
||||
pt := n.parent.tk
|
||||
ct := n.tk
|
||||
if (ct == nil) {
|
||||
log(true, "delete FAILED (ct = mapToolkit[c] == nil) for c", pId, cId)
|
||||
log.Log(NOW, "delete FAILED (ct = mapToolkit[c] == nil) for c", pId, cId)
|
||||
// this pukes out a whole universe of shit
|
||||
// listMap()
|
||||
return
|
||||
|
@ -22,15 +25,15 @@ func (n *node) destroy() {
|
|||
|
||||
switch n.WidgetType {
|
||||
case widget.Button:
|
||||
log(true, "Should delete Button here:", n.Name)
|
||||
log(true, "Parent:")
|
||||
log.Log(NOW, "Should delete Button here:", n.Name)
|
||||
log.Log(NOW, "Parent:")
|
||||
pt.Dump(true)
|
||||
log(true, "Child:")
|
||||
log.Log(NOW, "Child:")
|
||||
ct.Dump(true)
|
||||
if (pt.uiBox == nil) {
|
||||
log(true, "Don't know how to destroy this")
|
||||
log.Log(NOW, "Don't know how to destroy this")
|
||||
} else {
|
||||
log(true, "Fuck it, destroy the whole box", n.parent.Name)
|
||||
log.Log(NOW, "Fuck it, destroy the whole box", n.parent.Name)
|
||||
// pt.uiBox.Destroy() // You have a bug: You cannot destroy a uiControl while it still has a parent.
|
||||
pt.uiBox.SetPadded(false)
|
||||
pt.uiBox.Delete(4)
|
||||
|
@ -40,9 +43,9 @@ func (n *node) destroy() {
|
|||
}
|
||||
|
||||
case widget.Window:
|
||||
log(true, "Should delete Window here:", n.Name)
|
||||
log.Log(NOW, "Should delete Window here:", n.Name)
|
||||
default:
|
||||
log(true, "Fuckit, let's destroy a button")
|
||||
log.Log(NOW, "Fuckit, let's destroy a button")
|
||||
if (ct.uiButton != nil) {
|
||||
pt.uiBox.Delete(4)
|
||||
ct.uiButton.Destroy()
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package main
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
import (
|
||||
"github.com/andlabs/ui"
|
||||
_ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
This is a code example taken directly from the toolkit andlabs/ui
|
||||
|
@ -20,7 +24,7 @@ func BlankWindow(w *ui.Window) *ui.Box {
|
|||
func (t *guiWidget) DemoNumbersPage() {
|
||||
var w *ui.Window
|
||||
|
||||
log(debugToolkit, "Starting wit/gui toolkit andlabs/ui DemoNumbersPage()")
|
||||
log.Log(NOW, "Starting wit/gui toolkit andlabs/ui DemoNumbersPage()")
|
||||
|
||||
w = t.uiWindow
|
||||
t.uiBox = makeNumbersPage()
|
||||
|
|
|
@ -4,12 +4,13 @@ import (
|
|||
"github.com/andlabs/ui"
|
||||
_ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (p *node) newDropdown(n *node) {
|
||||
newt := new(guiWidget)
|
||||
log(debugToolkit, "gui.Toolbox.newDropdown() START", n.Name)
|
||||
log.Log(INFO, "gui.Toolbox.newDropdown() START", n.Name)
|
||||
|
||||
cb := ui.NewCombobox()
|
||||
newt.uiCombobox = cb
|
||||
|
@ -22,7 +23,7 @@ func (p *node) newDropdown(n *node) {
|
|||
cb.OnSelected(func(spin *ui.Combobox) {
|
||||
i := spin.Selected()
|
||||
if (newt.val == nil) {
|
||||
log(logError, "make map didn't work")
|
||||
log.Log(ERROR, "make map didn't work")
|
||||
n.S = "map did not work. ui.Combobox error"
|
||||
} else {
|
||||
n.S = newt.val[i]
|
||||
|
@ -37,14 +38,14 @@ func (p *node) newDropdown(n *node) {
|
|||
func (t *guiWidget) addDropdownName(title string) {
|
||||
t.uiCombobox.Append(title)
|
||||
if (t.val == nil) {
|
||||
log(debugToolkit, "make map didn't work")
|
||||
log.Log(INFO, "make map didn't work")
|
||||
return
|
||||
}
|
||||
t.val[t.c] = title
|
||||
|
||||
// If this is the first menu added, set the dropdown to it
|
||||
if (t.c == 0) {
|
||||
log(debugChange, "THIS IS THE FIRST Dropdown", title)
|
||||
log.Log(INFO, "THIS IS THE FIRST Dropdown", title)
|
||||
t.uiCombobox.SetSelected(0)
|
||||
}
|
||||
t.c = t.c + 1
|
||||
|
@ -55,22 +56,22 @@ func (t *guiWidget) SetDropdown(i int) {
|
|||
}
|
||||
|
||||
func (n *node) AddDropdownName(s string) {
|
||||
log(logInfo, "AddDropdownName()", n.WidgetId, "add:", s)
|
||||
log.Log(INFO, "AddDropdownName()", n.WidgetId, "add:", s)
|
||||
|
||||
t := n.tk
|
||||
if (t == nil) {
|
||||
log(logInfo, "AddDropdownName() toolkit struct == nil. name=", n.Name, s)
|
||||
log.Log(INFO, "AddDropdownName() toolkit struct == nil. name=", n.Name, s)
|
||||
return
|
||||
}
|
||||
t.addDropdownName(s)
|
||||
}
|
||||
|
||||
func (n *node) SetDropdownName(a *widget.Action, s string) {
|
||||
log(logInfo, "SetDropdown()", n.WidgetId, ",", s)
|
||||
log.Log(INFO, "SetDropdown()", n.WidgetId, ",", s)
|
||||
|
||||
t := n.tk
|
||||
if (t == nil) {
|
||||
log(debugError, "SetDropdown() FAILED mapToolkits[w] == nil. name=", n.WidgetId, s)
|
||||
log.Log(ERROR, "SetDropdown() FAILED mapToolkits[w] == nil. name=", n.WidgetId, s)
|
||||
return
|
||||
}
|
||||
t.SetDropdown(1)
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
// -----------------------------
|
||||
func (p *node) newGrid(n *node) {
|
||||
var newt *guiWidget
|
||||
log(debugToolkit, "newGrid()", n.WidgetId, "to", n.ParentId)
|
||||
|
||||
newt = new(guiWidget)
|
||||
|
||||
|
|
|
@ -6,12 +6,8 @@ import (
|
|||
)
|
||||
|
||||
func (p *node) newGroup(n *node) {
|
||||
log(debugToolkit, "NewGroup()", n.Name)
|
||||
|
||||
newt := new(guiWidget)
|
||||
|
||||
log(debugToolkit, "NewGroup() create", n.Name)
|
||||
|
||||
g := ui.NewGroup(n.Name)
|
||||
g.SetMargined(margin)
|
||||
newt.uiGroup = g
|
||||
|
|
|
@ -10,8 +10,6 @@ func (p *node) newImage(n *node) {
|
|||
newt := new(guiWidget)
|
||||
var img *ui.Image
|
||||
|
||||
log(debugToolkit, "rawImage() create", n.Name)
|
||||
|
||||
img = ui.NewImage(16, 16)
|
||||
|
||||
newt.uiImage = img
|
||||
|
|
|
@ -6,8 +6,6 @@ import (
|
|||
)
|
||||
|
||||
func (p *node) newLabel(n *node) {
|
||||
log(logInfo, "NewLabel()", n.Name)
|
||||
|
||||
newt := new(guiWidget)
|
||||
c := ui.NewLabel(n.Name)
|
||||
newt.uiLabel = c
|
||||
|
|
|
@ -1,24 +1,34 @@
|
|||
package main
|
||||
|
||||
/*
|
||||
this enables command line options from other packages like 'gui' and 'log'
|
||||
*/
|
||||
|
||||
import (
|
||||
witlog "go.wit.com/log"
|
||||
log "go.wit.com/log"
|
||||
)
|
||||
|
||||
// various debugging flags
|
||||
var logNow bool = true // useful for active development
|
||||
var logError bool = true
|
||||
var logWarn bool = true
|
||||
var logInfo bool = false
|
||||
var logVerbose bool = false
|
||||
var NOW log.LogFlag
|
||||
var INFO log.LogFlag
|
||||
|
||||
func log(b *witlog.LogFlag, a ...any) {
|
||||
witlog.Log(b, a...)
|
||||
}
|
||||
var SPEW log.LogFlag
|
||||
var WARN log.LogFlag
|
||||
|
||||
func sleep(a ...any) {
|
||||
witlog.Sleep(a...)
|
||||
}
|
||||
var ERROR log.LogFlag
|
||||
var CHANGE log.LogFlag
|
||||
var TOOLKIT log.LogFlag
|
||||
|
||||
func exit(a ...any) {
|
||||
witlog.Exit(a...)
|
||||
func init() {
|
||||
full := "toolkit/nocui"
|
||||
short := "nocui"
|
||||
|
||||
NOW.NewFlag( "NOW", true, full, short, "temp debugging stuff")
|
||||
INFO.NewFlag("INFO", false, full, short, "normal debugging stuff")
|
||||
|
||||
WARN.NewFlag("WARN", true, full, short, "bad things")
|
||||
SPEW.NewFlag("SPEW", false, full, short, "spew stuff")
|
||||
|
||||
ERROR.NewFlag("ERROR", false, full, short, "toolkit errors")
|
||||
CHANGE.NewFlag("ERROR", false, full, short, "show when the user does things")
|
||||
TOOLKIT.NewFlag("ERROR", false, full, short, "andlabs specific stuff")
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"sync"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
|
||||
"github.com/andlabs/ui"
|
||||
|
@ -14,30 +15,30 @@ var uiMain sync.Once
|
|||
var muAction sync.Mutex
|
||||
|
||||
func catchActionChannel() {
|
||||
log(logInfo, "catchActionChannel() START")
|
||||
log.Log(INFO, "catchActionChannel() START")
|
||||
for {
|
||||
log(logInfo, "catchActionChannel() for loop")
|
||||
log.Log(INFO, "catchActionChannel() for loop")
|
||||
select {
|
||||
case a := <-pluginChan:
|
||||
log(logInfo, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name)
|
||||
log(logInfo, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
log.Log(INFO, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name)
|
||||
log.Log(INFO, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
muAction.Lock()
|
||||
// TODO ui.QueueMain(f)
|
||||
// TODO ui.QueueMain( func() {rawAction(a)} )
|
||||
ui.QueueMain( func() {rawAction(&a)} )
|
||||
// rawAction(a)
|
||||
muAction.Unlock()
|
||||
log(logInfo, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
log.Log(INFO, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
|
||||
func init() {
|
||||
log(logNow, "Init() START")
|
||||
log(debugToolkit, "Init()")
|
||||
log.Log(INFO, "Init() START")
|
||||
log.Log(INFO, "Init()")
|
||||
// Can you pass values to a plugin init() ? Otherwise, there is no way to safely print
|
||||
// log(debugToolkit, "init() Setting defaultBehavior = true")
|
||||
// log.Log(INFO, "init() Setting defaultBehavior = true")
|
||||
setDefaultBehavior(true)
|
||||
|
||||
|
||||
|
@ -51,7 +52,7 @@ func init() {
|
|||
// andlabs = make(map[int]*andlabsT)
|
||||
pluginChan = make(chan widget.Action, 1)
|
||||
|
||||
log(logNow, "Init() start channel reciever")
|
||||
log.Log(INFO, "Init() start channel reciever")
|
||||
go catchActionChannel()
|
||||
log(logNow, "Init() END")
|
||||
log.Log(INFO, "Init() END")
|
||||
}
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
)
|
||||
|
||||
func (n *node) setText(a *widget.Action) {
|
||||
log(debugChange, "setText() START with a.S =", a.S)
|
||||
log.Log(CHANGE, "setText() START with a.S =", a.S)
|
||||
t := n.tk
|
||||
if (t == nil) {
|
||||
log(debugError, "setText error. tk == nil", n.Name, n.WidgetId)
|
||||
log.Log(ERROR, "setText error. tk == nil", n.Name, n.WidgetId)
|
||||
actionDump(debugError, a)
|
||||
return
|
||||
}
|
||||
log(debugChange, "setText() Attempt on", n.WidgetType, "with", a.S)
|
||||
log.Log(CHANGE, "setText() Attempt on", n.WidgetType, "with", a.S)
|
||||
|
||||
switch n.WidgetType {
|
||||
case widget.Window:
|
||||
|
@ -30,7 +31,7 @@ func (n *node) setText(a *widget.Action) {
|
|||
// TODO: commented out while working on chan
|
||||
t.uiCheckbox.SetChecked(a.B)
|
||||
default:
|
||||
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
}
|
||||
case widget.Textbox:
|
||||
switch a.ActionType {
|
||||
|
@ -49,7 +50,7 @@ func (n *node) setText(a *widget.Action) {
|
|||
t.uiMultilineEntry.SetText(a.S)
|
||||
}
|
||||
default:
|
||||
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
}
|
||||
case widget.Label:
|
||||
t.uiLabel.SetText(a.S)
|
||||
|
@ -62,7 +63,7 @@ func (n *node) setText(a *widget.Action) {
|
|||
case widget.Set:
|
||||
t.uiSlider.SetValue(a.I)
|
||||
default:
|
||||
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
}
|
||||
case widget.Spinner:
|
||||
switch a.ActionType {
|
||||
|
@ -71,7 +72,7 @@ func (n *node) setText(a *widget.Action) {
|
|||
case widget.Set:
|
||||
t.uiSpinbox.SetValue(a.I)
|
||||
default:
|
||||
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
}
|
||||
case widget.Dropdown:
|
||||
switch a.ActionType {
|
||||
|
@ -82,17 +83,17 @@ func (n *node) setText(a *widget.Action) {
|
|||
var i int = -1
|
||||
var s string
|
||||
orig = t.uiCombobox.Selected()
|
||||
log(debugChange, "try to set the Dropdown to", a.S, "from", orig)
|
||||
log.Log(CHANGE, "try to set the Dropdown to", a.S, "from", orig)
|
||||
// try to find the string
|
||||
for i, s = range t.val {
|
||||
log(debugChange, "i, s", i, s)
|
||||
log.Log(CHANGE, "i, s", i, s)
|
||||
if (a.S == s) {
|
||||
t.uiCombobox.SetSelected(i)
|
||||
log(debugChange, "setText() Dropdown worked.", n.S)
|
||||
log.Log(CHANGE, "setText() Dropdown worked.", n.S)
|
||||
return
|
||||
}
|
||||
}
|
||||
log(debugError, "setText() Dropdown did not find:", a.S)
|
||||
log.Log(ERROR, "setText() Dropdown did not find:", a.S)
|
||||
// if i == -1, then there are not any things in the menu to select
|
||||
if (i == -1) {
|
||||
return
|
||||
|
@ -106,7 +107,7 @@ func (n *node) setText(a *widget.Action) {
|
|||
case widget.GetText:
|
||||
// t.S = t.s
|
||||
default:
|
||||
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
}
|
||||
case widget.Combobox:
|
||||
switch a.ActionType {
|
||||
|
@ -119,10 +120,10 @@ func (n *node) setText(a *widget.Action) {
|
|||
t.uiEditableCombobox.SetText(a.S)
|
||||
n.S = a.S
|
||||
default:
|
||||
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
log.Log(ERROR, "setText() unknown", a.ActionType, "on checkbox", n.Name)
|
||||
}
|
||||
default:
|
||||
log(debugError, "plugin Send() Don't know how to setText on", n.WidgetType, "yet", a.ActionType)
|
||||
log.Log(ERROR, "plugin Send() Don't know how to setText on", n.WidgetType, "yet", a.ActionType)
|
||||
}
|
||||
log(debugChange, "setText() END with a.S =", a.S)
|
||||
log.Log(CHANGE, "setText() END with a.S =", a.S)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/gui/widget"
|
||||
|
||||
"github.com/andlabs/ui"
|
||||
|
@ -23,24 +24,24 @@ func (p *node) newTab(n *node) {
|
|||
var newt *guiWidget
|
||||
|
||||
if (p == nil) {
|
||||
log(debugError, "newTab() p == nil. how the fuck does this happen?", n.WidgetId, n.ParentId)
|
||||
log.Log(ERROR, "newTab() p == nil. how the fuck does this happen?", n.WidgetId, n.ParentId)
|
||||
}
|
||||
if (p.WidgetType != widget.Window) {
|
||||
log(debugError, "newTab() uiWindow == nil. I can't add a toolbar without window", n.WidgetId, n.ParentId)
|
||||
log.Log(ERROR, "newTab() uiWindow == nil. I can't add a toolbar without window", n.WidgetId, n.ParentId)
|
||||
return
|
||||
}
|
||||
t := p.tk
|
||||
|
||||
log(debugToolkit, "newTab() START", n.WidgetId, n.ParentId)
|
||||
log.Log(TOOLKIT, "newTab() START", n.WidgetId, n.ParentId)
|
||||
|
||||
if (t.uiTab == nil) {
|
||||
// this means you have to make a new tab
|
||||
log(debugToolkit, "newTab() GOOD. This should be the first tab:", n.WidgetId, n.ParentId)
|
||||
log.Log(TOOLKIT, "newTab() GOOD. This should be the first tab:", n.WidgetId, n.ParentId)
|
||||
newt = rawTab(t.uiWindow, n.Text)
|
||||
t.uiTab = newt.uiTab
|
||||
} else {
|
||||
// this means you have to append a tab
|
||||
log(debugToolkit, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId)
|
||||
log.Log(TOOLKIT, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId)
|
||||
if (n.WidgetType == widget.Tab) {
|
||||
// andlabs doesn't have multiple tab widgets so make a fake one?
|
||||
// this makes a guiWidget internal structure with the parent values
|
||||
|
@ -61,19 +62,19 @@ func (p *node) newTab(n *node) {
|
|||
func tabSetMargined(tab *ui.Tab, b bool) {
|
||||
c := tab.NumPages()
|
||||
for i := 0; i < c; i++ {
|
||||
log(debugToolkit, "SetMargined", i, b)
|
||||
log.Log(TOOLKIT, "SetMargined", i, b)
|
||||
tab.SetMargined(i, b)
|
||||
}
|
||||
}
|
||||
|
||||
func rawTab(w *ui.Window, name string) *guiWidget {
|
||||
var newt guiWidget
|
||||
log(debugToolkit, "rawTab() START", name)
|
||||
log.Log(TOOLKIT, "rawTab() START", name)
|
||||
|
||||
if (w == nil) {
|
||||
log(debugError, "UiWindow == nil. I can't add a tab without a window")
|
||||
log(debugError, "UiWindow == nil. I can't add a tab without a window")
|
||||
log(debugError, "UiWindow == nil. I can't add a tab without a window")
|
||||
log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window")
|
||||
log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window")
|
||||
log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window")
|
||||
// sleep(1)
|
||||
return nil
|
||||
}
|
||||
|
@ -82,19 +83,19 @@ func rawTab(w *ui.Window, name string) *guiWidget {
|
|||
w.SetChild(tab)
|
||||
newt.uiTab = tab
|
||||
newt.uiControl = tab
|
||||
log(debugToolkit, "rawTab() END", name)
|
||||
log.Log(TOOLKIT, "rawTab() END", name)
|
||||
return &newt
|
||||
}
|
||||
|
||||
func (t *guiWidget) appendTab(name string) *guiWidget {
|
||||
var newT guiWidget
|
||||
log(debugToolkit, "appendTab() ADD", name)
|
||||
log.Log(TOOLKIT, "appendTab() ADD", name)
|
||||
|
||||
if (t.uiTab == nil) {
|
||||
log(debugToolkit, "UiWindow == nil. I can't add a widget without a place to put it")
|
||||
log.Log(TOOLKIT, "UiWindow == nil. I can't add a widget without a place to put it")
|
||||
panic("should never have happened. wit/gui/toolkit has ui.Tab == nil")
|
||||
}
|
||||
log(debugToolkit, "appendTab() START name =", name)
|
||||
log.Log(TOOLKIT, "appendTab() START name =", name)
|
||||
|
||||
var hbox *ui.Box
|
||||
if (defaultBehavior) {
|
||||
|
|
|
@ -11,7 +11,6 @@ func initWidget(n *node) *guiWidget {
|
|||
// Set(w, "default")
|
||||
|
||||
if n.WidgetType == widget.Root {
|
||||
log(logInfo, "setupWidget() FOUND ROOT w.id =", n.WidgetId)
|
||||
n.WidgetId = 0
|
||||
me.rootNode = n
|
||||
return w
|
||||
|
|
|
@ -3,6 +3,8 @@ package main
|
|||
import (
|
||||
"github.com/andlabs/ui"
|
||||
_ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func (t *guiWidget) MessageWindow(msg1 string, msg2 string) {
|
||||
|
@ -35,12 +37,12 @@ func newWindow(n *node) {
|
|||
}
|
||||
|
||||
func (n *node) SetWindowTitle(title string) {
|
||||
log(debugToolkit, "toolkit NewWindow", n.Text, "title", title)
|
||||
log.Log(CHANGE, "toolkit NewWindow", n.Text, "title", title)
|
||||
win := n.tk.uiWindow
|
||||
if (win == nil) {
|
||||
log(debugError, "Error: no window", n.WidgetId)
|
||||
log.Log(ERROR, "Error: no window", n.WidgetId)
|
||||
} else {
|
||||
win.SetTitle(title)
|
||||
log(debugToolkit, "Setting the window title", title)
|
||||
log.Log(CHANGE, "Setting the window title", title)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue