fixed. control panel is working again

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-24 19:29:08 -07:00
parent 3198bd3484
commit 601ffee7c0
3 changed files with 19 additions and 12 deletions

20
gui.go
View File

@ -5,6 +5,8 @@ import "log"
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 InitColumns(mh *TableData, parts []TableColumnData) {
@ -205,32 +207,34 @@ func CreateButton(name string, note string, custom func(*ButtonMap)) *ui.Button
return newB
}
func CreateAccountButton(account string, custom func(*ButtonMap)) *ui.Button {
name := "Show " + account
func CreateAccountButton(pbC *pb.Config_Account, custom func(*ButtonMap)) *ui.Button {
name := "Show " + pbC.Nick
newB := ui.NewButton(name)
newB.OnClicked(defaultButtonClick)
var newmap ButtonMap
newmap.B = newB
newmap.Account = pbC
newmap.Note = "SHOW"
newmap.Name = name
newmap.AccNick = account
// newmap.Name = name
// newmap.AccNick = account
newmap.custom = custom
Data.AllButtons = append(Data.AllButtons, newmap)
return newB
}
func CreateLoginButton(account string, custom func(*ButtonMap)) *ui.Button {
name := "Login " + account
func CreateLoginButton(pbC *pb.Config_Account, custom func(*ButtonMap)) *ui.Button {
name := "Login " + pbC.Nick
newB := ui.NewButton(name)
newB.OnClicked(defaultButtonClick)
var newmap ButtonMap
newmap.B = newB
newmap.Account = pbC
newmap.Note = "LOGIN"
newmap.Name = name
newmap.AccNick = account
// newmap.Name = name
// newmap.AccNick = account
newmap.custom = custom
Data.AllButtons = append(Data.AllButtons, newmap)

View File

@ -72,10 +72,10 @@ func makeCloudInfoBox(custom func(*ButtonMap)) *ui.Box {
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)
l := CreateLoginButton(Data.Config.Accounts[key].Nick, custom)
l := CreateLoginButton(Data.Config.Accounts[key], custom)
agrid.Append(l, 4, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
b := CreateAccountButton(Data.Config.Accounts[key].Nick, custom)
b := CreateAccountButton(Data.Config.Accounts[key], custom)
agrid.Append(b, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill)
row += 1

View File

@ -99,9 +99,12 @@ type TableColumnData struct {
type ButtonMap struct {
B *ui.Button
FB *ui.FontButton
onClick func (int, string)
onChanged func (int, string)
Account *pb.Config_Account
// onClick func (int, string)
// onChanged func (int, string)
custom func (*ButtonMap)
pbVM *pb.Event_VM
Name string // the text on the button
Note string // what type of button