use dumpWidget() where possible

This commit is contained in:
Jeff Carr 2025-02-01 13:58:53 -06:00
parent e4f0524bdf
commit 417b3e5225
4 changed files with 11 additions and 15 deletions

View File

@ -173,7 +173,7 @@ func dropdownUnclicked(w, h int) {
// examine everything under X & Y on the screen) // examine everything under X & Y on the screen)
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
// log.Log(GOCUI, fmt.Sprintf("findByXY() (dropdown) %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String())) // tk.dumpWidget("dropdownUnclicked()")
if tk.WidgetType == widget.Dropdown { if tk.WidgetType == widget.Dropdown {
d = tk d = tk
} }

View File

@ -4,7 +4,6 @@
package main package main
import ( import (
"fmt"
"syscall" "syscall"
"github.com/awesome-gocui/gocui" "github.com/awesome-gocui/gocui"
@ -68,11 +67,11 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
w, h := g.MousePosition() w, h := g.MousePosition()
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
if tk.WidgetType == widget.Stdout { if tk.WidgetType == widget.Stdout {
log.Log(GOCUI, fmt.Sprintf("findByXY() '2' key %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String())) tk.dumpWidget("theNotsure()")
log.Info("skipping stdout") log.Info("skipping stdout")
continue continue
} }
log.Log(GOCUI, fmt.Sprintf("findByXY() HIDDING %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String())) tk.dumpWidget("theNotsure() HIDDING")
tk.Hide() tk.Hide()
} }
return nil return nil
@ -137,7 +136,7 @@ func openDebuggger(g *gocui.Gui, v *gocui.View) error {
func theFind(g *gocui.Gui, v *gocui.View) error { func theFind(g *gocui.Gui, v *gocui.View) error {
w, h := g.MousePosition() w, h := g.MousePosition()
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() 'f' key %-8s wId=%4d at (%3d,%3d) %s", tk.WidgetType, tk.node.WidgetId, w, h, tk.node.String())) tk.dumpWidget("theFind()")
} }
return nil return nil
} }

View File

@ -35,8 +35,7 @@ func mouseMove(g *gocui.Gui) {
if me.supermouse { if me.supermouse {
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
tk.dumpWidget("findByXY()") tk.dumpWidget("mouseMove()")
// log.Log(GOCUI, fmt.Sprintf("findByXY() mouseMove() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h))
} }
} }
@ -56,7 +55,7 @@ func msgDown(g *gocui.Gui, v *gocui.View) error {
h := initialMouseY h := initialMouseY
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() msgDown() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h)) tk.dumpWidget("mouseDown()")
} }
// debugging output // debugging output
@ -78,7 +77,7 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
// useful to debug everything that is being clicked on // useful to debug everything that is being clicked on
/* /*
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
log.Log(GOCUI, fmt.Sprintf("findByXY() mouseUp() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h)) tk.dumpWidget("mouseUp()")
} }
*/ */
@ -109,11 +108,11 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
var found bool = false var found bool = false
for _, tk := range findByXY(mx, my) { for _, tk := range findByXY(mx, my) {
log.Log(GOCUI, fmt.Sprintf("findByXY() mouseDown() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, mx, my)) tk.dumpWidget("mouseDown()")
found = true found = true
} }
if !found { if !found {
log.Log(GOCUI, fmt.Sprintf("findByXY() mouseDown() found nothing at (%d,%d)", mx, my)) log.Log(GOCUI, fmt.Sprintf("mouseDown() found nothing at (%d,%d)", mx, my))
} }
vx0, vy0, vx1, vy1, err := g.ViewPosition("msg") vx0, vy0, vx1, vy1, err := g.ViewPosition("msg")

View File

@ -4,8 +4,6 @@
package main package main
import ( import (
"fmt"
"github.com/awesome-gocui/gocui" "github.com/awesome-gocui/gocui"
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/widget" "go.wit.com/widget"
@ -85,7 +83,7 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
tk.showDropdown() tk.showDropdown()
me.dropdownW = tk me.dropdownW = tk
default: default:
log.Log(GOCUI, fmt.Sprintf("findByXY() blank click() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h)) tk.dumpWidget("blank click()")
} }
} }
@ -98,7 +96,7 @@ func click(g *gocui.Gui, v *gocui.View) error {
for _, tk := range findByXY(w, h) { for _, tk := range findByXY(w, h) {
// will show you everything found on a mouse click. great for debugging! // will show you everything found on a mouse click. great for debugging!
// log.Log(GOCUI, fmt.Sprintf("findByXY() click() %s wId=%d cuiName=%s at (%d,%d)", tk.WidgetType, tk.node.WidgetId, tk.cuiName, w, h)) // tk.dumpWidget("click()")
if tk.WidgetType == widget.Stdout { if tk.WidgetType == widget.Stdout {
// don't send clicks to the stdout debugging window // don't send clicks to the stdout debugging window
continue continue