quiet output

This commit is contained in:
Jeff Carr 2025-02-06 14:13:31 -06:00
parent 88f33afbb7
commit 5675307497
4 changed files with 30 additions and 23 deletions

View File

@ -100,7 +100,7 @@ func theNotsure(g *gocui.Gui, v *gocui.View) error {
} }
func tabCycleWindows(g *gocui.Gui, v *gocui.View) error { func tabCycleWindows(g *gocui.Gui, v *gocui.View) error {
log.Info("try to switch windows here") // log.Info("try to switch windows here")
if len(me.allwin) != len(findWindows()) { if len(me.allwin) != len(findWindows()) {
me.allwin = findWindows() me.allwin = findWindows()
} }

View File

@ -63,11 +63,11 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
return nil return nil
} }
tk.makeWindowActive() tk.makeWindowActive()
log.Info("SENDING mouseDown() to findWindowUnderMouse()") // log.Info("SENDING mouseDown() to findWindowUnderMouse()")
if tk.node.WidgetType == widget.Window { if tk.node.WidgetType == widget.Window {
// check to see if this is a direct click on a widget // check to see if this is a direct click on a widget
for _, tk := range tk.findByXYreal(w, h) { for _, tk := range tk.findByXYreal(w, h) {
tk.dumpWidget("mouseDown()") // tk.dumpWidget("mouseDown()")
if tk.node.WidgetType == widget.Button { if tk.node.WidgetType == widget.Button {
log.Info("SENDING CLICK TO Button") log.Info("SENDING CLICK TO Button")
tk.doWidgetClick(w, h) tk.doWidgetClick(w, h)
@ -90,6 +90,7 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
} }
} }
} }
tk.dumpWidget("mouseDown() drag")
me.currentDrag = tk me.currentDrag = tk
tk.dragW = w - tk.gocuiSize.w0 tk.dragW = w - tk.gocuiSize.w0
tk.dragH = h - tk.gocuiSize.h0 tk.dragH = h - tk.gocuiSize.h0

29
find.go
View File

@ -4,7 +4,6 @@
package main package main
import ( import (
"fmt"
"slices" "slices"
"github.com/awesome-gocui/gocui" "github.com/awesome-gocui/gocui"
@ -141,21 +140,23 @@ func findWindowUnderMouse() *guiWidget {
// if the stdout window is on top, check it first // if the stdout window is on top, check it first
if me.stdout.outputOnTop { if me.stdout.outputOnTop {
if me.stdout.tk.full.inRect(w, h) { if me.stdout.tk.full.inRect(w, h) {
log.Info(fmt.Sprintf("findWindowUnderMouse() found %s stdout on top (%dx%d)", me.stdout.tk.cuiName, w, h)) // log.Info(fmt.Sprintf("findWindowUnderMouse() found %s stdout on top (%dx%d)", me.stdout.tk.cuiName, w, h))
return me.stdout.tk return me.stdout.tk
} }
} }
// print out the window list /*
for _, tk := range me.allwin { // print out the window list
log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order) for _, tk := range me.allwin {
} log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order)
}
*/
// now check if the active window is below the mouse // now check if the active window is below the mouse
for _, tk := range me.allwin { for _, tk := range me.allwin {
if tk.window.active { if tk.window.active {
if tk.full.inRect(w, h) { if tk.full.inRect(w, h) {
log.Info(fmt.Sprintf("findWindowUnderMouse() found %s active window (%dx%d)", tk.cuiName, w, h)) // log.Info(fmt.Sprintf("findWindowUnderMouse() found %s active window (%dx%d)", tk.cuiName, w, h))
return tk return tk
} }
} }
@ -167,20 +168,22 @@ func findWindowUnderMouse() *guiWidget {
return a.window.order - b.window.order return a.window.order - b.window.order
}) })
// print out the window list /*
for _, tk := range me.allwin { // print out the window list
log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order) for _, tk := range me.allwin {
} log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order)
}
*/
for _, win := range me.allwin { for _, win := range me.allwin {
if win.full.inRect(w, h) { if win.full.inRect(w, h) {
log.Info(fmt.Sprintf("findWindowUnderMouse() found %s window (%dx%d)", win.cuiName, w, h)) // log.Info(fmt.Sprintf("findWindowUnderMouse() found %s window (%dx%d)", win.cuiName, w, h))
return win return win
} }
} }
// okay, no window. maybe the stdout is there? // okay, no window. maybe the stdout is there?
if me.stdout.tk.full.inRect(w, h) { if me.stdout.tk.full.inRect(w, h) {
log.Info(fmt.Sprintf("findWindowUnderMouse() found %s stdout (%dx%d)", me.stdout.tk.cuiName, w, h)) // log.Info(fmt.Sprintf("findWindowUnderMouse() found %s stdout (%dx%d)", me.stdout.tk.cuiName, w, h))
return me.stdout.tk return me.stdout.tk
} }

View File

@ -6,7 +6,6 @@ package main
import ( import (
"fmt" "fmt"
log "go.wit.com/log"
"go.wit.com/toolkits/tree" "go.wit.com/toolkits/tree"
"go.wit.com/widget" "go.wit.com/widget"
) )
@ -40,14 +39,16 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
tk.setFullSize() tk.setFullSize()
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0) me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
tk.Show() tk.Show()
tk.v.Clear()
fmt.Fprint(tk.v, "ZZZ"+tk.GetText())
tk.showWidgets() tk.showWidgets()
// RE-VERIFY THIS CAN'T BE DONE IN A BETTER WAY. However, for now, this works finally so I am leaving it alone // RE-VERIFY THIS CAN'T BE DONE IN A BETTER WAY. However, for now, this works finally so I am leaving it alone
if tk.windowFrame == nil { if tk.windowFrame == nil {
tk.addWindowFrameTK(0 - tk.node.WidgetId) tk.addWindowFrameTK(0 - tk.node.WidgetId)
tk.windowFrame.node.State.Label = "windowFrame" tk.windowFrame.node.State.Label = " ZZzzzFrame" // temporary name. blank out when ready for release
tk.windowFrame.makeTK([]string{"windowFrame"}) tk.windowFrame.makeTK([]string{" ZZzzzFrame"})
} }
// this seems to correctly create the window frame // this seems to correctly create the window frame
@ -143,8 +144,10 @@ func (tk *guiWidget) makeWindowActive() {
tk.window.active = true tk.window.active = true
tk.window.order = 0 tk.window.order = 0
// print out the window list /*
for _, tk := range me.allwin { // print out the window list
log.Info("makeWindowActive() Window", tk.labelN, tk.window.active, tk.window.order) for _, tk := range me.allwin {
} log.Info("makeWindowActive() Window", tk.labelN, tk.window.active, tk.window.order)
}
*/
} }