1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Remove the app.Draw() gorountine

Prefer to have widgets force a draw when their data changes. This should
reduce draws (unless the user has a module installed that updates >=
1/sec, the old draw default).

This should also remove a source of some of the race conditions that
users were experiencing (though not all, there are still many).
This commit is contained in:
Chris Cummer
2018-09-24 14:32:36 -07:00
parent 9bd2430063
commit f650bb1698
41 changed files with 135 additions and 121 deletions

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"strings"
"github.com/rivo/tview"
"github.com/senorprogrammer/wtf/wtf"
)
@@ -17,9 +18,9 @@ type Widget struct {
language string
}
func NewWidget() *Widget {
func NewWidget(app *tview.Application) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget("Pretty Weather", "prettyweather", false),
TextWidget: wtf.NewTextWidget(app, "Pretty Weather", "prettyweather", false),
}
return &widget

View File

@@ -35,7 +35,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
configKey := "weather"
widget := Widget{
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
TextWidget: wtf.NewTextWidget("Weather", configKey, true),
TextWidget: wtf.NewTextWidget(app, "Weather", configKey, true),
Idx: 0,
}