make a way to debug sending a widget protobuf tree

This commit is contained in:
Jeff Carr 2025-04-30 14:40:58 -05:00
parent d72602be94
commit 22190f10e3
2 changed files with 25 additions and 2 deletions

View File

@ -7,10 +7,12 @@ import (
) )
var GADGETS *log.LogFlag var GADGETS *log.LogFlag
var WARN *log.LogFlag
func init() { func init() {
full := "go.wit.com/gui" full := "go.wit.com/gui"
short := "gadgets" short := "gadgets"
GADGETS = log.NewFlag("GADGETS", false, full, short, "General Info") GADGETS = log.NewFlag("GADGETS", false, full, short, "General Info")
WARN = log.NewFlag("WARN", true, full, short, "gadgets bad")
} }

View File

@ -21,6 +21,7 @@ type GenericWindow struct {
Group *gui.Node // the first item top box is always a group Group *gui.Node // the first item top box is always a group
Middle *gui.Node // the middle box (shelf style) Middle *gui.Node // the middle box (shelf style)
Bottom *gui.Node // the bottom box (stack style) Bottom *gui.Node // the bottom box (stack style)
UsePB bool // the bottom box (stack style)
Custom func() // a user defined close() window function Custom func() // a user defined close() window function
} }
@ -36,7 +37,17 @@ func (gw *GenericWindow) Hidden() bool {
func (gw *GenericWindow) Toggle() { func (gw *GenericWindow) Toggle() {
if gw.Hidden() { if gw.Hidden() {
gw.Show() if gw.UsePB {
gw.UsePB = false
log.Log(WARN, "Toggle() USING PB")
gw.Win.TestDrawPB(true)
} else {
gw.UsePB = true
log.Log(WARN, "Toggle() USING OLD WAY")
gw.Win.TestDrawPB(false)
}
return
// gw.Show()
} else { } else {
gw.Hide() gw.Hide()
} }
@ -50,6 +61,16 @@ func (gw *GenericWindow) Show() {
return return
} }
gw.Win.Show() gw.Win.Show()
/*
if gw.UsePB {
log.Log(WARN, "Toggle() USING PB")
gw.Win.TestDrawPB(false)
} else {
log.Log(WARN, "Toggle() USING OLD WAY")
gw.Win.TestDrawPB(false)
}
*/
return
} }
func (gw *GenericWindow) Hide() { func (gw *GenericWindow) Hide() {
@ -90,7 +111,7 @@ func NewGenericWindow(title string, grouptxt string) *GenericWindow {
// gw.Win.Make() // gw.Win.Make()
gw.Win.Custom = func() { gw.Win.Custom = func() {
log.Warn("Found Window close. setting hidden=true") log.Log(WARN, "Found Window close. setting hidden=true")
// sets the hidden flag to false so Toggle() works // sets the hidden flag to false so Toggle() works
gw.Win.Hide() gw.Win.Hide()
} }