more deletions of old stuff
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1274211f20
commit
1366012bc9
6
area.go
6
area.go
|
@ -24,9 +24,9 @@ func makeGenericArea(gb *GuiBox, newText *ui.AttributedString, custom func(*GuiB
|
|||
gw.Area.UiAttrstr = newText
|
||||
gw.Area.UiArea = ui.NewArea(gw.Area)
|
||||
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
spew.Dump(gw.Area.UiArea)
|
||||
log.Println("DEBUGGING", Data.Debug)
|
||||
log.Println("DEBUGGING", Config.Debug)
|
||||
} else {
|
||||
log.Println("NOT DEBUGGING AREA mhAH.Button =", gw.Area.Button)
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ func (ah GuiArea) Draw(a *ui.Area, p *ui.AreaDrawParams) {
|
|||
}
|
||||
|
||||
func (ah GuiArea) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
log.Println("GOT MouseEvent() ah.Button =", ah.Button)
|
||||
spew.Dump(me)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import pb "git.wit.com/wit/witProtobuf"
|
|||
func defaultButtonClick(button *ui.Button) {
|
||||
log.Println("gui.defaultButtonClick() LOOK FOR BUTTON button =", button)
|
||||
for key, foo := range Data.AllButtons {
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
log.Println("gui.defaultButtonClick() Data.AllButtons =", key, foo)
|
||||
// spew.Dump(foo)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ func defaultButtonClick(button *ui.Button) {
|
|||
}
|
||||
}
|
||||
log.Println("\tgui.defaultButtonClick() ERROR: BUTTON NOT FOUND")
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
panic("gui.defaultButtonClick() ERROR: UNMAPPED ui.Button")
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ func CreateButton(box *GuiBox, a *pb.Account, vm *pb.Event_VM, name string, acti
|
|||
newB.Account = a
|
||||
newB.VM = vm
|
||||
newB.Box = box
|
||||
// newB.GW = box.Window
|
||||
newB.Action = action
|
||||
newB.Custom = custom
|
||||
Data.AllButtons = append(Data.AllButtons, newB)
|
||||
|
|
2
entry.go
2
entry.go
|
@ -105,7 +105,7 @@ func AddEntry(box *GuiBox, name string) *GuiEntry {
|
|||
|
||||
func defaultEntryChange(e *ui.Entry) {
|
||||
for key, em := range Data.AllEntries {
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
log.Println("\tdefaultEntryChange() Data.AllEntries =", key, em)
|
||||
}
|
||||
if Data.AllEntries[key].UiEntry == e {
|
||||
|
|
12
gui.go
12
gui.go
|
@ -8,8 +8,6 @@ import "regexp"
|
|||
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"
|
||||
|
||||
const Xaxis = 0
|
||||
|
@ -24,11 +22,11 @@ func GuiInit() {
|
|||
}
|
||||
|
||||
// func InitGuiWindow(c *pb.Config, action string, maketab func(*GuiWindow) *GuiBox, uiW *ui.Window, uiT *ui.Tab) *GuiWindow {
|
||||
func InitGuiWindow(c *pb.Config, action string, gw *GuiWindow) *GuiWindow {
|
||||
func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
|
||||
log.Println("InitGuiWindow() START")
|
||||
var newGuiWindow GuiWindow
|
||||
newGuiWindow.Width = int(c.Width)
|
||||
newGuiWindow.Height = int(c.Height)
|
||||
newGuiWindow.Width = Config.Width
|
||||
newGuiWindow.Height = Config.Height
|
||||
newGuiWindow.Action = action
|
||||
newGuiWindow.MakeWindow = gw.MakeWindow
|
||||
newGuiWindow.UiWindow = gw.UiWindow
|
||||
|
@ -43,11 +41,11 @@ func InitGuiWindow(c *pb.Config, action string, gw *GuiWindow) *GuiWindow {
|
|||
}
|
||||
|
||||
|
||||
func StartNewWindow(c *pb.Config, bg bool, action string, callback func(*GuiWindow) *GuiBox) {
|
||||
func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) {
|
||||
log.Println("StartNewWindow() Create a new window")
|
||||
var junk GuiWindow
|
||||
junk.MakeWindow = callback
|
||||
window := InitGuiWindow(c, action, &junk)
|
||||
window := InitGuiWindow(action, &junk)
|
||||
if (bg) {
|
||||
log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()")
|
||||
go ui.Main(func() {
|
||||
|
|
31
structs.go
31
structs.go
|
@ -14,6 +14,14 @@ import pb "git.wit.com/wit/witProtobuf"
|
|||
// be the safe way to interact with the GUI
|
||||
//
|
||||
var Data GuiData
|
||||
var Config GuiConfig
|
||||
|
||||
type GuiConfig struct {
|
||||
Width int
|
||||
Height int
|
||||
Debug bool
|
||||
DebugTable bool
|
||||
}
|
||||
|
||||
type GuiData struct {
|
||||
State string // used like a state machine
|
||||
|
@ -22,24 +30,6 @@ type GuiData struct {
|
|||
// if nothing else is defined to handle them
|
||||
MouseClick func(*GuiButton)
|
||||
|
||||
// passes in all the User accounts from the cloud-control-panel config file
|
||||
Config *pb.Config
|
||||
|
||||
// general information on the App
|
||||
// move all this to Config (?)
|
||||
Version string
|
||||
GitCommit string
|
||||
GoVersion string
|
||||
Buildtime string
|
||||
HomeDir string
|
||||
Debug bool
|
||||
DebugTable bool
|
||||
|
||||
// official hostname and IPv6 address for this box
|
||||
// also move all this to Config (?)
|
||||
Hostname string
|
||||
IPv6 string
|
||||
|
||||
// A map of all the entry boxes
|
||||
AllEntries []*GuiEntry
|
||||
Windows []*GuiWindow
|
||||
|
@ -51,10 +41,6 @@ type GuiData struct {
|
|||
// This has to work this way because of how
|
||||
// andlabs/ui & andlabs/libui work
|
||||
AllButtons []*GuiButton
|
||||
|
||||
EntryNick *ui.Entry
|
||||
EntryUser *ui.Entry
|
||||
EntryPass *ui.Entry
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -111,7 +97,6 @@ type GuiButton struct {
|
|||
Name string // field for human readable name
|
||||
Action string // what type of button
|
||||
Box *GuiBox // what box the button click was in
|
||||
// GW *GuiWindow // what window the button click was in (redundant?)
|
||||
|
||||
Account *pb.Account // associated with what account?
|
||||
VM *pb.Event_VM // associated with which VM?
|
||||
|
|
|
@ -15,7 +15,7 @@ import "github.com/andlabs/ui"
|
|||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
func (mh *TableData) NumRows(m *ui.TableModel) int {
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
log.Println("NumRows = mh.RowCount = ", mh.RowCount, "(last Row & Column =", mh.lastRow, mh.lastColumn, ")")
|
||||
}
|
||||
return mh.RowCount
|
||||
|
@ -23,7 +23,7 @@ func (mh *TableData) NumRows(m *ui.TableModel) int {
|
|||
|
||||
// FYI: this routine seems to be called around 10 to 100 times a second for each table
|
||||
func (mh *TableData) ColumnTypes(m *ui.TableModel) []ui.TableValue {
|
||||
if (Data.DebugTable) {
|
||||
if (Config.DebugTable) {
|
||||
log.Println("ColumnTypes = ", mh.generatedColumnTypes)
|
||||
}
|
||||
return mh.generatedColumnTypes
|
||||
|
@ -44,7 +44,7 @@ func libuiColorToGOlangColor(rgba color.RGBA) ui.TableColor {
|
|||
// TODO: Figure out why this is being called 1000 times a second (10 times for each row & column)
|
||||
// Nevermind this TODO. Who gives a shit. This is a really smart way to treat the OS toolkits
|
||||
func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue {
|
||||
if (Data.DebugTable) {
|
||||
if (Config.DebugTable) {
|
||||
log.Println("CellValue() row, column =", row, column)
|
||||
}
|
||||
mh.lastRow = row
|
||||
|
@ -68,7 +68,7 @@ func (mh *TableData) CellValue(m *ui.TableModel, row, column int) ui.TableValue
|
|||
}
|
||||
|
||||
bgcolor := libuiColorToGOlangColor(mh.Rows[row].HumanData[humanID].Color)
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
log.Println("CellValue() BGCOLOR =", bgcolor)
|
||||
}
|
||||
return bgcolor
|
||||
|
@ -112,7 +112,7 @@ func defaultSetCellValue(mh *TableData, row int, column int) {
|
|||
return
|
||||
}
|
||||
log.Println("defaultSetCellValue() ERROR: UNKNOWN BUTTON IN TABLE")
|
||||
if (Data.Debug) {
|
||||
if (Config.Debug) {
|
||||
panic("defaultSetCellValue() GOT AN UNKNOWN BUTTON CLICK IN TABLE")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue