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
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
}

View File

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

View File

@ -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 {