1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Status and weather refresh on a global interval

This commit is contained in:
Chris Cummer
2018-03-29 22:26:59 -07:00
committed by Chris Cummer
parent 8a258225c9
commit 69e0034871
3 changed files with 24 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ package status
import (
"fmt"
"math/rand"
"time"
"github.com/rivo/tview"
@@ -28,6 +29,7 @@ func (widget *Widget) Refresh() {
widget.View.SetTitle(" 🦊 Status ")
widget.RefreshedAt = time.Now()
widget.View.Clear()
fmt.Fprintf(widget.View, "%s", widget.contentFrom())
}
@@ -44,5 +46,6 @@ func (widget *Widget) addView() {
}
func (widget *Widget) contentFrom() string {
return "cats and gods\ndogs and tacs"
//return "cats and gods\ndogs and tacs"
return fmt.Sprint(rand.Intn(100))
}