diff --git a/addAccount.go b/addAccount.go index bfb4720..6324ed8 100644 --- a/addAccount.go +++ b/addAccount.go @@ -74,7 +74,7 @@ func AddAccountBox(custom func(*ButtonMap)) *ui.Box { entryNick.OnChanged(func(*ui.Entry) { log.Println("OK. nickname =", entryNick.Text()) - Data.AccNick = entryNick.Text() + // Data.AccNick = entryNick.Text() }) hboxAccount.Append(vboxN, false) // End 'Nickname' vertical box @@ -91,7 +91,7 @@ func AddAccountBox(custom func(*ButtonMap)) *ui.Box { entryUser.OnChanged(func(*ui.Entry) { log.Println("OK. username =", entryUser.Text()) - Data.AccUser = entryUser.Text() + // Data.AccUser = entryUser.Text() }) hboxAccount.Append(vboxU, false) // End 'Username' vertical box @@ -108,7 +108,7 @@ func AddAccountBox(custom func(*ButtonMap)) *ui.Box { entryPass.OnChanged(func(*ui.Entry) { log.Println("OK. password =", entryPass.Text()) - Data.AccPass = entryPass.Text() + // Data.AccPass = entryPass.Text() }) hboxAccount.Append(vboxP, false) // End 'Password' vertical box diff --git a/debug.go b/debug.go index acc2907..0b4efe6 100644 --- a/debug.go +++ b/debug.go @@ -7,8 +7,6 @@ import "strings" import "os/exec" import "runtime" -import "github.com/gookit/config" - import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" @@ -18,7 +16,7 @@ import "github.com/davecgh/go-spew/spew" // can not pass any args to this (?) func setupCloudUI() { - Data.cloudWindow = ui.NewWindow("Cloud Control Panel", Data.Width, config.Int("height"), false) + Data.cloudWindow = ui.NewWindow("Cloud Control Panel", Data.Width, Data.Height, false) Data.cloudWindow.OnClosing(func(*ui.Window) bool { ui.Quit() return true diff --git a/gui.go b/gui.go index 4547336..5f38591 100644 --- a/gui.go +++ b/gui.go @@ -5,7 +5,6 @@ import "log" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -// import "github.com/gookit/config" import "github.com/davecgh/go-spew/spew" func InitColumns(mh *TableData, parts []TableColumnData) { @@ -194,7 +193,6 @@ func defaultFontButtonClick(button *ui.FontButton) { func CreateButton(name string, note string, custom func(*ButtonMap)) *ui.Button { newB := ui.NewButton(name) - newB.OnClicked(defaultButtonClick) var newmap ButtonMap @@ -210,7 +208,6 @@ func CreateButton(name string, note string, custom func(*ButtonMap)) *ui.Button func CreateAccountButton(account string, custom func(*ButtonMap)) *ui.Button { name := "Show " + account newB := ui.NewButton(name) - newB.OnClicked(defaultButtonClick) var newmap ButtonMap @@ -227,7 +224,6 @@ func CreateAccountButton(account string, custom func(*ButtonMap)) *ui.Button { func CreateLoginButton(account string, custom func(*ButtonMap)) *ui.Button { name := "Login " + account newB := ui.NewButton(name) - newB.OnClicked(defaultButtonClick) var newmap ButtonMap diff --git a/mainCloudBox.go b/mainCloudBox.go index 02e4d03..a3a4b0c 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -2,20 +2,19 @@ package gui import "log" -import "github.com/gookit/config" +// import "github.com/gookit/config" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" // import pb "git.wit.com/wit/witProtobuf" - // import "github.com/davecgh/go-spew/spew" func makeCloudInfoBox(custom func(*ButtonMap)) *ui.Box { hbox := ui.NewHorizontalBox() hbox.SetPadded(true) - if (config.String("debugging") == "true") { + if (Data.Debug) { vbox := ui.NewVerticalBox() vbox.SetPadded(true) hbox.Append(vbox, false) @@ -62,29 +61,26 @@ func makeCloudInfoBox(custom func(*ButtonMap)) *ui.Box { agrid.Append(ui.NewLabel("Domain Name"), 3, 0, 1, 1, true, ui.AlignFill, false, ui.AlignFill) row := 1 - for account, _ := range config.StringMap("accounts") { - // nickname := config.String("accounts." + account + ".nickname") - username := config.String("accounts." + account + ".username") - domainname := config.String("accounts." + account + ".domainname") - hostname := config.String("accounts." + account + ".hostname") - port := config.String("accounts." + account + ".port") + for key, foo := range Data.Config.Accounts { + log.Println("account.Nick = ", Data.Config.Accounts[key].Nick) + log.Println("account.Username = ", Data.Config.Accounts[key].Username) + log.Println("account.Token = ", Data.Config.Accounts[key].Token) + log.Println("account = ", key, foo) - a := account + " " + hostname + " " + domainname + " " + port + " " + username - log.Println("ACCOUNT: ", a) + agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Nick), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) + agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Username), 2, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) + agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Domainname), 3, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - agrid.Append(ui.NewLabel(account), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - agrid.Append(ui.NewLabel(username), 2, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - agrid.Append(ui.NewLabel(domainname), 3, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - - l := CreateLoginButton(account, custom) + l := CreateLoginButton(Data.Config.Accounts[key].Nick, custom) agrid.Append(l, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) - b := CreateAccountButton(account, custom) + b := CreateAccountButton(Data.Config.Accounts[key].Nick, custom) agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) row += 1 } + row += 1 agrid.Append(ui.NewLabel(""), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) row += 1 diff --git a/structs.go b/structs.go index 3f25033..5dc3bdf 100644 --- a/structs.go +++ b/structs.go @@ -53,9 +53,8 @@ type GuiDataStructure struct { IPv6 string // account entry textboxes - AccNick string - AccUser string - AccPass string + AccNick string + Config *pb.Config // A map of all buttons everywhere on all // windows, all tabs, across all goroutines diff --git a/tabWindow.go b/tabWindow.go index d942fc5..de0333f 100644 --- a/tabWindow.go +++ b/tabWindow.go @@ -46,7 +46,7 @@ func GoMainWindow() { } func makeCloudWindow() { - Data.cloudWindow = ui.NewWindow("", 640, 480, true) + Data.cloudWindow = ui.NewWindow("", Data.Width, Data.Height, true) // cloudWindow.SetBorderless(true) Data.cloudWindow.OnClosing(func(*ui.Window) bool { if (Data.MouseClick != nil) {