summaryrefslogtreecommitdiff
path: root/view.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-28 21:15:15 -0600
committerJeff Carr <[email protected]>2024-01-28 21:15:15 -0600
commit4fa1dd75b04aad0a85d171a1d333d799a61ba713 (patch)
tree0be1a50a84f40b73829cc6f570d60dcdbc8434f2 /view.go
parent1d7b9613a68abdd41ad1cf0b6803b0ab6593e813 (diff)
sizes are getting better
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'view.go')
-rw-r--r--view.go36
1 files changed, 12 insertions, 24 deletions
diff --git a/view.go b/view.go
index 389a141..138e2df 100644
--- a/view.go
+++ b/view.go
@@ -4,6 +4,7 @@ import (
"bufio"
"errors"
"fmt"
+ "strconv"
"strings"
"github.com/awesome-gocui/gocui"
@@ -55,34 +56,32 @@ func (w *guiWidget) hideView() {
// display's the text of the widget in gocui
// will create a new gocui view if there isn't one or if it has been moved
func (w *guiWidget) showView() {
- var err error
-
if w.cuiName == "" {
log.Log(ERROR, "showView() w.cuiName was not set for widget", w)
- w.cuiName = string(w.node.WidgetId)
+ w.cuiName = strconv.Itoa(w.node.WidgetId) + " TK"
}
- log.Log(ERROR, "showView() labelN =", w.labelN)
+ log.Log(INFO, "showView() labelN =", w.labelN)
// if the gocui element doesn't exist, create it
if w.v == nil {
w.recreateView()
}
- x0, y0, x1, y1, err := me.baseGui.ViewPosition(w.cuiName)
- log.Log(INFO, "showView() w.v already defined for widget", w.String(), x0, y0, x1, y1, err)
+ x0, y0, x1, y1, _ := me.baseGui.ViewPosition(w.cuiName)
+ // x0, y0, x1, y1, err := me.baseGui.ViewPosition(w.cuiName)
+ // log.Log(INFO, "showView() w.v already defined for widget", w.String(), x0, y0, x1, y1, err)
// n.smartGocuiSize()
changed := w.textResize()
- if changed {
- log.Log(NOW, "showView() textResize() changed. Should recreateView here wId =", w.cuiName)
- } else {
- log.Log(NOW, "showView() Clear() and Fprint() here wId =", w.cuiName)
+ if !changed {
+ log.Log(INFO, "showView() Clear() and Fprint() here wId =", w.cuiName)
w.v.Clear()
fmt.Fprint(w.v, w.labelN)
w.SetVisible(false)
w.SetVisible(true)
return
}
+ log.Log(INFO, "showView() textResize() changed. Should recreateView here wId =", w.cuiName)
// if the gocui element has changed where it is supposed to be on the screen
// recreate it
@@ -96,7 +95,7 @@ func (w *guiWidget) showView() {
return
}
if x1 != w.gocuiSize.w1 {
- log.Log(ERROR, "showView() too wide", w.cuiName, "w,w", w.gocuiSize.w1, x1)
+ log.Log(INFO, "showView() too wide", w.cuiName, "w,w", w.gocuiSize.w1, x1)
w.recreateView()
return
}
@@ -113,7 +112,7 @@ func (w *guiWidget) showView() {
// deletes the old view if it exists and recreates it
func (w *guiWidget) recreateView() {
var err error
- log.Log(ERROR, "recreateView() START", w.WidgetType, w.String())
+ log.Log(INFO, "recreateView() START", w.WidgetType, w.String())
if me.baseGui == nil {
log.Log(ERROR, "recreateView() ERROR: me.baseGui == nil", w)
return
@@ -123,13 +122,6 @@ func (w *guiWidget) recreateView() {
me.baseGui.DeleteView(w.cuiName)
w.v = nil
- if w.String() == "CLOUDFLARE_EMAIL" {
- w.showWidgetPlacement("n.String()=" + w.String() + " n.tk.label=" + w.labelN + " " + w.cuiName)
- // w.dumpWidget("jwc")
- w.textResize()
- w.showWidgetPlacement("n.String()=" + w.String() + " n.tk.label=" + w.labelN + " " + w.cuiName)
- }
-
a := w.gocuiSize.w0
b := w.gocuiSize.h0
c := w.gocuiSize.w1
@@ -173,11 +165,7 @@ func (w *guiWidget) recreateView() {
w.v.SelFgColor = w.color.selFg
w.v.SelBgColor = w.color.selBg
}
- if w.String() == "CLOUDFLARE_EMAIL" {
- w.showWidgetPlacement("w.String()=" + w.String() + " w.label=" + w.labelN + " " + w.cuiName)
- w.dumpTree("cloudflare")
- }
- log.Log(ERROR, "recreateView() END")
+ log.Log(INFO, "recreateView() END")
}
func (w *guiWidget) hideWidgets() {