init expanded view, add cpu histogram

This commit is contained in:
Bradley Cicenas
2017-01-06 19:46:30 +00:00
parent bebdfd844f
commit 99aac17030
6 changed files with 162 additions and 2 deletions

18
grid.go
View File

@@ -115,8 +115,18 @@ func (g *Grid) OpenView(v View) {
v(g)
}
func (g *Grid) ExpandView() {
ResetView()
defer ResetView()
container := g.containerMap.Get(g.cursorID)
container.Expand()
container.widgets.Render()
container.Collapse()
}
func Display(g *Grid) bool {
var newView View
var expand bool
// calculate layout
ui.Body.Align()
@@ -129,6 +139,10 @@ func Display(g *Grid) bool {
ui.Handle("/sys/kbd/<down>", func(ui.Event) {
g.cursorDown()
})
ui.Handle("/sys/kbd/<enter>", func(ui.Event) {
expand = true
ui.StopLoop()
})
ui.Handle("/sys/kbd/h", func(ui.Event) {
newView = HelpMenu
ui.StopLoop()
@@ -157,5 +171,9 @@ func Display(g *Grid) bool {
g.OpenView(newView)
return false
}
if expand {
g.ExpandView()
return false
}
return true
}