From 2c1db72a6fa47c4b6049506e9bfe84109bf3cc46 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 24 May 2019 00:04:14 -0700 Subject: [PATCH] formating + standard error box Signed-off-by: Jeff Carr --- gui.go | 27 +++++++++++++++++++++++++++ infoTabUI.go | 19 +++++++++++++------ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/gui.go b/gui.go index 77f6f3d..5c887de 100644 --- a/gui.go +++ b/gui.go @@ -23,12 +23,18 @@ type GuiDataStructure struct { ButtonClick func(*ButtonMap) CurrentVM string MyArea *ui.Area + + // general information Version string GitCommit string GoVersion string HomeDir string Debug bool + // official hostname and IPv6 address for this box + Hostname string + IPv6 string + // account entry textboxes AccNick string AccUser string @@ -228,6 +234,23 @@ func CreateAccountButton(account string, custom func(int, string)) *ui.Button { 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 { newB := ui.NewFontButton() @@ -271,3 +294,7 @@ func SocketError() { "There was a socket error", "More detailed information can be shown here.") } + +func ErrorWindow(msg1 string, msg2 string) { + ui.MsgBoxError(Data.cloudWindow, msg1, msg2) +} diff --git a/infoTabUI.go b/infoTabUI.go index 3a9b624..08815a6 100644 --- a/infoTabUI.go +++ b/infoTabUI.go @@ -43,17 +43,21 @@ func makeCloudInfoBox(custom func(int, string)) *ui.Box { vbox.Append(grid, false) */ + hostnamebox := ui.NewHorizontalBox() + hostnamebox.SetPadded(true) + vbox.Append(hostnamebox, false) + entryForm := ui.NewForm() entryForm.SetPadded(true) - vbox.Append(entryForm, false) + hostnamebox.Append(entryForm, true) hostnameEntry := ui.NewEntry() 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() - entryForm.Append("IPv6:", IPv6entry, false) - IPv6entry.SetText("2604:bbc0:3:3:0:10:0:1003") + hostnamebox.Append(CreateButton("Edit", "EDIT", custom), 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(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) - 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 }