mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Fix up Unknown widget to work again
Store module Type in common settings to enable this Simplify the function params to be more inline with existing ones, vs being unique
This commit is contained in:
parent
b8417c99c9
commit
fa0edec74b
@ -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