debugging init()

This commit is contained in:
Jeff Carr 2025-02-13 22:28:59 -06:00
parent a264a7d121
commit b64bf96606
Notes: Jeff Carr 2025-02-14 19:31:15 -06:00
// `autogen:go.mod`

module go.wit.com/toolkits/andlabs

go 1.22

toolchain go1.23.6

require (
	go.wit.com/dev/andlabs/ui v0.0.2
	go.wit.com/lib/protobuf/guipb v0.0.2
	go.wit.com/log v0.22.16
	go.wit.com/toolkits/tree v0.22.10
	go.wit.com/widget v1.1.29
)

require google.golang.org/protobuf v1.36.5 // indirect

// `autogen:go.sum`

github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
go.wit.com/dev/andlabs/ui v0.0.2 h1:dJLzeY70rqNG2Mc3f8hf3cmtTeMh/qGXhbUIYo0E4U8=
go.wit.com/dev/andlabs/ui v0.0.2/go.mod h1:Qi27oewjluxZwIEVKTPLzZ0CsuDle2A511Y5SRZN+HM=
go.wit.com/lib/protobuf/guipb v0.0.2 h1:ZR4cLy+XheRQEFLlissBmASJDqiLfHaAluF6wYbVuOo=
go.wit.com/lib/protobuf/guipb v0.0.2/go.mod h1:mZsirb7zRgsE2IGHuvHkG7j85hkrGZl3NAALOEkjowA=
go.wit.com/log v0.22.16 h1:E0Vd0Z2ILtfjhs7J/CQ4g13DK1jtQiYl6l5KOBGsZoA=
go.wit.com/log v0.22.16/go.mod h1:/c5Uj30sWRQ4B5ei2ElB6Q8Si/cK6v+KbxnH208KD84=
go.wit.com/toolkits/tree v0.22.10 h1:h1sHPBenR0Ohj0LG4nL3nW6/deCsbb+qeBmw8Idl6w8=
go.wit.com/toolkits/tree v0.22.10/go.mod h1:BhgxAFb8LxpM/L9e8nM+fQdM9MYi6lInMagRIX5+VTA=
go.wit.com/widget v1.1.29 h1:rURM/N1hbrl0btGlBIUx0SCre9jj+hshvkBLMMa008I=
go.wit.com/widget v1.1.29/go.mod h1:wj7TpAr2gk7Poa+v8XQkH1aidnTdgAa/a8GxrMtcztw=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=

// `autogen:`
8 changed files with 31 additions and 24 deletions

View File

@ -103,15 +103,7 @@ func show(n *tree.Node, b bool) {
}
}
func enableWidget(n *tree.Node) {
enable(n, true)
}
func disableWidget(n *tree.Node) {
enable(n, false)
}
func enable(n *tree.Node, b bool) {
func realEnable(n *tree.Node, b bool) {
if !ready(n) {
return
}

2
add.go
View File

@ -69,7 +69,7 @@ func newAdd(n *tree.Node) {
if n.State.Enable {
// nothing to do
} else {
enable(n, false)
realEnable(n, false)
}
}
}

View File

@ -6,7 +6,7 @@ import (
"go.wit.com/widget"
)
func addText(n *tree.Node, s string) {
func realAddText(n *tree.Node, s string) {
var tk *guiWidget
tk = n.TK.(*guiWidget)
log.Log(ANDLABS, "addText() START with s =", s)

View File

@ -34,7 +34,7 @@ func (t *guiWidget) checked() bool {
return t.uiCheckbox.Checked()
}
func setChecked(n *tree.Node, b bool) {
func realSetChecked(n *tree.Node, b bool) {
if n.WidgetType != widget.Checkbox {
}
var tk *guiWidget

View File

@ -21,9 +21,9 @@ func init() {
short := "andlabs"
NOW = log.NewFlag("NOW", true, full, short, "temp debugging stuff")
INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff")
INFO = log.NewFlag("INFO", true, full, short, "normal debugging stuff")
WARN = log.NewFlag("WARN", false, full, short, "bad things")
WARN = log.NewFlag("WARN", true, full, short, "bad things")
full = "go.wit.com/gui"
short = "andlabs"

26
init.go
View File

@ -37,6 +37,18 @@ func queueAdd(n *tree.Node) {
})
}
func enableWidget(n *tree.Node) {
ui.QueueMain(func() {
realEnable(n, true)
})
}
func disableWidget(n *tree.Node) {
ui.QueueMain(func() {
realEnable(n, false)
})
}
func setTitle(n *tree.Node, s string) {
ui.QueueMain(func() {
SetText(n, s)
@ -45,25 +57,25 @@ func setTitle(n *tree.Node, s string) {
func setLabel(n *tree.Node, s string) {
ui.QueueMain(func() {
SetText(n, s)
realSetText(n, s)
})
}
func realSetText(n *tree.Node, s string) {
func setText(n *tree.Node, s string) {
ui.QueueMain(func() {
SetText(n, s)
realSetText(n, s)
})
}
func realAddText(n *tree.Node, s string) {
func addText(n *tree.Node, s string) {
ui.QueueMain(func() {
AddText(n, s)
realAddText(n, s)
})
}
func realSetChecked(n *tree.Node, b bool) {
func setChecked(n *tree.Node, b bool) {
ui.QueueMain(func() {
setChecked(n, b)
realSetChecked(n, b)
})
}

View File

@ -2,6 +2,7 @@ package main
import (
// "os"
"go.wit.com/dev/andlabs/ui"
_ "go.wit.com/dev/andlabs/ui/winmanifest"
@ -61,13 +62,15 @@ func place(p *tree.Node, n *tree.Node) bool {
log.Sleep(1)
panic("ptk == nil")
}
p.DumpWidget("parent: ")
n.DumpWidget("child: ")
log.Log(INFO, "place() switch", p.WidgetType, n.WidgetId, n.GetProgName())
log.Log(WARN, "place() switch", p.WidgetType, n.WidgetId, n.GetProgName())
switch p.WidgetType {
case widget.Grid:
tk.gridX = n.State.GridOffset.X - 1
tk.gridY = n.State.GridOffset.Y - 1
log.Log(INFO, "place() on Grid at gridX,gridY", tk.gridX, tk.gridY)
log.Log(WARN, "place() on Grid at gridX,gridY", tk.gridX, tk.gridY)
ptk.uiGrid.Append(tk.uiControl,
tk.gridX, tk.gridY, 1, 1,
false, ui.AlignFill, false, ui.AlignFill)

View File

@ -6,7 +6,7 @@ import (
"go.wit.com/widget"
)
func setText(n *tree.Node, name string) {
func realSetText(n *tree.Node, name string) {
// name := widget.GetString(a.Value)
var tk *guiWidget
tk = n.TK.(*guiWidget)