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

Move all components responsible for module composition into /view

This commit is contained in:
Chris Cummer 2019-08-04 21:42:40 -07:00
parent 94d63306d4
commit dbc047516d
54 changed files with 226 additions and 196 deletions

View File

@ -5,20 +5,21 @@ import (
"time"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
const APIURI = "https://api.bamboohr.com/api/gateway.php"
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -4,11 +4,11 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
*Client
settings *Settings
@ -16,7 +16,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
Client: NewClient(settings.apiKey),
settings: settings,

View File

@ -5,11 +5,11 @@ import (
"time"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
app *tview.Application
clockColl ClockCollection
@ -20,7 +20,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
app: app,
settings: settings,

View File

@ -6,11 +6,12 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
args []string
cmd string
@ -20,7 +21,7 @@ type Widget struct {
// NewWidget creates a new instance of the widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
args: settings.args,
cmd: settings.cmd,

View File

@ -8,7 +8,7 @@ import (
"net/http"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
var ok = true
@ -18,7 +18,7 @@ const baseURL = "https://bittrex.com/api/v1.1/public/getmarketsummary"
// Widget define wtf widget to register widget later
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
summaryList
@ -27,7 +27,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
summaryList: summaryList{},

View File

@ -8,11 +8,11 @@ import (
"net/http"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
device_token string
settings *Settings
@ -20,7 +20,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
device_token: settings.deviceToken,
settings: settings,

View File

@ -7,12 +7,12 @@ import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive/price"
"github.com/wtfutil/wtf/modules/cryptoexchanges/cryptolive/toplist"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
// Widget define wtf widget to register widget later
type Widget struct {
wtf.TextWidget
view.TextWidget
priceWidget *price.Widget
toplistWidget *toplist.Widget
@ -22,7 +22,7 @@ type Widget struct {
// NewWidget Make new instance of widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
priceWidget: price.NewWidget(settings.priceSettings),
toplistWidget: toplist.NewWidget(settings.toplistSettings),

View File

@ -4,13 +4,14 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
datadog "github.com/zorkian/go-datadog-api"
)
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
monitors []datadog.Monitor
settings *Settings
@ -18,8 +19,8 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -7,6 +7,7 @@ import (
"github.com/mmcdole/gofeed"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
@ -22,8 +23,8 @@ type FeedItem struct {
// Widget is the container for RSS and Atom data
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
stories []*FeedItem
parser *gofeed.Parser
@ -33,8 +34,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := &Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
parser: gofeed.NewParser(),
settings: settings,

View File

@ -2,11 +2,11 @@ package gcal
import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
app *tview.Application
calEvents []*CalEvent
@ -15,7 +15,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common, true),
app: app,
settings: settings,

View File

@ -8,12 +8,13 @@ import (
glb "github.com/andygrunwald/go-gerrit"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.KeyboardWidget
wtf.TextWidget
view.KeyboardWidget
view.TextWidget
gerrit *glb.Client
@ -30,8 +31,8 @@ var (
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
Idx: 0,

View File

@ -8,6 +8,7 @@ import (
"github.com/gdamore/tcell"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
@ -16,9 +17,9 @@ const modalWidth = 80
const modalHeight = 7
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.TextWidget
view.KeyboardWidget
view.MultiSourceWidget
view.TextWidget
GitRepos []*GitRepo
@ -29,9 +30,9 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
app: app,
pages: pages,

View File

@ -4,13 +4,13 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.MultiSourceWidget
wtf.KeyboardWidget
wtf.TextWidget
view.MultiSourceWidget
view.KeyboardWidget
view.TextWidget
GithubRepos []*GithubRepo
@ -19,9 +19,9 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
settings: settings,
}

View File

@ -2,14 +2,14 @@ package gitlab
import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
glb "github.com/xanzy/go-gitlab"
)
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.TextWidget
view.KeyboardWidget
view.MultiSourceWidget
view.TextWidget
GitlabProjects []*GitlabProject
@ -26,9 +26,9 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
}
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
gitlab: gitlab,
settings: settings,

View File

@ -4,13 +4,14 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
// A Widget represents a Gitter widget
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
messages []Message
settings *Settings
@ -19,8 +20,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -2,18 +2,18 @@ package googleanalytics
import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -4,19 +4,20 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
sheets "google.golang.org/api/sheets/v4"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -6,12 +6,13 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
stories []Story
settings *Settings
@ -19,8 +20,8 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := &Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -4,12 +4,12 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
// Widget is the container for hibp data
type Widget struct {
wtf.TextWidget
view.TextWidget
accounts []string
settings *Settings
@ -18,7 +18,7 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := &Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -9,12 +9,12 @@ import (
"text/template"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
// Widget widget struct
type Widget struct {
wtf.TextWidget
view.TextWidget
result string
settings *Settings
@ -38,7 +38,7 @@ type ipinfo struct {
// NewWidget constructor
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -8,11 +8,11 @@ import (
"text/template"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
result string
settings *Settings
@ -31,7 +31,7 @@ type ipinfo struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -5,12 +5,13 @@ import (
"regexp"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
settings *Settings
view *View
@ -18,8 +19,8 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -4,12 +4,13 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
result *SearchResult
settings *Settings
@ -17,8 +18,8 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -7,13 +7,13 @@ import (
"github.com/rivo/tview"
log "github.com/wtfutil/wtf/logger"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
const maxBufferSize int64 = 1024
type Widget struct {
wtf.TextWidget
view.TextWidget
app *tview.Application
filePath string
@ -22,7 +22,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common, true),
app: app,
filePath: log.LogFilePath(),

View File

@ -3,6 +3,7 @@ package mercurial
import (
"github.com/gdamore/tcell"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
@ -12,9 +13,9 @@ const modalHeight = 7
// A Widget represents a Mercurial widget
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.TextWidget
view.KeyboardWidget
view.MultiSourceWidget
view.TextWidget
app *tview.Application
Data []*MercurialRepo
@ -25,9 +26,9 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
TextWidget: view.NewTextWidget(app, settings.common, true),
app: app,
pages: pages,

View File

@ -9,13 +9,14 @@ import (
"time"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
// A Widget represents an NBA Score widget
type Widget struct {
wtf.KeyboardWidget
wtf.TextWidget
view.KeyboardWidget
view.TextWidget
language string
result string
@ -27,8 +28,8 @@ var offset = 0
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
settings: settings,
}

View File

@ -4,12 +4,13 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
nr "github.com/yfronto/newrelic"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
client *Client
settings *Settings
@ -17,7 +18,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -5,18 +5,19 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -6,18 +6,19 @@ import (
"github.com/PagerDuty/go-pagerduty"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -4,11 +4,11 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
Battery *Battery
@ -17,7 +17,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
Battery: NewBattery(),

View File

@ -4,13 +4,14 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
// A Widget represents a Rollbar widget
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
items *Result
settings *Settings
@ -19,8 +20,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -5,18 +5,18 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -5,13 +5,14 @@ import (
"github.com/rivo/tview"
"github.com/sticreations/spotigopher/spotigopher"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
// A Widget represents a Spotify widget
type Widget struct {
wtf.KeyboardWidget
wtf.TextWidget
view.KeyboardWidget
view.TextWidget
client spotigopher.SpotifyClient
settings *Settings
@ -21,8 +22,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
Info: spotigopher.Info{},
client: spotigopher.NewClient(),

View File

@ -7,6 +7,7 @@ import (
"os"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
"github.com/zmb3/spotify"
)
@ -22,8 +23,8 @@ type Info struct {
// Widget is the struct used by all WTF widgets to transfer to the main widget controller
type Widget struct {
wtf.KeyboardWidget
wtf.TextWidget
view.KeyboardWidget
view.TextWidget
Info
@ -68,8 +69,8 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
var playerState *spotify.PlayerState
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
Info: Info{},

View File

@ -2,11 +2,11 @@ package status
import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
CurrentIcon int
@ -15,7 +15,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
CurrentIcon: 0,

View File

@ -5,11 +5,12 @@ import (
"time"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
Date string
Version string
@ -20,7 +21,7 @@ type Widget struct {
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
Date: date,

View File

@ -14,7 +14,7 @@ import (
"github.com/radovskyb/watcher"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/utils"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
const (
@ -22,9 +22,9 @@ const (
)
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.TextWidget
view.KeyboardWidget
view.MultiSourceWidget
view.TextWidget
settings *Settings
}
@ -32,9 +32,9 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "filePath", "filePaths"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "filePath", "filePaths"),
TextWidget: view.NewTextWidget(app, settings.common, true),
settings: settings,
}

View File

@ -8,18 +8,21 @@ import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/checklist"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
"gopkg.in/yaml.v2"
)
const offscreen = -1000
const modalWidth = 80
const modalHeight = 7
const (
offscreen = -1000
modalWidth = 80
modalHeight = 7
)
// A Widget represents a Todo widget
type Widget struct {
wtf.KeyboardWidget
wtf.TextWidget
view.KeyboardWidget
view.TextWidget
app *tview.Application
settings *Settings
@ -31,8 +34,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common, true),
app: app,
settings: settings,

View File

@ -3,14 +3,14 @@ package todoist
import (
"github.com/darkSasori/todoist"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
// A Widget represents a Todoist widget
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.MultiSourceWidget
view.ScrollableWidget
projects []*Project
settings *Settings
@ -19,9 +19,9 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "project", "projects"),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "project", "projects"),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -5,13 +5,13 @@ import (
"github.com/hekmon/transmissionrpc"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
// Widget is the container for transmission data
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
client *transmissionrpc.Client
settings *Settings
@ -21,8 +21,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -5,12 +5,13 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
builds *Builds
settings *Settings
@ -18,8 +19,8 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -5,18 +5,18 @@ import (
"github.com/adlio/trello"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -7,13 +7,14 @@ import (
"github.com/dustin/go-humanize"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.TextWidget
view.KeyboardWidget
view.MultiSourceWidget
view.TextWidget
client *Client
idx int
@ -23,9 +24,9 @@ type Widget struct {
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "screenName", "screenNames"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "screenName", "screenNames"),
TextWidget: view.NewTextWidget(app, settings.common, true),
idx: 0,
settings: settings,

View File

@ -4,18 +4,18 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
settings *Settings
}
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -4,12 +4,12 @@ import (
"fmt"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/wtf"
"github.com/wtfutil/wtf/view"
)
// Widget contains text info
type Widget struct {
wtf.TextWidget
view.TextWidget
teams []OnCallTeam
settings *Settings
@ -18,7 +18,7 @@ type Widget struct {
// NewWidget creates a new widget
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, true),
TextWidget: view.NewTextWidget(app, settings.common, true),
}
widget.View.SetScrollable(true)

View File

@ -6,11 +6,12 @@ import (
"strings"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
type Widget struct {
wtf.TextWidget
view.TextWidget
result string
settings *Settings
@ -18,7 +19,7 @@ type Widget struct {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, settings.common, false),
TextWidget: view.NewTextWidget(app, settings.common, false),
settings: settings,
}

View File

@ -3,14 +3,15 @@ package weather
import (
owm "github.com/briandowns/openweathermap"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
// Widget is the container for weather data.
type Widget struct {
wtf.KeyboardWidget
wtf.MultiSourceWidget
wtf.TextWidget
view.KeyboardWidget
view.MultiSourceWidget
view.TextWidget
// APIKey string
Data []*owm.CurrentWeatherData
@ -22,9 +23,9 @@ type Widget struct {
// NewWidget creates and returns a new instance of the weather Widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "cityid", "cityids"),
TextWidget: wtf.NewTextWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "cityid", "cityids"),
TextWidget: view.NewTextWidget(app, settings.common, true),
pages: pages,
settings: settings,

View File

@ -5,13 +5,14 @@ import (
"log"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/view"
"github.com/wtfutil/wtf/wtf"
)
// A Widget represents a Zendesk widget
type Widget struct {
wtf.KeyboardWidget
wtf.ScrollableWidget
view.KeyboardWidget
view.ScrollableWidget
result *TicketArray
settings *Settings
@ -20,8 +21,8 @@ type Widget struct {
// NewWidget creates a new instance of a widget
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
widget := Widget{
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: wtf.NewScrollableWidget(app, settings.common, true),
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
ScrollableWidget: view.NewScrollableWidget(app, settings.common, true),
settings: settings,
}

View File

@ -1,4 +1,4 @@
package wtf
package view
import (
"fmt"
@ -7,6 +7,7 @@ import (
"github.com/gdamore/tcell"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/wtf"
)
type helpItem struct {
@ -120,7 +121,7 @@ func (widget *KeyboardWidget) ShowHelp() {
widget.app.SetFocus(widget.view)
}
modal := NewBillboardModal(widget.HelpText(), closeFunc)
modal := wtf.NewBillboardModal(widget.HelpText(), closeFunc)
widget.pages.AddPage("help", modal, false, true)
widget.app.SetFocus(modal)

View File

@ -1,4 +1,4 @@
package wtf
package view
import (
"testing"

View File

@ -1,7 +1,8 @@
package wtf
package view
import (
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/wtf"
)
// MultiSourceWidget is a widget that supports displaying data from multiple sources
@ -89,7 +90,7 @@ func (widget *MultiSourceWidget) loadSources() {
single := widget.moduleConfig.Config.UString(widget.singular, "")
multiple := widget.moduleConfig.Config.UList(widget.plural, empty)
asStrs := ToStrs(multiple)
asStrs := wtf.ToStrs(multiple)
if single != "" {
asStrs = append(asStrs, single)

View File

@ -1,4 +1,4 @@
package wtf
package view
import (
"strconv"
@ -16,7 +16,6 @@ type ScrollableWidget struct {
}
func NewScrollableWidget(app *tview.Application, commonSettings *cfg.Common, focusable bool) ScrollableWidget {
widget := ScrollableWidget{
TextWidget: NewTextWidget(app, commonSettings, focusable),
}

View File

@ -1,4 +1,4 @@
package wtf
package view
import (
"fmt"
@ -6,6 +6,7 @@ import (
"github.com/rivo/tview"
"github.com/wtfutil/wtf/cfg"
"github.com/wtfutil/wtf/utils"
"github.com/wtfutil/wtf/wtf"
)
type TextWidget struct {
@ -148,10 +149,10 @@ func (widget *TextWidget) Redraw(title, text string, wrap bool) {
func (widget *TextWidget) addView() *tview.TextView {
view := tview.NewTextView()
view.SetBackgroundColor(ColorFor(widget.commonSettings.Colors.Background))
view.SetBorderColor(ColorFor(widget.BorderColor()))
view.SetTextColor(ColorFor(widget.commonSettings.Colors.Text))
view.SetTitleColor(ColorFor(widget.commonSettings.Colors.Title))
view.SetBackgroundColor(wtf.ColorFor(widget.commonSettings.Colors.Background))
view.SetBorderColor(wtf.ColorFor(widget.BorderColor()))
view.SetTextColor(wtf.ColorFor(widget.commonSettings.Colors.Text))
view.SetTitleColor(wtf.ColorFor(widget.commonSettings.Colors.Title))
view.SetBorder(true)
view.SetDynamicColors(true)

View File

@ -1,4 +1,4 @@
package wtf
package view
import (
"testing"