mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 NBAScore extracted to new config format
This commit is contained in:
parent
3259e16ada
commit
8ad8d942d0
3
main.go
3
main.go
@ -250,7 +250,8 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
||||
settings := mercurial.NewSettingsFromYAML(wtf.Config)
|
||||
widget = mercurial.NewWidget(app, pages, settings)
|
||||
case "nbascore":
|
||||
widget = nbascore.NewWidget(app, pages)
|
||||
settings := nbascore.NewSettingsFromYAML(wtf.Config)
|
||||
widget = nbascore.NewWidget(app, pages, settings)
|
||||
case "newrelic":
|
||||
widget = newrelic.NewWidget(app)
|
||||
case "opsgenie":
|
||||
|
18
modules/nbascore/settings.go
Normal file
18
modules/nbascore/settings.go
Normal file
@ -0,0 +1,18 @@
|
||||
package nbascore
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
@ -22,22 +22,23 @@ const HelpText = `
|
||||
type Widget struct {
|
||||
wtf.HelpfulWidget
|
||||
wtf.TextWidget
|
||||
app *tview.Application
|
||||
pages *tview.Pages
|
||||
|
||||
language string
|
||||
result string
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
var offset = 0
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "NBA Score", "nbascore", true),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
widget.HelpfulWidget.SetView(widget.View)
|
||||
widget.TextWidget.RefreshInt = 15
|
||||
widget.View.SetInputCapture(widget.keyboardIntercept)
|
||||
widget.View.SetScrollable(true)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user