formating + standard error box

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-24 00:04:14 -07:00
parent d65e2507cc
commit 2c1db72a6f
2 changed files with 40 additions and 6 deletions

27
gui.go
View File

@ -23,12 +23,18 @@ type GuiDataStructure struct {
ButtonClick func(*ButtonMap) ButtonClick func(*ButtonMap)
CurrentVM string CurrentVM string
MyArea *ui.Area MyArea *ui.Area
// general information
Version string Version string
GitCommit string GitCommit string
GoVersion string GoVersion string
HomeDir string HomeDir string
Debug bool Debug bool
// official hostname and IPv6 address for this box
Hostname string
IPv6 string
// account entry textboxes // account entry textboxes
AccNick string AccNick string
AccUser string AccUser string
@ -228,6 +234,23 @@ func CreateAccountButton(account string, custom func(int, string)) *ui.Button {
return newB return newB
} }
func CreateLoginButton(account string, custom func(int, string)) *ui.Button {
name := "Login " + account
newB := ui.NewButton(name)
newB.OnClicked(defaultButtonClick)
var newmap ButtonMap
newmap.B = newB
newmap.Note = "LOGIN"
newmap.Name = name
newmap.AccNick = account
newmap.custom = custom
Data.allButtons = append(Data.allButtons, newmap)
return newB
}
func CreateFontButton(name string, note string, custom func(int, string)) *ui.FontButton { func CreateFontButton(name string, note string, custom func(int, string)) *ui.FontButton {
newB := ui.NewFontButton() newB := ui.NewFontButton()
@ -271,3 +294,7 @@ func SocketError() {
"There was a socket error", "There was a socket error",
"More detailed information can be shown here.") "More detailed information can be shown here.")
} }
func ErrorWindow(msg1 string, msg2 string) {
ui.MsgBoxError(Data.cloudWindow, msg1, msg2)
}

View File

@ -43,17 +43,21 @@ func makeCloudInfoBox(custom func(int, string)) *ui.Box {
vbox.Append(grid, false) vbox.Append(grid, false)
*/ */
hostnamebox := ui.NewHorizontalBox()
hostnamebox.SetPadded(true)
vbox.Append(hostnamebox, false)
entryForm := ui.NewForm() entryForm := ui.NewForm()
entryForm.SetPadded(true) entryForm.SetPadded(true)
vbox.Append(entryForm, false) hostnamebox.Append(entryForm, true)
hostnameEntry := ui.NewEntry() hostnameEntry := ui.NewEntry()
entryForm.Append("hostname:", hostnameEntry, false) entryForm.Append("hostname:", hostnameEntry, false)
hostnameEntry.SetText("librem15.lab.wit.com") tmp := Data.Hostname + " (" + Data.IPv6 + ")"
hostnameEntry.SetText(tmp)
hostnameEntry.SetReadOnly(true)
IPv6entry := ui.NewEntry() hostnamebox.Append(CreateButton("Edit", "EDIT", custom), false)
entryForm.Append("IPv6:", IPv6entry, false)
IPv6entry.SetText("2604:bbc0:3:3:0:10:0:1003")
vbox.Append(ui.NewHorizontalSeparator(), false) vbox.Append(ui.NewHorizontalSeparator(), false)
@ -81,8 +85,11 @@ func makeCloudInfoBox(custom func(int, string)) *ui.Box {
agrid.Append(ui.NewLabel(username), 2, 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) 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)
b := CreateAccountButton(account, custom) b := CreateAccountButton(account, custom)
agrid.Append(b, 4, 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
} }