1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
This commit is contained in:
Chris Cummer 2019-07-17 06:57:26 -07:00
parent 0801f9bf4c
commit 7ddf4a566d
3 changed files with 24 additions and 8 deletions

View File

@ -17,6 +17,7 @@ type BarGraph struct {
key string key string
maxStars int maxStars int
name string name string
refreshing bool
starChar string starChar string
RefreshInt int RefreshInt int
@ -89,6 +90,12 @@ func (widget *BarGraph) Name() string {
return widget.name 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 { func (widget *BarGraph) RefreshInterval() int {
return widget.RefreshInt return widget.RefreshInt
} }

View File

@ -6,6 +6,7 @@ import (
type Scheduler interface { type Scheduler interface {
Refresh() Refresh()
Refreshing() bool
RefreshInterval() int RefreshInterval() int
} }

View File

@ -15,6 +15,7 @@ type TextWidget struct {
focusable bool focusable bool
focusChar string focusChar string
name string name string
refreshing bool
refreshInterval int refreshInterval int
app *tview.Application app *tview.Application
@ -31,6 +32,7 @@ func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, focusable
focusable: focusable, focusable: focusable,
focusChar: commonSettings.FocusChar(), focusChar: commonSettings.FocusChar(),
name: commonSettings.Name, name: commonSettings.Name,
refreshing: false,
refreshInterval: commonSettings.RefreshInterval, refreshInterval: commonSettings.RefreshInterval,
} }
@ -59,6 +61,10 @@ func (widget *TextWidget) CommonSettings() *cfg.Common {
return widget.commonSettings return widget.commonSettings
} }
func (widget *TextWidget) ConfigText() string {
return utils.HelpFromInterface(cfg.Common{})
}
func (widget *TextWidget) ContextualTitle(defaultStr string) string { func (widget *TextWidget) ContextualTitle(defaultStr string) string {
if widget.FocusChar() == "" { if widget.FocusChar() == "" {
return fmt.Sprintf(" %s ", defaultStr) return fmt.Sprintf(" %s ", defaultStr)
@ -87,10 +93,20 @@ func (widget *TextWidget) FocusChar() string {
return widget.focusChar 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 { func (widget *TextWidget) Name() string {
return widget.name 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 { func (widget *TextWidget) RefreshInterval() int {
return widget.refreshInterval 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 -------------------- */ /* -------------------- Unexported Functions -------------------- */
func (widget *TextWidget) addView() *tview.TextView { func (widget *TextWidget) addView() *tview.TextView {