start fixing variable names
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
49e3887aa6
commit
58e76c3b8e
|
@ -7,7 +7,7 @@ import _ "github.com/andlabs/ui/winmanifest"
|
|||
|
||||
var subdomain *ui.Entry
|
||||
|
||||
func AddAccountQuestionBox(wm *WindowMap) *ui.Box {
|
||||
func AddAccountQuestionBox(wm *GuiWindow) *ui.Box {
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
wm.Box1 = vbox
|
||||
|
@ -18,7 +18,7 @@ func AddAccountQuestionBox(wm *WindowMap) *ui.Box {
|
|||
|
||||
hbox.Append(ui.NewLabel("Enter your Subdomain or"), false)
|
||||
|
||||
generate := CreateButton(wm, nil, nil, "Make me a Subdomain", "SUBDOMAIN", generateSubdomain)
|
||||
generate := CreateButton(wm, nil, nil, "Generate", "SUBDOMAIN", generateSubdomain)
|
||||
hbox.Append(generate, false)
|
||||
|
||||
subdomain = ui.NewEntry()
|
||||
|
@ -49,7 +49,7 @@ func addSubdomain(b *ButtonMap) {
|
|||
log.Println("generateSubdomain END")
|
||||
}
|
||||
|
||||
func AddAccountBox(wm *WindowMap) *ui.Box {
|
||||
func AddAccountBox(wm *GuiWindow) *ui.Box {
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
|
||||
|
|
2
area.go
2
area.go
|
@ -20,7 +20,7 @@ func findFB(button *ButtonMap) *ButtonMap {
|
|||
return a
|
||||
}
|
||||
|
||||
func makeSplashArea(wm *WindowMap, ah *AreaHandler) {
|
||||
func makeSplashArea(wm *GuiWindow, ah *AreaHandler) {
|
||||
// make this button just to get the default font (but don't display the button)
|
||||
// There should be another way to do this (?)
|
||||
newB := CreateFontButton(wm, "AREA")
|
||||
|
|
2
debug.go
2
debug.go
|
@ -56,7 +56,7 @@ func addTableTab() {
|
|||
// AddTableTab(Data.Window1.T, 1, "test seven", 7, parts, nil)
|
||||
}
|
||||
|
||||
func addDebuggingButtons(wm *WindowMap, vbox *ui.Box) {
|
||||
func addDebuggingButtons(wm *GuiWindow, vbox *ui.Box) {
|
||||
vbox.Append(ui.NewLabel("Debugging:"), false)
|
||||
|
||||
vbox.Append(ui.NewColorButton(), false)
|
||||
|
|
36
gui.go
36
gui.go
|
@ -41,7 +41,7 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
|
|||
}
|
||||
}
|
||||
|
||||
func AddTableTab(wm *WindowMap, mytab *ui.Tab, junk int, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
||||
func AddTableTab(wm *GuiWindow, mytab *ui.Tab, junk int, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
||||
mh := new(TableData)
|
||||
|
||||
mh.RowCount = rowcount
|
||||
|
@ -98,17 +98,17 @@ func AddTableTab(wm *WindowMap, mytab *ui.Tab, junk int, name string, rowcount i
|
|||
return mh
|
||||
}
|
||||
|
||||
func SocketError(wm *WindowMap) {
|
||||
func SocketError(wm *GuiWindow) {
|
||||
ui.MsgBoxError(wm.W,
|
||||
"There was a socket error",
|
||||
"More detailed information can be shown here.")
|
||||
}
|
||||
|
||||
func MessageWindow(wm *WindowMap, msg1 string, msg2 string) {
|
||||
func MessageWindow(wm *GuiWindow, msg1 string, msg2 string) {
|
||||
ui.MsgBox(wm.W, msg1, msg2)
|
||||
}
|
||||
|
||||
func ErrorWindow(wm *WindowMap, msg1 string, msg2 string) {
|
||||
func ErrorWindow(wm *GuiWindow, msg1 string, msg2 string) {
|
||||
ui.MsgBoxError(wm.W, msg1, msg2)
|
||||
}
|
||||
|
||||
|
@ -209,25 +209,25 @@ func AddButton(b *ButtonMap, name string) *ui.Button {
|
|||
return newB
|
||||
}
|
||||
|
||||
func CreateButton(wm *WindowMap, a *pb.Account, vm *pb.Event_VM,
|
||||
func CreateButton(wm *GuiWindow, a *pb.Account, vm *pb.Event_VM,
|
||||
name string, action string, custom func(*ButtonMap)) *ui.Button {
|
||||
newB := ui.NewButton(name)
|
||||
newB.OnClicked(defaultButtonClick)
|
||||
newUiB := ui.NewButton(name)
|
||||
newUiB.OnClicked(defaultButtonClick)
|
||||
|
||||
var newmap ButtonMap
|
||||
newmap.B = newB
|
||||
newmap.T = wm.T
|
||||
newmap.Account = a
|
||||
newmap.VM = vm
|
||||
newmap.WM = wm
|
||||
newmap.Action = action
|
||||
newmap.custom = custom
|
||||
Data.AllButtons = append(Data.AllButtons, newmap)
|
||||
var newB ButtonMap
|
||||
newB.B = newUiB
|
||||
newB.T = wm.T
|
||||
newB.Account = a
|
||||
newB.VM = vm
|
||||
newB.WM = wm
|
||||
newB.Action = action
|
||||
newB.custom = custom
|
||||
Data.AllButtons = append(Data.AllButtons, newB)
|
||||
|
||||
return newB
|
||||
return newUiB
|
||||
}
|
||||
|
||||
func CreateFontButton(wm *WindowMap, action string) *ButtonMap {
|
||||
func CreateFontButton(wm *GuiWindow, action string) *ButtonMap {
|
||||
newB := ui.NewFontButton()
|
||||
|
||||
// create a 'fake' button entry for the mouse clicks
|
||||
|
|
|
@ -13,7 +13,7 @@ import pb "git.wit.com/wit/witProtobuf"
|
|||
|
||||
// import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
func makeCloudInfoBox(wm *WindowMap) *ui.Box {
|
||||
func makeCloudInfoBox(wm *GuiWindow) *ui.Box {
|
||||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
||||
|
@ -103,7 +103,7 @@ func makeCloudInfoBox(wm *WindowMap) *ui.Box {
|
|||
// which could be anything since TEXTCOLOR, TEXT, BG, etc
|
||||
// fields use between 1 and 3 values internally
|
||||
//
|
||||
func AddVmsTab(wm *WindowMap, name string, count int, a *pb.Account) *TableData {
|
||||
func AddVmsTab(wm *GuiWindow, name string, count int, a *pb.Account) *TableData {
|
||||
var parts []TableColumnData
|
||||
|
||||
human := 0
|
||||
|
@ -161,7 +161,7 @@ func AddVmsTab(wm *WindowMap, name string, count int, a *pb.Account) *TableData
|
|||
return mh
|
||||
}
|
||||
|
||||
func ShowAccountQuestionTab(wm *WindowMap) {
|
||||
func ShowAccountQuestionTab(wm *GuiWindow) {
|
||||
log.Println("ShowAccountQuestionTab() wm =", wm)
|
||||
if (wm.T == nil) {
|
||||
log.Println("ShowAccountQuestionTab() wm.T = nil THIS IS BAD")
|
||||
|
@ -177,7 +177,7 @@ func ShowAccountQuestionTab(wm *WindowMap) {
|
|||
wm.T.SetMargined(0, true)
|
||||
}
|
||||
|
||||
func ShowAccountTab(wm *WindowMap, i int) {
|
||||
func ShowAccountTab(wm *GuiWindow, i int) {
|
||||
log.Println("ShowAccountTab() START")
|
||||
|
||||
log.Println("Sleep(200)")
|
||||
|
@ -203,7 +203,7 @@ func ShowAccountTab(wm *WindowMap, i int) {
|
|||
}
|
||||
}
|
||||
|
||||
func ShowMainTab(wm *WindowMap) {
|
||||
func ShowMainTab(wm *GuiWindow) {
|
||||
log.Println("ShowMainTab() wm =", wm)
|
||||
log.Println("ShowMainTab() wm.T =", wm.T)
|
||||
log.Println("ShowMainTab() wm.T =", wm.T)
|
||||
|
@ -219,10 +219,10 @@ func ShowMainTab(wm *WindowMap) {
|
|||
|
||||
func StartNewWindow(c *pb.Config, bg bool, action string) {
|
||||
log.Println("InitNewWindow() Create a new window")
|
||||
var newWindowMap WindowMap
|
||||
newWindowMap.C = c
|
||||
newWindowMap.Action = action
|
||||
Data.Windows = append(Data.Windows, &newWindowMap)
|
||||
var newGuiWindow GuiWindow
|
||||
newGuiWindow.C = c
|
||||
newGuiWindow.Action = action
|
||||
Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||
|
||||
ui.OnShouldQuit(func() bool {
|
||||
// mouseClick(&newBM)
|
||||
|
@ -233,13 +233,13 @@ func StartNewWindow(c *pb.Config, bg bool, action string) {
|
|||
if (bg) {
|
||||
log.Println("ShowWindow() IN NEW GOROUTINE")
|
||||
go ui.Main(func() {
|
||||
InitWindow(&newWindowMap)
|
||||
InitWindow(&newGuiWindow)
|
||||
})
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
} else {
|
||||
log.Println("ShowWindow() WAITING for ui.Main()")
|
||||
ui.Main(func() {
|
||||
InitWindow(&newWindowMap)
|
||||
InitWindow(&newGuiWindow)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ func getSplashText(a string) *ui.AttributedString {
|
|||
}
|
||||
|
||||
|
||||
func InitWindow(wm *WindowMap) {
|
||||
func InitWindow(wm *GuiWindow) {
|
||||
log.Println("InitWindow() THIS WINDOW IS NOT YET SHOWN")
|
||||
|
||||
c := wm.C
|
||||
|
@ -295,7 +295,7 @@ func InitWindow(wm *WindowMap) {
|
|||
}
|
||||
|
||||
// makeEntryBox(box, "hostname:", "blah.foo.org") {
|
||||
func makeEntryVbox(hbox *ui.Box, a string, startValue string, edit bool, action string) *EntryMap {
|
||||
func makeEntryVbox(hbox *ui.Box, a string, startValue string, edit bool, action string) *GuiEntry {
|
||||
// Start 'Nickname' vertical box
|
||||
vboxN := ui.NewVerticalBox()
|
||||
vboxN.SetPadded(true)
|
||||
|
@ -365,7 +365,7 @@ func defaultEntryChange(e *ui.Entry) {
|
|||
log.Println("defaultEntryChange() ERROR. MISSING ENTRY MAP. e.Text() =", e.Text())
|
||||
}
|
||||
|
||||
func defaultMakeEntry(startValue string, edit bool, action string) *EntryMap {
|
||||
func defaultMakeEntry(startValue string, edit bool, action string) *GuiEntry {
|
||||
e := ui.NewEntry()
|
||||
e.SetText(startValue)
|
||||
if (edit == false) {
|
||||
|
@ -374,19 +374,19 @@ func defaultMakeEntry(startValue string, edit bool, action string) *EntryMap {
|
|||
e.OnChanged(defaultEntryChange)
|
||||
|
||||
// add the entry field to the global map
|
||||
var newEntryMap EntryMap
|
||||
newEntryMap.E = e
|
||||
newEntryMap.Edit = edit
|
||||
newEntryMap.Action = action
|
||||
var newEntry GuiEntry
|
||||
newEntry.E = e
|
||||
newEntry.Edit = edit
|
||||
newEntry.Action = action
|
||||
if (action == "Memory") {
|
||||
newEntryMap.Normalize = normalizeInt
|
||||
newEntry.Normalize = normalizeInt
|
||||
}
|
||||
Data.AllEntries = append(Data.AllEntries, newEntryMap)
|
||||
Data.AllEntries = append(Data.AllEntries, &newEntry)
|
||||
|
||||
return &newEntryMap
|
||||
return &newEntry
|
||||
}
|
||||
|
||||
func makeEntryHbox(hbox *ui.Box, a string, startValue string, edit bool, action string) *EntryMap {
|
||||
func makeEntryHbox(hbox *ui.Box, a string, startValue string, edit bool, action string) *GuiEntry {
|
||||
// Start 'Nickname' vertical box
|
||||
hboxN := ui.NewHorizontalBox()
|
||||
hboxN.SetPadded(true)
|
||||
|
|
|
@ -11,7 +11,7 @@ import "runtime"
|
|||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
func ShowSplashBox(wm *WindowMap, newText *ui.AttributedString) *ui.Box {
|
||||
func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box {
|
||||
log.Println("ShowSplashBox() START")
|
||||
log.Println("ShowSplashBox() START wm =", wm)
|
||||
if (wm == nil) {
|
||||
|
|
14
structs.go
14
structs.go
|
@ -46,9 +46,9 @@ type GuiData struct {
|
|||
AllButtons []ButtonMap
|
||||
|
||||
// A map of all the entry boxes
|
||||
AllEntries []EntryMap
|
||||
AllEntries []*GuiEntry
|
||||
|
||||
Windows []*WindowMap
|
||||
Windows []*GuiWindow
|
||||
|
||||
EntryNick *ui.Entry
|
||||
EntryUser *ui.Entry
|
||||
|
@ -62,7 +62,7 @@ type TableColumnData struct {
|
|||
Color string
|
||||
}
|
||||
|
||||
type EntryMap struct {
|
||||
type GuiEntry struct {
|
||||
E *ui.Entry
|
||||
Edit bool
|
||||
Last string // the last value
|
||||
|
@ -80,12 +80,14 @@ type EntryMap struct {
|
|||
Action string // what type of button
|
||||
}
|
||||
|
||||
type WindowMap struct {
|
||||
type GuiWindow struct {
|
||||
W *ui.Window
|
||||
T *ui.Tab
|
||||
Box1 *ui.Box
|
||||
Box2 *ui.Box
|
||||
|
||||
EntryMap map[string][]*GuiEntry
|
||||
|
||||
C *pb.Config
|
||||
|
||||
AH *AreaHandler
|
||||
|
@ -110,7 +112,7 @@ type ButtonMap struct {
|
|||
AH *AreaHandler
|
||||
|
||||
// git.wit.com/wit/gui stuff
|
||||
WM *WindowMap
|
||||
WM *GuiWindow
|
||||
Account *pb.Account
|
||||
VM *pb.Event_VM
|
||||
Action string // what type of button
|
||||
|
@ -125,7 +127,7 @@ type AreaHandler struct{
|
|||
Button *ButtonMap
|
||||
Attrstr *ui.AttributedString
|
||||
Area *ui.Area
|
||||
WM *WindowMap
|
||||
WM *GuiWindow
|
||||
}
|
||||
// AREA STRUCTURES END
|
||||
|
||||
|
|
40
vmBox.go
40
vmBox.go
|
@ -10,45 +10,11 @@ import pb "git.wit.com/wit/witProtobuf"
|
|||
|
||||
import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
/*
|
||||
func GoShowVM() {
|
||||
ui.Main(ShowVM)
|
||||
}
|
||||
|
||||
func ShowVM() {
|
||||
name := Data.CurrentVM.Name
|
||||
log.Println("ShowVM() START Data.CurrentVM=", Data.CurrentVM)
|
||||
VMwin := ui.NewWindow("VM " + name, 500, 300, false)
|
||||
|
||||
// create a 'fake' button entry for the mouse clicks
|
||||
var newButtonMap ButtonMap
|
||||
newButtonMap.Action = "WINDOW CLOSE"
|
||||
newButtonMap.W = VMwin
|
||||
Data.AllButtons = append(Data.AllButtons, newButtonMap)
|
||||
|
||||
VMwin.OnClosing(func(*ui.Window) bool {
|
||||
mouseClick(&newButtonMap)
|
||||
return true
|
||||
})
|
||||
ui.OnShouldQuit(func() bool {
|
||||
mouseClick(&newButtonMap)
|
||||
return true
|
||||
})
|
||||
|
||||
VMtab := ui.NewTab()
|
||||
VMwin.SetChild(VMtab)
|
||||
VMwin.SetMargined(true)
|
||||
|
||||
CreateVmBox(VMtab, Data.CurrentVM)
|
||||
VMwin.Show()
|
||||
}
|
||||
*/
|
||||
|
||||
func AddVmConfigureTab(wm *WindowMap, name string, pbVM *pb.Event_VM) {
|
||||
func AddVmConfigureTab(wm *GuiWindow, name string, pbVM *pb.Event_VM) {
|
||||
CreateVmBox(wm, wm.T, pbVM)
|
||||
}
|
||||
|
||||
func CreateVmBox(wm *WindowMap, tab *ui.Tab, vm *pb.Event_VM) {
|
||||
func CreateVmBox(wm *GuiWindow, tab *ui.Tab, vm *pb.Event_VM) {
|
||||
log.Println("CreateVmBox() START")
|
||||
log.Println("CreateVmBox() vm.Name", vm.Name)
|
||||
spew.Dump(vm)
|
||||
|
@ -87,7 +53,7 @@ func CreateVmBox(wm *WindowMap, tab *ui.Tab, vm *pb.Event_VM) {
|
|||
AddBoxToTab(vm.Name, tab, vbox)
|
||||
}
|
||||
|
||||
func createAddVmBox(wm *WindowMap, tab *ui.Tab, name string, b *ButtonMap) {
|
||||
func createAddVmBox(wm *GuiWindow, tab *ui.Tab, name string, b *ButtonMap) {
|
||||
log.Println("createAddVmBox() START")
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
|
|
Loading…
Reference in New Issue