refactor compact widgets into recursive gridbufferer

This commit is contained in:
Bradley Cicenas
2017-02-26 06:22:50 +00:00
parent 381f1da602
commit b84e22fb90
4 changed files with 149 additions and 88 deletions

View File

@@ -33,10 +33,18 @@ func NewInfo(id, name string) *ui.Table {
return p
}
func (w *Expanded) Reset() {
func (w *Expanded) Buffer() ui.Buffer {
return ui.NewBuffer()
}
func (w *Expanded) Render() {
func (w *Expanded) Reset() {}
func (w *Expanded) SetY(_ int) {}
func (w *Expanded) SetWidth(_ int) {}
func (w *Expanded) Highlight() {}
func (w *Expanded) UnHighlight() {}
func (w *Expanded) SetStatus(val string) {}
func (w *Expanded) Render(_, _ int) {
ui.Render(w.Info, w.Cpu, w.Mem, w.Net)
ui.Handle("/timer/1s", func(ui.Event) {
ui.Render(w.Info, w.Cpu, w.Mem, w.Net)
@@ -47,23 +55,6 @@ func (w *Expanded) Render() {
ui.Loop()
}
func (w *Expanded) Row() *ui.Row {
return ui.NewRow(
ui.NewCol(2, 0, w.Cpu),
ui.NewCol(2, 0, w.Mem),
ui.NewCol(2, 0, w.Net),
)
}
func (w *Expanded) Highlight() {
}
func (w *Expanded) UnHighlight() {
}
func (w *Expanded) SetStatus(val string) {
}
func (w *Expanded) SetCPU(val int) {
w.Cpu.Update(val)
}