mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge pull request #424 from Seanstoppable/fixunknown
Fix up Unknown widget to work again
This commit is contained in:
commit
433be669b1
@ -27,6 +27,7 @@ type Colors struct {
|
|||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
Name string
|
Name string
|
||||||
|
Type string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Position struct {
|
type Position struct {
|
||||||
@ -82,6 +83,7 @@ func NewCommonSettingsFromModule(name, defaultTitle string, moduleConfig *config
|
|||||||
|
|
||||||
Module: Module{
|
Module: Module{
|
||||||
Name: name,
|
Name: name,
|
||||||
|
Type: moduleConfig.UString("type", name),
|
||||||
},
|
},
|
||||||
|
|
||||||
Position: Position{
|
Position: Position{
|
||||||
|
@ -201,7 +201,7 @@ func MakeWidget(
|
|||||||
widget = zendesk.NewWidget(app, settings)
|
widget = zendesk.NewWidget(app, settings)
|
||||||
default:
|
default:
|
||||||
settings := unknown.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
settings := unknown.NewSettingsFromYAML(widgetName, moduleConfig, globalConfig)
|
||||||
widget = unknown.NewWidget(app, widgetName, settings)
|
widget = unknown.NewWidget(app, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
return widget
|
return widget
|
||||||
|
@ -14,7 +14,7 @@ type Widget struct {
|
|||||||
settings *Settings
|
settings *Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWidget(app *tview.Application, name string, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.app.QueueUpdateDraw(func() {
|
widget.app.QueueUpdateDraw(func() {
|
||||||
widget.View.Clear()
|
widget.View.Clear()
|
||||||
|
|
||||||
content := fmt.Sprintf("Widget %s does not exist", widget.CommonSettings.Title)
|
content := fmt.Sprintf("Widget %s and/or type %s does not exist", widget.Name(), widget.CommonSettings.Module.Type)
|
||||||
widget.View.SetText(content)
|
widget.View.SetText(content)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user