From a030afb2bde3a28f585540ab3a8fb8195f3d21ac Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 2 Jun 2019 21:56:43 -0700 Subject: [PATCH] remove 'Action' Signed-off-by: Jeff Carr --- debug.go | 2 +- entry.go | 4 ++-- gui.go | 6 +++--- structs.go | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/debug.go b/debug.go index 2074e1f..e3bdc97 100644 --- a/debug.go +++ b/debug.go @@ -21,7 +21,7 @@ func WatchGUI() { if (count > 20) { log.Println("Sleep() in watchGUI() Data.State =", Data.State) for i, window := range Data.Windows { - log.Println("watchGUI() Data.Windows", i, "Action =", window.Action) + log.Println("watchGUI() Data.Windows", i, "Name =", window.Name) for name, abox := range window.BoxMap { log.Printf("\twatchGUI() BOX mapname=%-12s abox.Name=%-12s", name, abox.Name) /* diff --git a/entry.go b/entry.go index cd7cfba..280ef5f 100644 --- a/entry.go +++ b/entry.go @@ -107,7 +107,7 @@ func defaultEntryChange(e *ui.Entry) { } if Data.AllEntries[key].UiEntry == e { log.Println("defaultEntryChange() FOUND", - "action =", Data.AllEntries[key].Action, + "Name =", Data.AllEntries[key].Name, "Last =", Data.AllEntries[key].Last, "e.Text() =", e.Text()) Data.AllEntries[key].Last = e.Text() @@ -133,7 +133,7 @@ func defaultMakeEntry(startValue string, edit bool, action string) *GuiEntry { var newEntry GuiEntry newEntry.UiEntry = e newEntry.Edit = edit - newEntry.Action = action + newEntry.Name = action if (action == "INT") { newEntry.Normalize = normalizeInt } diff --git a/gui.go b/gui.go index 84f5c21..5784a9d 100644 --- a/gui.go +++ b/gui.go @@ -22,7 +22,7 @@ func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow { var newGuiWindow GuiWindow newGuiWindow.Width = Config.Width newGuiWindow.Height = Config.Height - newGuiWindow.Action = action +// newGuiWindow.Action = action newGuiWindow.MakeWindow = gw.MakeWindow newGuiWindow.UiWindow = gw.UiWindow newGuiWindow.UiTab = gw.UiTab @@ -40,13 +40,13 @@ func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) { log.Println("StartNewWindow() Create a new window") var junk GuiWindow junk.MakeWindow = callback - junk.Action = action +// junk.Action = action window := InitGuiWindow(action, &junk) if (bg) { log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()") go ui.Main(func() { log.Println("gui.StartNewWindow() inside ui.Main()") - InitTabWindow(window) + go InitTabWindow(window) }) time.Sleep(2000 * time.Millisecond) // this might make it more stable on windows? } else { diff --git a/structs.go b/structs.go index 1ef8513..ec5c04e 100644 --- a/structs.go +++ b/structs.go @@ -60,7 +60,8 @@ type GuiData struct { // can destroy and replace it with something else // type GuiWindow struct { - Action string + Name string // field for human readable name +// Action string Width int Height int @@ -80,8 +81,8 @@ type GuiWindow struct { // GuiBox is any type of ui.Hbox or ui.Vbox // There can be lots of these for each GuiWindow type GuiBox struct { + Name string // field for human readable name Window *GuiWindow - Name string // andlabs/ui abstraction mapping UiBox *ui.Box @@ -99,8 +100,6 @@ type GuiButton struct { Custom func (*GuiButton) Values interface {} -// Action string // what type of button - // andlabs/ui abstraction mapping B *ui.Button FB *ui.FontButton @@ -108,9 +107,10 @@ type GuiButton struct { // text entry fields type GuiEntry struct { - Action string // what type of button + Name string // field for human readable name +// Action string // what type of button Edit bool - Last string // the last value + Last string // the last value Normalize func (string) string // function to 'normalize' the data B *GuiButton