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

Remove RefreshedAt from TextWidget

This attribute is used for absolutely nothing. It doesn't need to exist.
This commit is contained in:
Chris Cummer 2018-10-11 17:12:29 -04:00
parent 76f96ecb00
commit a48d15079a
41 changed files with 12 additions and 69 deletions

View File

@ -29,7 +29,6 @@ func (widget *Widget) Refresh() {
wtf.Now().Format(wtf.DateFormat),
)
widget.UpdateRefreshedAt()
widget.View.SetTitle(widget.ContextualTitle(widget.Name))
widget.View.SetText(widget.contentFrom(todayItems))

View File

@ -58,7 +58,6 @@ func (widget *Widget) Refresh() {
return
}
widget.UpdateRefreshedAt()
widget.View.Clear()
display(widget)

View File

@ -28,8 +28,6 @@ func (widget *Widget) Refresh() {
builds, err := BuildsFor()
widget.UpdateRefreshedAt()
widget.View.SetTitle(fmt.Sprintf("%s - Builds", widget.Name))
var content string

View File

@ -32,7 +32,6 @@ func NewWidget(app *tview.Application) *Widget {
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.display(widget.clockColl.Sorted(), widget.dateFormat, widget.timeFormat)
}

View File

@ -31,7 +31,6 @@ func NewWidget(app *tview.Application) *Widget {
}
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.execute()
title := tview.TranslateANSI(wtf.Config.UString("wtf.mods.cmdrunner.title", widget.String()))

View File

@ -98,7 +98,6 @@ func makeMarketCurrency(name string) *mCurrency {
// Refresh & update after interval time
func (widget *Widget) Refresh() {
widget.updateSummary()
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -29,7 +29,6 @@ func NewWidget(app *tview.Application) *Widget {
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.View.SetTitle(" Blockfolio ")
positions, err := Fetch(widget.device_token)

View File

@ -42,8 +42,6 @@ func (widget *Widget) Refresh() {
widget.toplistWidget.Refresh(&wg)
wg.Wait()
widget.UpdateRefreshedAt()
display(widget)
}

View File

@ -25,7 +25,6 @@ func NewWidget(app *tview.Application) *Widget {
func (widget *Widget) Refresh() {
monitors, monitorErr := Monitors()
widget.UpdateRefreshedAt()
widget.View.SetTitle(widget.ContextualTitle(fmt.Sprintf("%s", widget.Name)))
widget.View.Clear()

View File

@ -37,7 +37,6 @@ func (widget *Widget) Disable() {
}
func (widget *Widget) Refresh() {
defer widget.UpdateRefreshedAt()
if isAuthenticated() {
widget.fetchAndDisplayEvents()
return

View File

@ -104,7 +104,6 @@ func (widget *Widget) Refresh() {
project.Refresh()
}
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -81,7 +81,6 @@ func (widget *Widget) Pull() {
func (widget *Widget) Refresh() {
repoPaths := wtf.ToStrs(wtf.Config.UList("wtf.mods.git.repositories"))
widget.UpdateRefreshedAt()
widget.Data = widget.gitRepos(repoPaths)
widget.display()
}

View File

@ -51,7 +51,6 @@ func (widget *Widget) Refresh() {
repo.Refresh()
}
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -63,7 +63,6 @@ func (widget *Widget) Refresh() {
project.Refresh()
}
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -64,7 +64,6 @@ func (widget *Widget) Refresh() {
}
messages, err := GetMessages(room.ID, wtf.Config.UInt("wtf.mods.gitter.numberOfMessages", 10))
widget.UpdateRefreshedAt()
if err != nil {
widget.View.SetWrap(true)

View File

@ -25,8 +25,6 @@ func NewWidget(app *tview.Application) *Widget {
func (widget *Widget) Refresh() {
cells, _ := Fetch()
widget.UpdateRefreshedAt()
widget.View.SetText(widget.contentFrom(cells))
}

View File

@ -79,7 +79,6 @@ func (widget *Widget) Refresh() {
widget.stories = stories
}
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -51,7 +51,6 @@ func NewWidget(app *tview.Application) *Widget {
// Refresh refresh the module
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.ipinfo()
widget.View.SetText(widget.result)
}

View File

@ -43,7 +43,6 @@ func NewWidget(app *tview.Application) *Widget {
}
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.ipinfo()
widget.View.Clear()

View File

@ -61,8 +61,6 @@ func (widget *Widget) Refresh() {
)
widget.view = view
widget.UpdateRefreshedAt()
if err != nil {
widget.View.SetWrap(true)
widget.View.SetTitle(widget.ContextualTitle(widget.Name))

View File

@ -54,8 +54,6 @@ func (widget *Widget) Refresh() {
wtf.Config.UString("wtf.mods.jira.jql", ""),
)
widget.UpdateRefreshedAt()
if err != nil {
widget.result = nil
widget.View.SetWrap(true)

View File

@ -52,7 +52,6 @@ func (widget *Widget) Refresh() {
return
}
widget.UpdateRefreshedAt()
widget.View.SetTitle(widget.Name)
logLines := widget.tailFile()

View File

@ -81,7 +81,6 @@ func (widget *Widget) Pull() {
func (widget *Widget) Refresh() {
repoPaths := wtf.ToStrs(wtf.Config.UList("wtf.mods.mercurial.repositories"))
widget.UpdateRefreshedAt()
widget.Data = widget.mercurialRepos(repoPaths)
widget.display()
}
@ -141,7 +140,7 @@ func (widget *Widget) modalFrame(form *tview.Form) *tview.Frame {
return frame
}
func (widget *Widget) currentData() *MercurialRepo{
func (widget *Widget) currentData() *MercurialRepo {
if len(widget.Data) == 0 {
return nil
}
@ -153,7 +152,7 @@ func (widget *Widget) currentData() *MercurialRepo{
return widget.Data[widget.Idx]
}
func (widget *Widget) mercurialRepos(repoPaths []string) []*MercurialRepo{
func (widget *Widget) mercurialRepos(repoPaths []string) []*MercurialRepo {
repos := []*MercurialRepo{}
for _, repoPath := range repoPaths {

View File

@ -31,7 +31,6 @@ func (widget *Widget) Refresh() {
appName = app.Name
}
widget.UpdateRefreshedAt()
widget.View.SetTitle(widget.ContextualTitle(fmt.Sprintf("%s - [green]%s[white]", widget.Name, appName)))
widget.View.Clear()

View File

@ -25,7 +25,6 @@ func NewWidget(app *tview.Application) *Widget {
func (widget *Widget) Refresh() {
data, err := Fetch()
widget.UpdateRefreshedAt()
widget.View.SetTitle(widget.ContextualTitle(widget.Name))
var content string

View File

@ -25,7 +25,6 @@ func NewWidget(app *tview.Application) *Widget {
}
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.Battery.Refresh()
content := ""

View File

@ -28,7 +28,6 @@ func (widget *Widget) Refresh() {
data := NewSecurityData()
data.Fetch()
widget.UpdateRefreshedAt()
widget.View.SetText(widget.contentFrom(data))
}

View File

@ -32,7 +32,6 @@ func (widget *Widget) Refresh() {
data := NewSecurityData()
data.Fetch()
widget.UpdateRefreshedAt()
widget.View.SetText(widget.contentFrom(data))
}

View File

@ -49,7 +49,6 @@ func (w *Widget) refreshSpotifyInfos() error {
func (w *Widget) Refresh() {
w.render()
w.UpdateRefreshedAt()
}
func (w *Widget) render() {

View File

@ -23,7 +23,6 @@ func NewWidget(app *tview.Application) *Widget {
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.View.SetText(widget.animation())
}

View File

@ -30,8 +30,6 @@ func NewWidget(app *tview.Application, date, version string) *Widget {
}
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.View.SetText(
fmt.Sprintf(
"%8s: %s\n%8s: %s\n\n%8s: %s\n%8s: %s",

View File

@ -69,7 +69,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.load()
widget.display()

View File

@ -87,7 +87,6 @@ func (w *Widget) Refresh() {
return
}
w.UpdateRefreshedAt()
w.display()
}

View File

@ -53,8 +53,6 @@ func (widget *Widget) Refresh() {
builds, err := BuildsFor()
widget.UpdateRefreshedAt()
if err != nil {
widget.View.SetWrap(true)
widget.View.SetTitle(widget.Name)

View File

@ -31,7 +31,6 @@ func (widget *Widget) Refresh() {
// Get the cards
searchResult, err := GetCards(client, getLists())
widget.UpdateRefreshedAt()
var content string
if err != nil {

View File

@ -60,7 +60,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
// Refresh is called on the interval and refreshes the data
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -27,7 +27,6 @@ func NewWidget(app *tview.Application) *Widget {
}
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.prettyWeather()
widget.View.SetText(widget.result)

View File

@ -73,7 +73,6 @@ func (widget *Widget) Refresh() {
widget.Data = widget.Fetch(wtf.ToInts(wtf.Config.UList("wtf.mods.weather.cityids", widget.defaultCityCodes())))
}
widget.UpdateRefreshedAt()
widget.display()
}

View File

@ -11,14 +11,13 @@ import (
//BarGraph lets make graphs
type BarGraph struct {
enabled bool
focusable bool
starChar string
maxStars int
Name string
RefreshedAt time.Time
RefreshInt int
View *tview.TextView
enabled bool
focusable bool
starChar string
maxStars int
Name string
RefreshInt int
View *tview.TextView
Position
@ -90,10 +89,6 @@ func (widget *BarGraph) TextView() *tview.TextView {
/* -------------------- Unexported Functions -------------------- */
func (widget *BarGraph) UpdateRefreshedAt() {
widget.RefreshedAt = time.Now()
}
func (widget *BarGraph) addView() {
view := tview.NewTextView()

View File

@ -2,7 +2,6 @@ package wtf
import (
"fmt"
"time"
"github.com/olebedev/config"
"github.com/rivo/tview"
@ -15,10 +14,9 @@ type TextWidget struct {
focusable bool
focusChar string
Name string
RefreshedAt time.Time
RefreshInt int
View *tview.TextView
Name string
RefreshInt int
View *tview.TextView
Position
}
@ -130,7 +128,3 @@ func (widget *TextWidget) addView(app *tview.Application, configKey string) {
widget.View = view
}
func (widget *TextWidget) UpdateRefreshedAt() {
widget.RefreshedAt = time.Now()
}

View File

@ -36,7 +36,6 @@ func (widget *Widget) Refresh() {
} else {
widget.result = ticketArray
}
widget.UpdateRefreshedAt()
widget.display()
}