diff options
Diffstat (limited to 'view.go')
| -rw-r--r-- | view.go | 36 |
1 files changed, 12 insertions, 24 deletions
@@ -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() { |
