mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Reimpliments the module configuration validation
Now supports displaying errors from multiple widgets.
This commit is contained in:
@@ -40,7 +40,7 @@ func (widget *Widget) Refresh() {
|
||||
wtf.Now().Format(wtf.DateFormat),
|
||||
)
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(todayItems), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.contentFrom(todayItems), false)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -34,7 +34,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
builds, err := widget.Client.BuildsFor()
|
||||
|
||||
title := fmt.Sprintf("%s - Builds", widget.CommonSettings.Title)
|
||||
title := fmt.Sprintf("%s - Builds", widget.CommonSettings().Title)
|
||||
var content string
|
||||
wrap := false
|
||||
if err != nil {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat string) {
|
||||
if len(clocks) == 0 {
|
||||
title := fmt.Sprintf("\n%s", " no timezone data available")
|
||||
widget.Redraw(widget.CommonSettings.Title, title, true)
|
||||
widget.Redraw(widget.CommonSettings().Title, title, true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat stri
|
||||
)
|
||||
}
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, str, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, str, false)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
result := widget.execute()
|
||||
|
||||
ansiTitle := tview.TranslateANSI(widget.CommonSettings.Title)
|
||||
ansiTitle := tview.TranslateANSI(widget.CommonSettings().Title)
|
||||
if ansiTitle == defaultTitle {
|
||||
ansiTitle = tview.TranslateANSI(widget.String())
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
|
||||
func (widget *Widget) display() {
|
||||
if ok == false {
|
||||
widget.Redraw(widget.CommonSettings.Title, errorText, true)
|
||||
widget.Redraw(widget.CommonSettings().Title, errorText, true)
|
||||
return
|
||||
}
|
||||
|
||||
summaryText := widget.summaryText(&widget.summaryList)
|
||||
widget.Redraw(widget.CommonSettings.Title, summaryText, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, summaryText, false)
|
||||
}
|
||||
|
||||
func (widget *Widget) summaryText(list *summaryList) string {
|
||||
|
||||
@@ -34,13 +34,13 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
positions, err := Fetch(widget.device_token)
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
|
||||
content := widget.contentFrom(positions)
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, content, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, false)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -56,5 +56,5 @@ func (widget *Widget) display() {
|
||||
str += widget.priceWidget.Result
|
||||
str += widget.toplistWidget.Result
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, fmt.Sprintf("\n%s", str), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, fmt.Sprintf("\n%s", str), false)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func (widget *Widget) Refresh() {
|
||||
if monitorErr != nil {
|
||||
widget.monitors = nil
|
||||
widget.SetItemCount(0)
|
||||
widget.Redraw(widget.CommonSettings.Title, monitorErr.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, monitorErr.Error(), true)
|
||||
return
|
||||
}
|
||||
triggeredMonitors := []datadog.Monitor{}
|
||||
@@ -60,7 +60,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
func (widget *Widget) Render() {
|
||||
content := widget.contentFrom(widget.monitors)
|
||||
widget.Redraw(widget.CommonSettings.Title, content, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, false)
|
||||
}
|
||||
|
||||
func (widget *Widget) HelpText() string {
|
||||
|
||||
@@ -70,7 +70,7 @@ func (widget *Widget) Fetch(feedURLs []string) ([]*FeedItem, error) {
|
||||
func (widget *Widget) Refresh() {
|
||||
feedItems, err := widget.Fetch(widget.settings.feeds)
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
}
|
||||
|
||||
widget.stories = feedItems
|
||||
@@ -85,7 +85,7 @@ func (widget *Widget) Render() {
|
||||
return
|
||||
}
|
||||
|
||||
title := widget.CommonSettings.Title
|
||||
title := widget.CommonSettings().Title
|
||||
widget.Redraw(title, widget.contentFrom(widget.stories), false)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ func (widget *Widget) display() {
|
||||
|
||||
project := widget.currentGerritProject()
|
||||
if project == nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, "Gerrit project data is unavailable", true)
|
||||
widget.Redraw(widget.CommonSettings().Title, "Gerrit project data is unavailable", true)
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s- %s", widget.CommonSettings.Title, widget.title(project))
|
||||
title := fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.SigilStr(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
||||
|
||||
@@ -77,7 +77,7 @@ func (widget *Widget) Refresh() {
|
||||
if err != nil {
|
||||
widget.View.SetWrap(true)
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
widget.gerrit = gerrit
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
func (widget *Widget) display() {
|
||||
repoData := widget.currentData()
|
||||
if repoData == nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, " Git repo data is unavailable ", false)
|
||||
widget.Redraw(widget.CommonSettings().Title, " Git repo data is unavailable ", false)
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s - [green]%s[white]", widget.CommonSettings.Title, repoData.Repository)
|
||||
title := fmt.Sprintf("%s - [green]%s[white]", widget.CommonSettings().Title, repoData.Repository)
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.SigilStr(len(widget.GitRepos), widget.Idx, width) + "\n"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
func (widget *Widget) display() {
|
||||
repo := widget.currentGithubRepo()
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.title(repo))
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(repo))
|
||||
if repo == nil {
|
||||
widget.TextWidget.Redraw(title, " GitHub repo data is unavailable ", false)
|
||||
return
|
||||
|
||||
@@ -8,11 +8,11 @@ func (widget *Widget) display() {
|
||||
|
||||
project := widget.currentGitlabProject()
|
||||
if project == nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, " Gitlab project data is unavailable ", true)
|
||||
widget.Redraw(widget.CommonSettings().Title, " Gitlab project data is unavailable ", true)
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s- %s", widget.CommonSettings.Title, widget.title(project))
|
||||
title := fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.SigilStr(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
||||
|
||||
@@ -43,19 +43,19 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
room, err := GetRoom(widget.settings.roomURI, widget.settings.apiToken)
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
|
||||
if room == nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, "No room", true)
|
||||
widget.Redraw(widget.CommonSettings().Title, "No room", true)
|
||||
return
|
||||
}
|
||||
|
||||
messages, err := GetMessages(room.ID, widget.settings.numberOfMessages, widget.settings.apiToken)
|
||||
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
widget.messages = messages
|
||||
@@ -75,7 +75,7 @@ func (widget *Widget) display() {
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.settings.roomURI)
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.settings.roomURI)
|
||||
|
||||
widget.Redraw(title, widget.contentFrom(widget.messages), true)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
cells, _ := widget.Fetch()
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(cells), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.contentFrom(cells), false)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -47,7 +47,7 @@ func (widget *Widget) Refresh() {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
var stories []Story
|
||||
@@ -70,7 +70,7 @@ func (widget *Widget) Render() {
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s - %s stories", widget.CommonSettings.Title, widget.settings.storyType)
|
||||
title := fmt.Sprintf("%s - %s stories", widget.CommonSettings().Title, widget.settings.storyType)
|
||||
widget.Redraw(title, widget.contentFrom(widget.stories), false)
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (widget *Widget) Fetch(accounts []string) ([]*Status, error) {
|
||||
func (widget *Widget) Refresh() {
|
||||
data, err := widget.Fetch(widget.settings.accounts)
|
||||
|
||||
title := widget.CommonSettings.Title
|
||||
title := widget.CommonSettings().Title
|
||||
title = title + widget.sinceDateForTitle()
|
||||
|
||||
var content string
|
||||
|
||||
@@ -52,7 +52,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.ipinfo()
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.result, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.result, false)
|
||||
}
|
||||
|
||||
//this method reads the config and calls ipinfo for ip information
|
||||
|
||||
@@ -44,7 +44,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.ipinfo()
|
||||
|
||||
widget.TextWidget.Redraw(widget.CommonSettings.Title, widget.result, false)
|
||||
widget.TextWidget.Redraw(widget.CommonSettings().Title, widget.result, false)
|
||||
}
|
||||
|
||||
//this method reads the config and calls ipinfo for ip information
|
||||
|
||||
@@ -48,7 +48,7 @@ func (widget *Widget) Refresh() {
|
||||
widget.view = view
|
||||
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ func (widget *Widget) Render() {
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s: [red]%s", widget.CommonSettings.Title, widget.view.Name)
|
||||
title := fmt.Sprintf("%s: [red]%s", widget.CommonSettings().Title, widget.view.Name)
|
||||
|
||||
widget.Redraw(title, widget.contentFrom(widget.view), false)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
if err != nil {
|
||||
widget.result = nil
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
widget.result = searchResult
|
||||
@@ -56,7 +56,7 @@ func (widget *Widget) Render() {
|
||||
return
|
||||
}
|
||||
|
||||
str := fmt.Sprintf("%s- [green]%s[white]", widget.CommonSettings.Title, widget.settings.projects)
|
||||
str := fmt.Sprintf("%s- [green]%s[white]", widget.CommonSettings().Title, widget.settings.projects)
|
||||
|
||||
widget.Redraw(str, widget.contentFrom(widget.result), false)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
logLines := widget.tailFile()
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(logLines), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.contentFrom(logLines), false)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
func (widget *Widget) display() {
|
||||
repoData := widget.currentData()
|
||||
if repoData == nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, " Mercurial repo data is unavailable ", false)
|
||||
widget.Redraw(widget.CommonSettings().Title, " Mercurial repo data is unavailable ", false)
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s - [green]%s[white]", widget.CommonSettings.Title, repoData.Repository)
|
||||
title := fmt.Sprintf("%s - [green]%s[white]", widget.CommonSettings().Title, repoData.Repository)
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n"
|
||||
|
||||
@@ -44,7 +44,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
}
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.nbascore(), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.nbascore(), false)
|
||||
}
|
||||
|
||||
func (widget *Widget) HelpText() string {
|
||||
|
||||
@@ -39,7 +39,7 @@ func (widget *Widget) Refresh() {
|
||||
}
|
||||
|
||||
var content string
|
||||
title := fmt.Sprintf("%s - [green]%s[white]", widget.CommonSettings.Title, appName)
|
||||
title := fmt.Sprintf("%s - [green]%s[white]", widget.CommonSettings().Title, appName)
|
||||
wrap := false
|
||||
if depErr != nil {
|
||||
wrap = true
|
||||
|
||||
@@ -41,7 +41,7 @@ func (widget *Widget) Refresh() {
|
||||
content = widget.contentFrom(data)
|
||||
}
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, content, wrap)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, wrap)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -58,7 +58,7 @@ func (widget *Widget) Refresh() {
|
||||
content = widget.contentFrom(onCalls, incidents)
|
||||
}
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, content, wrap)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, wrap)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -36,5 +36,5 @@ func (widget *Widget) Refresh() {
|
||||
content += "\n"
|
||||
content += widget.Battery.String()
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, content, true)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, true)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (widget *Widget) Refresh() {
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
widget.items = &items.Results
|
||||
@@ -64,7 +64,7 @@ func (widget *Widget) Render() {
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.settings.projectName)
|
||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.settings.projectName)
|
||||
widget.Redraw(title, widget.contentFrom(widget.items), false)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ func (widget *Widget) Refresh() {
|
||||
data := NewSecurityData()
|
||||
data.Fetch()
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(data), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.contentFrom(data), false)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -66,13 +66,13 @@ func (w *Widget) render() {
|
||||
} else {
|
||||
content = w.createOutput()
|
||||
}
|
||||
w.Redraw(w.CommonSettings.Title, content, true)
|
||||
w.Redraw(w.CommonSettings().Title, content, true)
|
||||
}
|
||||
|
||||
func (w *Widget) createOutput() string {
|
||||
output := wtf.CenterText(fmt.Sprintf("[green]Now %v [white]\n", w.Info.Status), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Title:[white] %v\n ", w.Info.Title), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Artist:[white] %v\n", w.Info.Artist), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]%v:[white] %v\n", w.Info.TrackNumber, w.Info.Album), w.Width())
|
||||
output := wtf.CenterText(fmt.Sprintf("[green]Now %v [white]\n", w.Info.Status), w.CommonSettings().Width)
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Title:[white] %v\n ", w.Info.Title), w.CommonSettings().Width)
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Artist:[white] %v\n", w.Info.Artist), w.CommonSettings().Width)
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]%v:[white] %v\n", w.Info.TrackNumber, w.Info.Album), w.CommonSettings().Width)
|
||||
return output
|
||||
}
|
||||
|
||||
@@ -158,9 +158,9 @@ func (w *Widget) refreshSpotifyInfos() error {
|
||||
func (w *Widget) Refresh() {
|
||||
err := w.refreshSpotifyInfos()
|
||||
if err != nil {
|
||||
w.Redraw(w.CommonSettings.Title, err.Error(), true)
|
||||
w.Redraw(w.CommonSettings().Title, err.Error(), true)
|
||||
} else {
|
||||
w.Redraw(w.CommonSettings.Title, w.createOutput(), false)
|
||||
w.Redraw(w.CommonSettings().Title, w.createOutput(), false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,14 +169,14 @@ func (widget *Widget) HelpText() string {
|
||||
}
|
||||
|
||||
func (w *Widget) createOutput() string {
|
||||
output := wtf.CenterText(fmt.Sprintf("[green]Now %v [white]\n", w.Info.Status), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Title:[white] %v\n", w.Info.Title), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Artist:[white] %v\n", w.Info.Artists), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Album:[white] %v\n", w.Info.Album), w.Width())
|
||||
output := wtf.CenterText(fmt.Sprintf("[green]Now %v [white]\n", w.Info.Status), w.CommonSettings().Width)
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Title:[white] %v\n", w.Info.Title), w.CommonSettings().Width)
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Artist:[white] %v\n", w.Info.Artists), w.CommonSettings().Width)
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Album:[white] %v\n", w.Info.Album), w.CommonSettings().Width)
|
||||
if w.playerState.ShuffleState {
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Shuffle:[white] on\n"), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Shuffle:[white] on\n"), w.CommonSettings().Width)
|
||||
} else {
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Shuffle:[white] off\n"), w.Width())
|
||||
output += wtf.CenterText(fmt.Sprintf("[green]Shuffle:[white] off\n"), w.CommonSettings().Width)
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.animation(), false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.animation(), false)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
@@ -45,7 +45,7 @@ func (widget *Widget) Refresh() {
|
||||
"Build",
|
||||
widget.systemInfo.BuildVersion,
|
||||
)
|
||||
widget.Redraw(widget.CommonSettings.Title, content, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, false)
|
||||
}
|
||||
|
||||
func (widget *Widget) prettyDate() string {
|
||||
|
||||
@@ -31,7 +31,7 @@ func (widget *Widget) display() {
|
||||
newList.SetSelectedByItem(widget.list.SelectedItem())
|
||||
widget.SetList(newList)
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, str, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, str, false)
|
||||
}
|
||||
|
||||
func (widget *Widget) formattedItemLine(idx int, item *checklist.ChecklistItem, selectedItem *checklist.ChecklistItem, maxLen int) string {
|
||||
|
||||
@@ -32,7 +32,7 @@ func (widget *Widget) contentFrom(data []*transmissionrpc.Torrent) string {
|
||||
|
||||
func (widget *Widget) display() {
|
||||
content := widget.contentFrom(widget.torrents)
|
||||
widget.ScrollableWidget.Redraw(widget.CommonSettings.Title, content, false)
|
||||
widget.ScrollableWidget.Redraw(widget.CommonSettings().Title, content, false)
|
||||
}
|
||||
|
||||
func (widget *Widget) prettyTorrentName(name string) string {
|
||||
|
||||
@@ -64,7 +64,7 @@ func (widget *Widget) Refresh() {
|
||||
torrents, err := widget.Fetch()
|
||||
if err != nil {
|
||||
widget.SetItemCount(0)
|
||||
widget.ScrollableWidget.Redraw(widget.CommonSettings.Title, err.Error(), false)
|
||||
widget.ScrollableWidget.Redraw(widget.CommonSettings().Title, err.Error(), false)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ func (widget *Widget) Refresh() {
|
||||
builds, err := BuildsFor(widget.settings.apiKey, widget.settings.pro)
|
||||
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
return
|
||||
}
|
||||
widget.builds = builds
|
||||
@@ -58,7 +58,7 @@ func (widget *Widget) Render() {
|
||||
return
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("%s - Builds", widget.CommonSettings.Title)
|
||||
title := fmt.Sprintf("%s - Builds", widget.CommonSettings().Title)
|
||||
widget.Redraw(title, widget.contentFrom(widget.builds), false)
|
||||
}
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ func (widget *Widget) Refresh() {
|
||||
wrap := false
|
||||
if err != nil {
|
||||
wrap = true
|
||||
title = widget.CommonSettings.Title
|
||||
title = widget.CommonSettings().Title
|
||||
content = err.Error()
|
||||
} else {
|
||||
widget.View.SetWrap(false)
|
||||
title = fmt.Sprintf(
|
||||
"[white]%s: [green]%s ",
|
||||
widget.CommonSettings.Title,
|
||||
widget.CommonSettings().Title,
|
||||
widget.settings.board,
|
||||
)
|
||||
content = widget.contentFrom(searchResult)
|
||||
|
||||
@@ -26,6 +26,6 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Refresh() {
|
||||
content := fmt.Sprintf("Widget %s and/or type %s does not exist", widget.Name(), widget.CommonSettings.Module.Type)
|
||||
widget.Redraw(widget.CommonSettings.Title, content, true)
|
||||
content := fmt.Sprintf("Widget %s and/or type %s does not exist", widget.Name(), widget.CommonSettings().Module.Type)
|
||||
widget.Redraw(widget.CommonSettings().Title, content, true)
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ func (widget *Widget) Refresh() {
|
||||
teams, err := Fetch(widget.settings.apiID, widget.settings.apiKey)
|
||||
|
||||
if err != nil {
|
||||
widget.Redraw(widget.CommonSettings.Title, err.Error(), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, err.Error(), true)
|
||||
} else {
|
||||
widget.teams = teams
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.contentFrom(widget.teams), true)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.contentFrom(widget.teams), true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.prettyWeather()
|
||||
|
||||
widget.Redraw(widget.CommonSettings.Title, widget.result, false)
|
||||
widget.Redraw(widget.CommonSettings().Title, widget.result, false)
|
||||
}
|
||||
|
||||
//this method reads the config and calls wttr.in for pretty weather
|
||||
|
||||
@@ -24,7 +24,7 @@ func (widget *Widget) display() {
|
||||
err += " Weather data is unavailable: no weather data\n"
|
||||
}
|
||||
|
||||
title := widget.CommonSettings.Title
|
||||
title := widget.CommonSettings().Title
|
||||
setWrap := false
|
||||
|
||||
var content string
|
||||
|
||||
@@ -52,7 +52,7 @@ func (widget *Widget) Refresh() {
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) Render() {
|
||||
title := fmt.Sprintf("%s (%d)", widget.CommonSettings.Title, widget.result.Count)
|
||||
title := fmt.Sprintf("%s (%d)", widget.CommonSettings().Title, widget.result.Count)
|
||||
widget.Redraw(title, widget.textContent(widget.result.Tickets), false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user