mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Widgets have names
This commit is contained in:
committed by
Chris Cummer
parent
ab4774c86a
commit
2f63a56eae
@@ -9,6 +9,7 @@ import (
|
||||
)
|
||||
|
||||
type Widget struct {
|
||||
Name string
|
||||
RefreshedAt time.Time
|
||||
RefreshInterval int
|
||||
View *tview.TextView
|
||||
@@ -16,6 +17,7 @@ type Widget struct {
|
||||
|
||||
func NewWidget() *Widget {
|
||||
widget := Widget{
|
||||
Name: "Status",
|
||||
RefreshedAt: time.Now(),
|
||||
RefreshInterval: 1,
|
||||
}
|
||||
@@ -43,13 +45,12 @@ func (widget *Widget) addView() {
|
||||
|
||||
view.SetBorder(true)
|
||||
view.SetDynamicColors(true)
|
||||
view.SetTitle(" BambooHR ")
|
||||
view.SetTitle(widget.Name)
|
||||
|
||||
widget.View = view
|
||||
}
|
||||
|
||||
func (widget *Widget) contentFrom() string {
|
||||
//return "cats and gods\ndogs and tacs"
|
||||
return fmt.Sprint(rand.Intn(100))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user