diff --git a/wtf/bargraph.go b/wtf/bargraph.go index 5374ed10..41486b6b 100644 --- a/wtf/bargraph.go +++ b/wtf/bargraph.go @@ -17,6 +17,7 @@ type BarGraph struct { key string maxStars int name string + refreshing bool starChar string RefreshInt int @@ -89,6 +90,12 @@ func (widget *BarGraph) Name() string { return widget.name } +// Refreshing returns TRUE if the widget is currently refreshing its data, FALSE if it is not +func (widget *BarGraph) Refreshing() bool { + return widget.refreshing +} + +// RefreshInterval returns how often, in seconds, the widget will return its data func (widget *BarGraph) RefreshInterval() int { return widget.RefreshInt } diff --git a/wtf/scheduler.go b/wtf/scheduler.go index 5f0292e7..3cb0cecf 100644 --- a/wtf/scheduler.go +++ b/wtf/scheduler.go @@ -6,6 +6,7 @@ import ( type Scheduler interface { Refresh() + Refreshing() bool RefreshInterval() int } diff --git a/wtf/text_widget.go b/wtf/text_widget.go index 835c2a55..441f3685 100644 --- a/wtf/text_widget.go +++ b/wtf/text_widget.go @@ -15,6 +15,7 @@ type TextWidget struct { focusable bool focusChar string name string + refreshing bool refreshInterval int app *tview.Application @@ -31,6 +32,7 @@ func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, focusable focusable: focusable, focusChar: commonSettings.FocusChar(), name: commonSettings.Name, + refreshing: false, refreshInterval: commonSettings.RefreshInterval, } @@ -59,6 +61,10 @@ func (widget *TextWidget) CommonSettings() *cfg.Common { return widget.commonSettings } +func (widget *TextWidget) ConfigText() string { + return utils.HelpFromInterface(cfg.Common{}) +} + func (widget *TextWidget) ContextualTitle(defaultStr string) string { if widget.FocusChar() == "" { return fmt.Sprintf(" %s ", defaultStr) @@ -87,10 +93,20 @@ func (widget *TextWidget) FocusChar() string { return widget.focusChar } +func (widget *TextWidget) HelpText() string { + return fmt.Sprintf("\n There is no help available for widget %s", widget.commonSettings.Module.Type) +} + func (widget *TextWidget) Name() string { return widget.name } +// Refreshing returns TRUE if the widget is currently refreshing its data, FALSE if it is not +func (widget *TextWidget) Refreshing() bool { + return widget.refreshing +} + +// RefreshInterval returns how often, in seconds, the widget will return its data func (widget *TextWidget) RefreshInterval() int { return widget.refreshInterval } @@ -116,14 +132,6 @@ func (widget *TextWidget) Redraw(title, text string, wrap bool) { }) } -func (widget *TextWidget) HelpText() string { - return fmt.Sprintf("\n There is no help available for widget %s", widget.commonSettings.Module.Type) -} - -func (widget *TextWidget) ConfigText() string { - return utils.HelpFromInterface(cfg.Common{}) -} - /* -------------------- Unexported Functions -------------------- */ func (widget *TextWidget) addView() *tview.TextView {