var value any

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-11 19:10:24 -06:00
parent c4582b0b30
commit 3b258d0ce0
20 changed files with 94 additions and 111 deletions

View File

@ -28,10 +28,10 @@ func (n *node) setFake() {
// set the widget start width & height // set the widget start width & height
func (n *node) addWidget() { func (n *node) addWidget() {
nw := n.tk nw := n.tk
log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.Name) log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.progname)
switch n.WidgetType { switch n.WidgetType {
case widget.Root: case widget.Root:
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.Name) log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.progname)
nw.color = &colorRoot nw.color = &colorRoot
n.setFake() n.setFake()
return return

View File

@ -5,19 +5,19 @@ import (
"go.wit.com/gui/widget" "go.wit.com/gui/widget"
) )
func (n *node) setCheckbox(b bool) { func (n *node) setCheckbox(b any) {
w := n.tk w := n.tk
if (n.WidgetType != widget.Checkbox) { if (n.WidgetType != widget.Checkbox) {
return return
} }
if (b) { if widget.GetBool(b) {
n.B = b n.value = b
n.Text = "X " + n.Name n.tk.label = "X " + n.label
} else { } else {
n.B = b n.value = b
n.Text = " " + n.Name n.tk.label = " " + n.label
} }
t := len(n.Text) + 1 t := len(n.tk.label) + 1
w.gocuiSize.w1 = w.gocuiSize.w0 + t w.gocuiSize.w1 = w.gocuiSize.w0 + t
// w.realWidth = w.gocuiSize.Width() + me.PadW // w.realWidth = w.gocuiSize.Width() + me.PadW

View File

@ -26,7 +26,7 @@ func unsetCurrent(n *node) {
// of the current widgets if that widget is supposed // of the current widgets if that widget is supposed
// to be in current display // to be in current display
func (n *node) updateCurrent() { func (n *node) updateCurrent() {
log.Log(NOW, "updateCurrent()", n.Name) log.Log(NOW, "updateCurrent()", n.progname)
if n.WidgetType == widget.Tab { if n.WidgetType == widget.Tab {
if n.IsCurrent() { if n.IsCurrent() {
// n.tk.color = &colorActiveT // n.tk.color = &colorActiveT
@ -84,17 +84,17 @@ func setCurrentTab(n *node) {
w.isCurrent = true w.isCurrent = true
p := n.parent.tk p := n.parent.tk
p.isCurrent = true p.isCurrent = true
log.Log(NOW, "setCurrent()", n.Name) log.Log(NOW, "setCurrent()", n.progname)
} }
func (n *node) doWidgetClick() { func (n *node) doWidgetClick() {
switch n.WidgetType { switch n.WidgetType {
case widget.Root: case widget.Root:
// THIS IS THE BEGINING OF THE LAYOUT // THIS IS THE BEGINING OF THE LAYOUT
log.Log(NOW, "doWidgetClick()", n.Name) log.Log(NOW, "doWidgetClick()", n.progname)
redoWindows(0,0) redoWindows(0,0)
case widget.Flag: case widget.Flag:
log.Log(NOW, "doWidgetClick() FLAG widget name =", n.Name) log.Log(NOW, "doWidgetClick() FLAG widget name =", n.progname)
log.Log(NOW, "doWidgetClick() if this is the dropdown menu, handle it here?") log.Log(NOW, "doWidgetClick() if this is the dropdown menu, handle it here?")
case widget.Window: case widget.Window:
if (me.currentWindow == n) { if (me.currentWindow == n) {
@ -112,7 +112,7 @@ func (n *node) doWidgetClick() {
n.redoTabs(me.TabW, me.TabH) n.redoTabs(me.TabW, me.TabH)
for _, child := range n.children { for _, child := range n.children {
if (child.currentTab == true) { if (child.currentTab == true) {
log.Log(NOW, "FOUND CURRENT TAB", child.Name) log.Log(NOW, "FOUND CURRENT TAB", child.progname)
setCurrentTab(child) setCurrentTab(child)
child.placeWidgets(me.RawW, me.RawH) child.placeWidgets(me.RawW, me.RawH)
child.showWidgets() child.showWidgets()
@ -149,7 +149,7 @@ func (n *node) doWidgetClick() {
// n.placeWidgets(p.tk.startH, newH) // n.placeWidgets(p.tk.startH, newH)
n.toggleTree() n.toggleTree()
case widget.Checkbox: case widget.Checkbox:
if (n.B) { if (widget.GetBool(n.value)) {
n.setCheckbox(false) n.setCheckbox(false)
} else { } else {
n.setCheckbox(true) n.setCheckbox(true)
@ -166,10 +166,10 @@ func (n *node) doWidgetClick() {
n.showWidgets() n.showWidgets()
case widget.Box: case widget.Box:
// w.showWidgetPlacement(logNow, "drawTree()") // w.showWidgetPlacement(logNow, "drawTree()")
if (n.horizontal) { if (n.direction == widget.Horizontal) {
log.Log(NOW, "BOX IS HORIZONTAL", n.Name) log.Log(NOW, "BOX IS HORIZONTAL", n.progname)
} else { } else {
log.Log(NOW, "BOX IS VERTICAL", n.Name) log.Log(NOW, "BOX IS VERTICAL", n.progname)
} }
// n.placeWidgets() // n.placeWidgets()
n.toggleTree() n.toggleTree()
@ -207,17 +207,17 @@ func (n *node) doWidgetClick() {
} else { } else {
var dnsList string var dnsList string
for i, s := range n.vals { for i, s := range n.vals {
log.Log(NOW, "AddText()", n.Name, i, s) log.Log(NOW, "AddText()", n.progname, i, s)
dnsList += s + "\n" dnsList += s + "\n"
} }
me.ddNode = n me.ddNode = n
log.Log(NOW, "new dns list should be set to:", dnsList) log.Log(NOW, "new dns list should be set to:", dnsList)
me.ddview.Text = dnsList me.ddview.label = dnsList
me.ddview.SetText(dnsList) me.ddview.SetText(dnsList)
me.ddview.SetVisible(true) me.ddview.SetVisible(true)
} }
for i, s := range n.vals { for i, s := range n.vals {
log.Log(NOW, "AddText()", n.Name, i, s) log.Log(NOW, "AddText()", n.progname, i, s)
} }
default: default:
} }
@ -262,8 +262,8 @@ func click(g *gocui.Gui, v *gocui.View) error {
// n := me.rootNode.findWidgetName(v.Name()) // n := me.rootNode.findWidgetName(v.Name())
n := findUnderMouse() n := findUnderMouse()
if (n != nil) { if (n != nil) {
log.Log(NOW, "click() Found widget =", n.WidgetId, n.Name, ",", n.Text) log.Log(NOW, "click() Found widget =", n.WidgetId, n.progname, ",", n.label)
if (n.Name == "DropBox") { if (n.progname == "DropBox") {
log.Log(NOW, "click() this is the dropdown menu. set a flag here what did I click? where is the mouse?") log.Log(NOW, "click() this is the dropdown menu. set a flag here what did I click? where is the mouse?")
log.Log(NOW, "click() set a global dropdown clicked flag=true here") log.Log(NOW, "click() set a global dropdown clicked flag=true here")
me.ddClicked = true me.ddClicked = true
@ -333,7 +333,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
found = findUnderMouse() found = findUnderMouse()
if (me.ctrlDown == nil) { if (me.ctrlDown == nil) {
setupCtrlDownWidget() setupCtrlDownWidget()
me.ctrlDown.Text = found.Name me.ctrlDown.label = found.progname
me.ctrlDown.tk.cuiName = "ctrlDown" me.ctrlDown.tk.cuiName = "ctrlDown"
// me.ctrlDown.parent = me.rootNode // me.ctrlDown.parent = me.rootNode
} }
@ -341,7 +341,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
if (found == nil) { if (found == nil) {
found = me.rootNode found = me.rootNode
} }
me.ctrlDown.Text = found.Name me.ctrlDown.label = found.progname
newR := found.realGocuiSize() newR := found.realGocuiSize()
cd.gocuiSize.w0 = newR.w0 cd.gocuiSize.w0 = newR.w0
cd.gocuiSize.h0 = newR.h0 cd.gocuiSize.h0 = newR.h0

View File

@ -46,12 +46,12 @@ func (n *node) showWidgetPlacement(b bool, s string) {
s1 += fmt.Sprintf("At(%2d,%2d) ", n.AtW, n.AtH) s1 += fmt.Sprintf("At(%2d,%2d) ", n.AtW, n.AtH)
} }
} }
tmp := "." + n.Name + "." tmp := "." + n.progname + "."
log.Log(INFO, s1, s, n.WidgetType, ",", tmp) // , "text=", w.text) log.Log(INFO, s1, s, n.WidgetType, ",", tmp) // , "text=", w.text)
} }
func (n *node) dumpWidget(pad string) { func (n *node) dumpWidget(pad string) {
log.Log(NOW, "node:", pad, n.WidgetId, "At(", n.AtW, n.AtH, ") ,", n.WidgetType, ", n.Name =", n.Name, ", n.Text =", n.Text) log.Log(NOW, "node:", pad, n.WidgetId, "At(", n.AtW, n.AtH, ") ,", n.WidgetType, ", n.progname =", n.progname, ", n.label =", n.label)
} }
func (n *node) listWidgets() { func (n *node) listWidgets() {

View File

@ -144,7 +144,7 @@ func addDebugKeys(g *gocui.Gui) {
func(g *gocui.Gui, v *gocui.View) error { func(g *gocui.Gui, v *gocui.View) error {
if (showDebug) { if (showDebug) {
var a widget.Action var a widget.Action
a.B = true a.Value = true
a.ActionType = widget.EnableDebug a.ActionType = widget.EnableDebug
callback <- a callback <- a
} }

View File

@ -45,7 +45,7 @@ func catchActionChannel() {
log.Log(ERROR, "ERROR: console did not initialize") log.Log(ERROR, "ERROR: console did not initialize")
continue continue
} }
log.Log(INFO, "catchActionChannel()", a.WidgetId, a.ActionType, a.WidgetType, a.Name) log.Log(INFO, "catchActionChannel()", a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
action(&a) action(&a)
} }
} }

View File

@ -86,7 +86,7 @@ func mouseUp(g *gocui.Gui, v *gocui.View) error {
if (newZone != "") { if (newZone != "") {
if (me.ddNode != nil) { if (me.ddNode != nil) {
me.ddNode.SetText(newZone) me.ddNode.SetText(newZone)
me.ddNode.S = newZone me.ddNode.value = newZone
me.ddNode.doUserEvent() me.ddNode.doUserEvent()
} }
} }

View File

@ -21,12 +21,12 @@ func (n *node) placeBox(startW int, startH int) {
newR := child.realGocuiSize() newR := child.realGocuiSize()
w := newR.w1 - newR.w0 w := newR.w1 - newR.w0
h := newR.h1 - newR.h0 h := newR.h1 - newR.h0
if (n.horizontal) { if (n.direction == widget.Horizontal) {
log.Log(NOW, "BOX IS HORIZONTAL", n.Name, "newWH()", newW, newH, "child()", w, h, child.Name) log.Log(NOW, "BOX IS HORIZONTAL", n.progname, "newWH()", newW, newH, "child()", w, h, child.progname)
// expand based on the child width // expand based on the child width
newW += w newW += w
} else { } else {
log.Log(NOW, "BOX IS VERTICAL ", n.Name, "newWH()", newW, newH, "child()", w, h, child.Name) log.Log(NOW, "BOX IS VERTICAL ", n.progname, "newWH()", newW, newH, "child()", w, h, child.progname)
// expand based on the child height // expand based on the child height
newH += h newH += h
} }
@ -105,7 +105,7 @@ func (n *node) placeGrid(startW int, startH int) {
w.heights[child.AtH] = childH w.heights[child.AtH] = childH
} }
// child.showWidgetPlacement(logInfo, "grid: ") // child.showWidgetPlacement(logInfo, "grid: ")
log.Log(INFO, "placeGrid:", child.Name, "child()", childW, childH, "At()", child.AtW, child.AtH) log.Log(INFO, "placeGrid:", child.progname, "child()", childW, childH, "At()", child.AtW, child.AtH)
} }
// find the width and height offset of the grid for AtW,AtH // find the width and height offset of the grid for AtW,AtH
@ -128,7 +128,7 @@ func (n *node) placeGrid(startW int, startH int) {
newW := startW + totalW newW := startW + totalW
newH := startH + totalH newH := startH + totalH
log.Log(INFO, "placeGrid:", child.Name, "new()", newW, newH, "At()", child.AtW, child.AtH) log.Log(INFO, "placeGrid:", child.progname, "new()", newW, newH, "At()", child.AtW, child.AtH)
child.placeWidgets(newW, newH) child.placeWidgets(newW, newH)
child.showWidgetPlacement(true, "grid2:") child.showWidgetPlacement(true, "grid2:")
} }
@ -178,7 +178,7 @@ func (n *node) realGocuiSize() *rectType {
func (n *node) textSize() (int, int) { func (n *node) textSize() (int, int) {
var width, height int var width, height int
for _, s := range strings.Split(n.Text, "\n") { for _, s := range strings.Split(widget.GetString(n.value), "\n") {
if (width < len(s)) { if (width < len(s)) {
width = len(s) width = len(s)
} }

View File

@ -8,7 +8,7 @@ import (
) )
func action(a *widget.Action) { func action(a *widget.Action) {
log.Log(INFO, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.Name) log.Log(INFO, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
n := me.rootNode.findWidgetId(a.WidgetId) n := me.rootNode.findWidgetId(a.WidgetId)
var w *guiWidget var w *guiWidget
if (n != nil) { if (n != nil) {
@ -24,32 +24,32 @@ func action(a *widget.Action) {
// this is done to protect the plugin being 'refreshed' with the // this is done to protect the plugin being 'refreshed' with the
// widget binary tree. TODO: find a way to keep them in sync // widget binary tree. TODO: find a way to keep them in sync
log.Log(ERROR, "action() Add ignored for already defined widget", log.Log(ERROR, "action() Add ignored for already defined widget",
a.WidgetId, a.ActionType, a.WidgetType, a.Name) a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
} }
case widget.Show: case widget.Show:
if (a.B) { if widget.GetBool(a.Value) {
n.showView() n.showView()
} else { } else {
n.hideWidgets() n.hideWidgets()
} }
case widget.Set: case widget.Set:
if a.WidgetType == widget.Flag { if a.WidgetType == widget.Flag {
log.Log(NOW, "TODO: set flag here", a.ActionType, a.WidgetType, a.Name) log.Log(NOW, "TODO: set flag here", a.ActionType, a.WidgetType, a.ProgName)
log.Log(NOW, "TODO: n.WidgetType =", n.WidgetType, "n.Name =", a.Name) log.Log(NOW, "TODO: n.WidgetType =", n.WidgetType, "n.progname =", a.ProgName)
} else { } else {
if (a.A == nil) { if (a.Value == nil) {
log.Log(ERROR, "TODO: Set here. a == nil id =", a.WidgetId, "type =", a.WidgetType, "Name =", a.Name) log.Log(ERROR, "TODO: Set here. a == nil id =", a.WidgetId, "type =", a.WidgetType, "Name =", a.ProgName)
log.Log(ERROR, "TODO: Set here. id =", a.WidgetId, "n.Name =", n.Name) log.Log(ERROR, "TODO: Set here. id =", a.WidgetId, "n.progname =", n.progname)
} else { } else {
n.Set(a.A) n.Set(a.Value)
} }
} }
case widget.SetText: case widget.SetText:
n.SetText(a.S) n.SetText(widget.GetString(a.Value))
case widget.AddText: case widget.AddText:
n.AddText(a.S) n.AddText(widget.GetString(a.Value))
case widget.Move: case widget.Move:
log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.Name) log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.ProgName)
case widget.CloseToolkit: case widget.CloseToolkit:
log.Log(NOW, "attempting to close the plugin and release stdout and stderr") log.Log(NOW, "attempting to close the plugin and release stdout and stderr")
standardExit() standardExit()
@ -57,18 +57,18 @@ func action(a *widget.Action) {
if n.Visible() { if n.Visible() {
// widget was already shown // widget was already shown
} else { } else {
log.Log(INFO, "Setting Visable to true", a.Name) log.Log(INFO, "Setting Visable to true", a.ProgName)
n.SetVisible(true) n.SetVisible(true)
} }
case widget.Disable: case widget.Disable:
if n.Visible() { if n.Visible() {
log.Log(INFO, "Setting Visable to false", a.Name) log.Log(INFO, "Setting Visable to false", a.ProgName)
n.SetVisible(false) n.SetVisible(false)
} else { } else {
// widget was already hidden // widget was already hidden
} }
default: default:
log.Log(ERROR, "action() ActionType =", a.ActionType, "WidgetType =", a.WidgetType, "Name =", a.Name) log.Log(ERROR, "action() ActionType =", a.ActionType, "WidgetType =", a.WidgetType, "Name =", a.ProgName)
} }
log.Log(INFO, "action() END") log.Log(INFO, "action() END")
} }
@ -80,7 +80,7 @@ func (n *node) AddText(text string) {
} }
n.vals = append(n.vals, text) n.vals = append(n.vals, text)
for i, s := range n.vals { for i, s := range n.vals {
log.Log(NOW, "AddText()", n.Name, i, s) log.Log(NOW, "AddText()", n.progname, i, s)
} }
n.SetText(text) n.SetText(text)
} }
@ -91,12 +91,8 @@ func (n *node) SetText(text string) {
log.Log(NOW, "widget is nil") log.Log(NOW, "widget is nil")
return return
} }
if (n.Text != text) { if widget.GetString(n.value) != text {
n.Text = text n.value = text
changed = true
}
if (n.S != text) {
n.S = text
changed = true changed = true
} }
if (! changed) { if (! changed) {
@ -114,15 +110,8 @@ func (n *node) Set(val any) {
// w := n.tk // w := n.tk
log.Log(INFO, "Set() value =", val) log.Log(INFO, "Set() value =", val)
switch v := val.(type) { n.value = val
case bool: if (n.WidgetType != widget.Checkbox) {
n.B = val.(bool) n.setCheckbox(val)
n.setCheckbox(val.(bool))
case string:
n.SetText(val.(string))
case int:
n.I = val.(int)
default:
log.Log(ERROR, "Set() unknown type =", val, v)
} }
} }

View File

@ -50,8 +50,7 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
if (me.logStdout == nil) { if (me.logStdout == nil) {
a := new(widget.Action) a := new(widget.Action)
a.Name = "stdout" a.ProgName = "stdout"
a.Text = "stdout"
a.WidgetType = widget.Stdout a.WidgetType = widget.Stdout
a.WidgetId = -3 a.WidgetId = -3
a.ParentId = 0 a.ParentId = 0

View File

@ -118,6 +118,9 @@ type guiWidget struct {
v *gocui.View // this is nil if the widget is not displayed v *gocui.View // this is nil if the widget is not displayed
cuiName string // what gocui uses to reference the widget cuiName string // what gocui uses to reference the widget
// the actual text to display in the console
label string
// the logical size of the widget // the logical size of the widget
// For example, 40x12 would be the center of a normal terminal // For example, 40x12 would be the center of a normal terminal
// size rectType // size rectType

View File

@ -24,8 +24,8 @@ func (w *guiWidget) Height() int {
} }
func (n *node) gocuiSetWH(sizeW, sizeH int) { func (n *node) gocuiSetWH(sizeW, sizeH int) {
w := len(n.Text) w := len(widget.GetString(n.value))
lines := strings.Split(n.Text, "\n") lines := strings.Split(widget.GetString(n.value), "\n")
h := len(lines) h := len(lines)
tk := n.tk tk := n.tk
@ -78,7 +78,7 @@ func redoWindows(nextW int, nextH int) {
sizeW := w.Width() + me.WindowPadW sizeW := w.Width() + me.WindowPadW
sizeH := w.Height() sizeH := w.Height()
nextW += sizeW nextW += sizeW
log.Log(NOW, "redoWindows() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, n.Name) log.Log(NOW, "redoWindows() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, n.progname)
if n.hasTabs { if n.hasTabs {
n.redoTabs(me.TabW, me.TabH) n.redoTabs(me.TabW, me.TabH)
@ -105,7 +105,7 @@ func (p *node) redoTabs(nextW int, nextH int) {
sizeW := w.Width() + me.TabPadW sizeW := w.Width() + me.TabPadW
sizeH := w.Height() sizeH := w.Height()
log.Log(NOW, "redoTabs() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, n.Name) log.Log(NOW, "redoTabs() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, n.progname)
nextW += sizeW nextW += sizeW
} }
} }

View File

@ -27,7 +27,7 @@ func (n *node) textResize() bool {
var width, height int = 0, 0 var width, height int = 0, 0
var changed bool = false var changed bool = false
for i, s := range splitLines(n.Text) { for i, s := range splitLines(n.tk.label) {
log.Log(INFO, "textResize() len =", len(s), i, s) log.Log(INFO, "textResize() len =", len(s), i, s)
if (width < len(s)) { if (width < len(s)) {
width = len(s) width = len(s)
@ -68,7 +68,7 @@ func (n *node) showView() {
n.recreateView() n.recreateView()
} }
x0, y0, x1, y1, err := 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", n.Name, err) log.Log(INFO, "showView() w.v already defined for widget", n.progname, err)
// n.smartGocuiSize() // n.smartGocuiSize()
changed := n.textResize() changed := n.textResize()
@ -78,7 +78,7 @@ func (n *node) showView() {
} else { } else {
log.Log(NOW, "showView() Clear() and Fprint() here wId =", w.cuiName) log.Log(NOW, "showView() Clear() and Fprint() here wId =", w.cuiName)
w.v.Clear() w.v.Clear()
fmt.Fprint(w.v, n.Text) fmt.Fprint(w.v, n.tk.label)
n.SetVisible(false) n.SetVisible(false)
n.SetVisible(true) n.SetVisible(true)
return return
@ -114,7 +114,7 @@ func (n *node) showView() {
func (n *node) recreateView() { func (n *node) recreateView() {
var err error var err error
w := n.tk w := n.tk
log.Log(ERROR, "recreateView() START", n.WidgetType, n.Name) log.Log(ERROR, "recreateView() START", n.WidgetType, n.progname)
if (me.baseGui == nil) { if (me.baseGui == nil) {
log.Log(ERROR, "recreateView() ERROR: me.baseGui == nil", w) log.Log(ERROR, "recreateView() ERROR: me.baseGui == nil", w)
return return
@ -124,11 +124,11 @@ func (n *node) recreateView() {
me.baseGui.DeleteView(w.cuiName) me.baseGui.DeleteView(w.cuiName)
w.v = nil w.v = nil
if (n.Name == "CLOUDFLARE_EMAIL") { if (n.progname == "CLOUDFLARE_EMAIL") {
n.showWidgetPlacement(true, "n.Name=" + n.Name + " n.Text=" + n.Text + " " + w.cuiName) n.showWidgetPlacement(true, "n.progname=" + n.progname + " n.tk.label=" + n.tk.label + " " + w.cuiName)
n.dumpWidget("jwc") n.dumpWidget("jwc")
n.textResize() n.textResize()
n.showWidgetPlacement(true, "n.Name=" + n.Name + " n.Text=" + n.Text + " " + w.cuiName) n.showWidgetPlacement(true, "n.progname=" + n.progname + " n.tk.label=" + n.tk.label + " " + w.cuiName)
} }
a := w.gocuiSize.w0 a := w.gocuiSize.w0
@ -162,8 +162,8 @@ func (n *node) recreateView() {
w.v.Wrap = true w.v.Wrap = true
w.v.Frame = w.frame w.v.Frame = w.frame
w.v.Clear() w.v.Clear()
fmt.Fprint(w.v, n.Text) fmt.Fprint(w.v, n.tk.label)
// n.showWidgetPlacement(true, "n.Name=" + n.Name + " n.Text=" + n.Text + " " + w.cuiName) // n.showWidgetPlacement(true, "n.progname=" + n.progname + " n.tk.label=" + n.tk.label + " " + w.cuiName)
// n.dumpWidget("jwc 2") // n.dumpWidget("jwc 2")
// if you don't do this here, it will be black & white only // if you don't do this here, it will be black & white only
@ -174,8 +174,8 @@ func (n *node) recreateView() {
w.v.SelFgColor = w.color.selFg w.v.SelFgColor = w.color.selFg
w.v.SelBgColor = w.color.selBg w.v.SelBgColor = w.color.selBg
} }
if (n.Name == "CLOUDFLARE_EMAIL") { if (n.progname == "CLOUDFLARE_EMAIL") {
n.showWidgetPlacement(true, "n.Name=" + n.Name + " n.Text=" + n.Text + " " + w.cuiName) n.showWidgetPlacement(true, "n.progname=" + n.progname + " n.tk.label=" + n.tk.label + " " + w.cuiName)
n.dumpTree(true) n.dumpTree(true)
} }
log.Log(ERROR, "recreateView() END") log.Log(ERROR, "recreateView() END")

View File

@ -24,14 +24,6 @@ func initWidget(n *node) *guiWidget {
return w return w
} }
if (n.WidgetType == widget.Box) {
if (n.B) {
n.horizontal = true
} else {
n.horizontal = false
}
}
if (n.WidgetType == widget.Grid) { if (n.WidgetType == widget.Grid) {
w.widths = make(map[int]int) // how tall each row in the grid is w.widths = make(map[int]int) // how tall each row in the grid is
w.heights = make(map[int]int) // how wide each column in the grid is w.heights = make(map[int]int) // how wide each column in the grid is
@ -42,7 +34,7 @@ func initWidget(n *node) *guiWidget {
func setupCtrlDownWidget() { func setupCtrlDownWidget() {
a := new(widget.Action) a := new(widget.Action)
a.Name = "ctrlDown" a.ProgName = "ctrlDown"
a.WidgetType = widget.Dialog a.WidgetType = widget.Dialog
a.WidgetId = -1 a.WidgetId = -1
a.ParentId = 0 a.ParentId = 0
@ -128,8 +120,8 @@ func addDropdown() *node {
n.ParentId = 0 n.ParentId = 0
// copy the data from the action message // copy the data from the action message
n.Name = "DropBox" n.progname = "DropBox"
n.Text = "DropBox text" n.tk.label = "DropBox text"
// store the internal toolkit information // store the internal toolkit information
n.tk = new(guiWidget) n.tk = new(guiWidget)

View File

@ -70,7 +70,7 @@ func (n *node) Delete() {
case widget.Grid: case widget.Grid:
// t.uiGrid.SetPadded(true) // t.uiGrid.SetPadded(true)
case widget.Box: case widget.Box:
log.Log(NOW, "tWidget.boxC =", p.Name) log.Log(NOW, "tWidget.boxC =", p.progname)
log.Log(NOW, "is there a tParent parent? =", p.parent) log.Log(NOW, "is there a tParent parent? =", p.parent)
// this didn't work: // this didn't work:
// tWidget.uiControl.Disable() // tWidget.uiControl.Disable()
@ -84,7 +84,7 @@ func (n *node) Delete() {
func doAction(a *widget.Action) { func doAction(a *widget.Action) {
log.Log(INFO, "doAction() START a.ActionType =", a.ActionType) log.Log(INFO, "doAction() START a.ActionType =", a.ActionType)
log.Log(INFO, "doAction() START a.S =", a.S) log.Log(INFO, "doAction() START a.ProgName =", a.ProgName)
if (a.ActionType == widget.InitToolkit) { if (a.ActionType == widget.InitToolkit) {
// TODO: make sure to only do this once // TODO: make sure to only do this once
@ -125,7 +125,7 @@ func doAction(a *widget.Action) {
case widget.GetText: case widget.GetText:
switch a.WidgetType { switch a.WidgetType {
case widget.Textbox: case widget.Textbox:
a.S = n.S a.Value = n.value
} }
case widget.Set: case widget.Set:
// n.setText(a.S) // n.setText(a.S)

View File

@ -34,10 +34,10 @@ type node struct {
WidgetType widget.WidgetType WidgetType widget.WidgetType
ParentId int // parent ID ParentId int // parent ID
// Name string // a reference name for programming and debuggign. Must be unique
// Text string
progname string progname string
// the text used for button labesl, window titles, checkbox names, etc
label string label string
// horizontal means layout widgets like books on a bookshelf // horizontal means layout widgets like books on a bookshelf

View File

@ -24,7 +24,7 @@ func (n *node) doWidgetClick() {
// n.placeWidgets() // n.placeWidgets()
// n.toggleTree() // n.toggleTree()
case widget.Checkbox: case widget.Checkbox:
if (n.B) { if widget.GetBool(n.value) {
// n.setCheckbox(false) // n.setCheckbox(false)
} else { } else {
// n.setCheckbox(true) // n.setCheckbox(true)
@ -36,10 +36,10 @@ func (n *node) doWidgetClick() {
// n.showWidgets() // n.showWidgets()
case widget.Box: case widget.Box:
// n.showWidgetPlacement(logNow, "drawTree()") // n.showWidgetPlacement(logNow, "drawTree()")
if (n.B) { if widget.GetBool(n.value) {
log.Log(NOW, "BOX IS HORIZONTAL", n.Name) log.Log(NOW, "BOX IS HORIZONTAL", n.progname)
} else { } else {
log.Log(NOW, "BOX IS VERTICAL", n.Name) log.Log(NOW, "BOX IS VERTICAL", n.progname)
} }
case widget.Button: case widget.Button:
n.doUserEvent() n.doUserEvent()

View File

@ -14,7 +14,7 @@ func catchActionChannel() {
log.Log(NOW, "catchActionChannel() for loop") log.Log(NOW, "catchActionChannel() for loop")
select { select {
case a := <-pluginChan: case a := <-pluginChan:
log.Log(NOW, "catchActionChannel() SELECT widget id =", a.WidgetId, a.Name) log.Log(NOW, "catchActionChannel() SELECT widget id =", a.WidgetId, a.ProgName)
log.Log(NOW, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType) log.Log(NOW, "catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType)
muAction.Lock() muAction.Lock()
doAction(&a) doAction(&a)

View File

@ -56,7 +56,7 @@ func (n *node) showButtons() {
} }
func (n *node) dumpWidget(pad string) { func (n *node) dumpWidget(pad string) {
log.Log(NOW, "node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.Name) log.Log(NOW, "node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.progname)
} }
var depth int = 0 var depth int = 0

View File

@ -19,10 +19,10 @@ func initWidget(n *node) *guiWidget {
} }
if (n.WidgetType == widget.Box) { if (n.WidgetType == widget.Box) {
if (n.B) { if (n.direction == widget.Horizontal) {
n.horizontal = true // n.horizontal = true
} else { } else {
n.horizontal = false // n.horizontal = false
} }
} }