start removing the config package
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
462813cf36
commit
838fdb7b60
|
@ -74,7 +74,7 @@ func AddAccountBox(custom func(*ButtonMap)) *ui.Box {
|
||||||
|
|
||||||
entryNick.OnChanged(func(*ui.Entry) {
|
entryNick.OnChanged(func(*ui.Entry) {
|
||||||
log.Println("OK. nickname =", entryNick.Text())
|
log.Println("OK. nickname =", entryNick.Text())
|
||||||
Data.AccNick = entryNick.Text()
|
// Data.AccNick = entryNick.Text()
|
||||||
})
|
})
|
||||||
hboxAccount.Append(vboxN, false)
|
hboxAccount.Append(vboxN, false)
|
||||||
// End 'Nickname' vertical box
|
// End 'Nickname' vertical box
|
||||||
|
@ -91,7 +91,7 @@ func AddAccountBox(custom func(*ButtonMap)) *ui.Box {
|
||||||
|
|
||||||
entryUser.OnChanged(func(*ui.Entry) {
|
entryUser.OnChanged(func(*ui.Entry) {
|
||||||
log.Println("OK. username =", entryUser.Text())
|
log.Println("OK. username =", entryUser.Text())
|
||||||
Data.AccUser = entryUser.Text()
|
// Data.AccUser = entryUser.Text()
|
||||||
})
|
})
|
||||||
hboxAccount.Append(vboxU, false)
|
hboxAccount.Append(vboxU, false)
|
||||||
// End 'Username' vertical box
|
// End 'Username' vertical box
|
||||||
|
@ -108,7 +108,7 @@ func AddAccountBox(custom func(*ButtonMap)) *ui.Box {
|
||||||
|
|
||||||
entryPass.OnChanged(func(*ui.Entry) {
|
entryPass.OnChanged(func(*ui.Entry) {
|
||||||
log.Println("OK. password =", entryPass.Text())
|
log.Println("OK. password =", entryPass.Text())
|
||||||
Data.AccPass = entryPass.Text()
|
// Data.AccPass = entryPass.Text()
|
||||||
})
|
})
|
||||||
hboxAccount.Append(vboxP, false)
|
hboxAccount.Append(vboxP, false)
|
||||||
// End 'Password' vertical box
|
// End 'Password' vertical box
|
||||||
|
|
4
debug.go
4
debug.go
|
@ -7,8 +7,6 @@ import "strings"
|
||||||
import "os/exec"
|
import "os/exec"
|
||||||
import "runtime"
|
import "runtime"
|
||||||
|
|
||||||
import "github.com/gookit/config"
|
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
|
@ -18,7 +16,7 @@ import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
// can not pass any args to this (?)
|
// can not pass any args to this (?)
|
||||||
func setupCloudUI() {
|
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 {
|
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
||||||
ui.Quit()
|
ui.Quit()
|
||||||
return true
|
return true
|
||||||
|
|
4
gui.go
4
gui.go
|
@ -5,7 +5,6 @@ import "log"
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
// import "github.com/gookit/config"
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
func InitColumns(mh *TableData, parts []TableColumnData) {
|
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 {
|
func CreateButton(name string, note string, custom func(*ButtonMap)) *ui.Button {
|
||||||
newB := ui.NewButton(name)
|
newB := ui.NewButton(name)
|
||||||
|
|
||||||
newB.OnClicked(defaultButtonClick)
|
newB.OnClicked(defaultButtonClick)
|
||||||
|
|
||||||
var newmap ButtonMap
|
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 {
|
func CreateAccountButton(account string, custom func(*ButtonMap)) *ui.Button {
|
||||||
name := "Show " + account
|
name := "Show " + account
|
||||||
newB := ui.NewButton(name)
|
newB := ui.NewButton(name)
|
||||||
|
|
||||||
newB.OnClicked(defaultButtonClick)
|
newB.OnClicked(defaultButtonClick)
|
||||||
|
|
||||||
var newmap ButtonMap
|
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 {
|
func CreateLoginButton(account string, custom func(*ButtonMap)) *ui.Button {
|
||||||
name := "Login " + account
|
name := "Login " + account
|
||||||
newB := ui.NewButton(name)
|
newB := ui.NewButton(name)
|
||||||
|
|
||||||
newB.OnClicked(defaultButtonClick)
|
newB.OnClicked(defaultButtonClick)
|
||||||
|
|
||||||
var newmap ButtonMap
|
var newmap ButtonMap
|
||||||
|
|
|
@ -2,20 +2,19 @@ package gui
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
|
|
||||||
import "github.com/gookit/config"
|
// import "github.com/gookit/config"
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
// import pb "git.wit.com/wit/witProtobuf"
|
// import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
// import "github.com/davecgh/go-spew/spew"
|
// import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
func makeCloudInfoBox(custom func(*ButtonMap)) *ui.Box {
|
func makeCloudInfoBox(custom func(*ButtonMap)) *ui.Box {
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
|
||||||
if (config.String("debugging") == "true") {
|
if (Data.Debug) {
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
hbox.Append(vbox, false)
|
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)
|
agrid.Append(ui.NewLabel("Domain Name"), 3, 0, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
|
|
||||||
row := 1
|
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")
|
for key, foo := range Data.Config.Accounts {
|
||||||
port := config.String("accounts." + account + ".port")
|
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
|
agrid.Append(ui.NewLabel(Data.Config.Accounts[key].Nick), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
log.Println("ACCOUNT: ", a)
|
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)
|
l := CreateLoginButton(Data.Config.Accounts[key].Nick, custom)
|
||||||
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)
|
|
||||||
agrid.Append(l, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
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)
|
agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
|
|
||||||
row += 1
|
row += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
row += 1
|
row += 1
|
||||||
agrid.Append(ui.NewLabel(""), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
agrid.Append(ui.NewLabel(""), 1, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
|
||||||
row += 1
|
row += 1
|
||||||
|
|
|
@ -54,8 +54,7 @@ type GuiDataStructure struct {
|
||||||
|
|
||||||
// account entry textboxes
|
// account entry textboxes
|
||||||
AccNick string
|
AccNick string
|
||||||
AccUser string
|
Config *pb.Config
|
||||||
AccPass string
|
|
||||||
|
|
||||||
// A map of all buttons everywhere on all
|
// A map of all buttons everywhere on all
|
||||||
// windows, all tabs, across all goroutines
|
// windows, all tabs, across all goroutines
|
||||||
|
|
|
@ -46,7 +46,7 @@ func GoMainWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeCloudWindow() {
|
func makeCloudWindow() {
|
||||||
Data.cloudWindow = ui.NewWindow("", 640, 480, true)
|
Data.cloudWindow = ui.NewWindow("", Data.Width, Data.Height, true)
|
||||||
// cloudWindow.SetBorderless(true)
|
// cloudWindow.SetBorderless(true)
|
||||||
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
||||||
if (Data.MouseClick != nil) {
|
if (Data.MouseClick != nil) {
|
||||||
|
|
Loading…
Reference in New Issue