start removing the config package

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-24 18:17:05 -07:00
parent 462813cf36
commit 838fdb7b60
6 changed files with 20 additions and 31 deletions

View File

@ -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

View File

@ -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

4
gui.go
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) {