mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
use widget.View.SetText to print
This commit is contained in:
parent
86e58ef367
commit
6443df092f
@ -38,9 +38,8 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.SetTitle(fmt.Sprintf(" 👽 Away (%d) ", len(todayItems)))
|
widget.View.SetTitle(fmt.Sprintf(" 👽 Away (%d) ", len(todayItems)))
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(todayItems))
|
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(todayItems)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -23,5 +23,5 @@ func (widget *Widget) display(clocks []Clock) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", str)
|
widget.View.SetText(fmt.Sprintf("%s", str))
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ func (widget *Widget) Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.Clear()
|
|
||||||
widget.display(widget.clockColl.Sorted())
|
widget.display(widget.clockColl.Sorted())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,10 +40,9 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.execute()
|
widget.execute()
|
||||||
widget.View.Clear()
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" %s ", widget))
|
widget.View.SetTitle(fmt.Sprintf(" %s ", widget))
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", widget.result)
|
widget.View.SetText(fmt.Sprintf("%s", widget.result))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) String() string {
|
func (widget *Widget) String() string {
|
||||||
|
@ -36,9 +36,8 @@ func (widget *Widget) Refresh() {
|
|||||||
events, _ := Fetch()
|
events, _ := Fetch()
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(events))
|
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(events)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) display() {
|
func (widget *Widget) display() {
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
repoData := widget.currentData()
|
repoData := widget.currentData()
|
||||||
if repoData == nil {
|
if repoData == nil {
|
||||||
@ -28,7 +27,7 @@ func (widget *Widget) display() {
|
|||||||
str = str + "\n"
|
str = str + "\n"
|
||||||
str = str + widget.formatCommits(repoData.Commits)
|
str = str + widget.formatCommits(repoData.Commits)
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", str)
|
widget.View.SetText(fmt.Sprintf("%s", str))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatChanges(data []string) string {
|
func (widget *Widget) formatChanges(data []string) string {
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) display() {
|
func (widget *Widget) display() {
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
repo := widget.currentGithubRepo()
|
repo := widget.currentGithubRepo()
|
||||||
if repo == nil {
|
if repo == nil {
|
||||||
@ -27,7 +26,7 @@ func (widget *Widget) display() {
|
|||||||
str = str + " [red]My Pull Requests[white]\n"
|
str = str + " [red]My Pull Requests[white]\n"
|
||||||
str = str + widget.displayMyPullRequests(repo, Config.UString("wtf.mods.github.username"))
|
str = str + widget.displayMyPullRequests(repo, Config.UString("wtf.mods.github.username"))
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, str)
|
widget.View.SetText(str)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) displayMyPullRequests(repo *GithubRepo, username string) string {
|
func (widget *Widget) displayMyPullRequests(repo *GithubRepo, username string) string {
|
||||||
|
@ -32,7 +32,6 @@ func (widget *Widget) Refresh() {
|
|||||||
searchResult, err := IssuesFor(Config.UString("wtf.mods.jira.username"), Config.UString("wtf.mods.jira.project", ""), Config.UString("wtf.mods.jira.jql", ""))
|
searchResult, err := IssuesFor(Config.UString("wtf.mods.jira.username"), Config.UString("wtf.mods.jira.project", ""), Config.UString("wtf.mods.jira.jql", ""))
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
@ -47,7 +46,7 @@ func (widget *Widget) Refresh() {
|
|||||||
Config.UString("wtf.mods.jira.project"),
|
Config.UString("wtf.mods.jira.project"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(searchResult))
|
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(searchResult)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
if depErr != nil {
|
if depErr != nil {
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
fmt.Fprintf(widget.View, "%s", depErr)
|
widget.View.SetText(fmt.Sprintf("%s", depErr))
|
||||||
} else {
|
} else {
|
||||||
widget.View.SetWrap(false)
|
widget.View.SetWrap(false)
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(deploys))
|
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(deploys)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ func (widget *Widget) contentFrom(deploys []nr.ApplicationDeployment) string {
|
|||||||
|
|
||||||
var revLen = 8
|
var revLen = 8
|
||||||
if revLen > len(deploy.Revision) {
|
if revLen > len(deploy.Revision) {
|
||||||
revLen = len(deploy.Revision)
|
revLen = len(deploy.Revision)
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str = str + fmt.Sprintf(
|
||||||
|
@ -34,14 +34,13 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.SetTitle(" ⏰ On Call ")
|
widget.View.SetTitle(" ⏰ On Call ")
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
fmt.Fprintf(widget.View, "%s", err)
|
widget.View.SetText(fmt.Sprintf("%s", err))
|
||||||
} else {
|
} else {
|
||||||
widget.View.SetWrap(false)
|
widget.View.SetWrap(false)
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(data))
|
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(data)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,12 +34,11 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.Battery.Refresh()
|
widget.Battery.Refresh()
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
str = str + fmt.Sprintf(" %10s: %s\n", "Source", powerSource())
|
str = str + fmt.Sprintf(" %10s: %s\n", "Source", powerSource())
|
||||||
str = str + "\n"
|
str = str + "\n"
|
||||||
str = str + widget.Battery.String()
|
str = str + widget.Battery.String()
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", str)
|
widget.View.SetText(fmt.Sprintf("%s", str))
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,12 @@ package prettyweather
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/olebedev/config"
|
|
||||||
"github.com/senorprogrammer/wtf/wtf"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/olebedev/config"
|
||||||
|
"github.com/senorprogrammer/wtf/wtf"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is a pointer to the global config object
|
// Config is a pointer to the global config object
|
||||||
@ -34,10 +35,9 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.prettyWeather()
|
widget.prettyWeather()
|
||||||
widget.View.Clear()
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
|
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", widget.result)
|
widget.View.SetText(fmt.Sprintf("%s", widget.result))
|
||||||
}
|
}
|
||||||
|
|
||||||
//this method reads the config and calls wttr.in for pretty weather
|
//this method reads the config and calls wttr.in for pretty weather
|
||||||
|
@ -34,9 +34,8 @@ func (widget *Widget) Refresh() {
|
|||||||
data.Fetch()
|
data.Fetch()
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(data))
|
widget.View.SetText(fmt.Sprintf("%s", widget.contentFrom(data)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -33,12 +33,12 @@ func (widget *Widget) Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
fmt.Fprintf(
|
widget.View.SetText(
|
||||||
widget.View,
|
fmt.Sprintf(
|
||||||
"\n%s",
|
"\n%s",
|
||||||
widget.animation(),
|
widget.animation(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,19 +38,19 @@ func (widget *Widget) Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
fmt.Fprintf(
|
widget.View.SetText(
|
||||||
widget.View,
|
fmt.Sprintf(
|
||||||
"%8s: %s\n%8s: %s\n\n%8s: %s\n%8s: %s",
|
"%8s: %s\n%8s: %s\n\n%8s: %s\n%8s: %s",
|
||||||
"Built",
|
"Built",
|
||||||
widget.prettyDate(),
|
widget.prettyDate(),
|
||||||
"Vers",
|
"Vers",
|
||||||
widget.Version,
|
widget.Version,
|
||||||
"OS",
|
"OS",
|
||||||
widget.systemInfo.ProductVersion,
|
widget.systemInfo.ProductVersion,
|
||||||
"Build",
|
"Build",
|
||||||
widget.systemInfo.BuildVersion,
|
widget.systemInfo.BuildVersion,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
widget.UpdateRefreshedAt()
|
widget.UpdateRefreshedAt()
|
||||||
widget.View.SetTitle(fmt.Sprintf(" 📄 %s ", widget.filePath))
|
widget.View.SetTitle(fmt.Sprintf(" 📄 %s ", widget.filePath))
|
||||||
widget.View.Clear()
|
|
||||||
|
|
||||||
filePath, _ := wtf.ExpandHomeDir(widget.filePath)
|
filePath, _ := wtf.ExpandHomeDir(widget.filePath)
|
||||||
|
|
||||||
@ -64,9 +63,9 @@ func (widget *Widget) Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(widget.View, "%s", err)
|
widget.View.SetText(fmt.Sprintf("%s", err))
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(widget.View, "%s", string(fileData))
|
widget.View.SetText(fmt.Sprintf("%s", string(fileData)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ func (widget *Widget) display() {
|
|||||||
widget.SetList(&newList)
|
widget.SetList(&newList)
|
||||||
|
|
||||||
widget.View.Clear()
|
widget.View.Clear()
|
||||||
fmt.Fprintf(widget.View, "%s", str)
|
widget.View.SetText(fmt.Sprintf("%s", str))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formattedItemLine(item *Item, selectedItem *Item, maxLen int) string {
|
func (widget *Widget) formattedItemLine(item *Item, selectedItem *Item, maxLen int) string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user