mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-1031 Rename WtfApp.app to WtfApp.tviewApp
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
parent
9ba22f656b
commit
ee13fd83cc
@ -20,17 +20,17 @@ const (
|
||||
// FocusTracker is used by the app to track which onscreen widget currently has focus,
|
||||
// and to move focus between widgets.
|
||||
type FocusTracker struct {
|
||||
App *tview.Application
|
||||
Idx int
|
||||
IsFocused bool
|
||||
Widgets []wtf.Wtfable
|
||||
|
||||
config *config.Config
|
||||
config *config.Config
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
func NewFocusTracker(app *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker {
|
||||
func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker {
|
||||
focusTracker := FocusTracker{
|
||||
App: app,
|
||||
tviewApp: tviewApp,
|
||||
Idx: -1,
|
||||
IsFocused: false,
|
||||
Widgets: widgets,
|
||||
@ -196,7 +196,7 @@ func (tracker *FocusTracker) focus(idx int) {
|
||||
widget.CommonSettings().Colors.BorderTheme.Focused,
|
||||
),
|
||||
)
|
||||
tracker.App.SetFocus(view)
|
||||
tracker.tviewApp.SetFocus(view)
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) focusables() []wtf.Wtfable {
|
||||
@ -239,7 +239,7 @@ func (tracker *FocusTracker) focusState() FocusState {
|
||||
}
|
||||
|
||||
for _, widget := range tracker.Widgets {
|
||||
if widget.TextView() == tracker.App.GetFocus() {
|
||||
if widget.TextView() == tracker.tviewApp.GetFocus() {
|
||||
return widgetFocused
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ import (
|
||||
|
||||
// MakeWidget creates and returns instances of widgets
|
||||
func MakeWidget(
|
||||
app *tview.Application,
|
||||
tviewApp *tview.Application,
|
||||
pages *tview.Pages,
|
||||
moduleName string,
|
||||
config *config.Config,
|
||||
@ -103,239 +103,239 @@ func MakeWidget(
|
||||
switch moduleConfig.UString("type", moduleName) {
|
||||
case "arpansagovau":
|
||||
settings := arpansagovau.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = arpansagovau.NewWidget(app, settings)
|
||||
widget = arpansagovau.NewWidget(tviewApp, settings)
|
||||
case "azuredevops":
|
||||
settings := azuredevops.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = azuredevops.NewWidget(app, pages, settings)
|
||||
widget = azuredevops.NewWidget(tviewApp, pages, settings)
|
||||
case "bamboohr":
|
||||
settings := bamboohr.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = bamboohr.NewWidget(app, settings)
|
||||
widget = bamboohr.NewWidget(tviewApp, settings)
|
||||
case "bargraph":
|
||||
settings := bargraph.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = bargraph.NewWidget(app, settings)
|
||||
widget = bargraph.NewWidget(tviewApp, settings)
|
||||
case "bittrex":
|
||||
settings := bittrex.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = bittrex.NewWidget(app, settings)
|
||||
widget = bittrex.NewWidget(tviewApp, settings)
|
||||
case "blockfolio":
|
||||
settings := blockfolio.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = blockfolio.NewWidget(app, settings)
|
||||
widget = blockfolio.NewWidget(tviewApp, settings)
|
||||
case "buildkite":
|
||||
settings := buildkite.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = buildkite.NewWidget(app, pages, settings)
|
||||
widget = buildkite.NewWidget(tviewApp, pages, settings)
|
||||
case "cdsFavorites":
|
||||
settings := cdsfavorites.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cdsfavorites.NewWidget(app, pages, settings)
|
||||
widget = cdsfavorites.NewWidget(tviewApp, pages, settings)
|
||||
case "cdsQueue":
|
||||
settings := cdsqueue.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cdsqueue.NewWidget(app, pages, settings)
|
||||
widget = cdsqueue.NewWidget(tviewApp, pages, settings)
|
||||
case "cdsStatus":
|
||||
settings := cdsstatus.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cdsstatus.NewWidget(app, pages, settings)
|
||||
widget = cdsstatus.NewWidget(tviewApp, pages, settings)
|
||||
case "circleci":
|
||||
settings := circleci.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = circleci.NewWidget(app, settings)
|
||||
widget = circleci.NewWidget(tviewApp, settings)
|
||||
case "clocks":
|
||||
settings := clocks.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = clocks.NewWidget(app, settings)
|
||||
widget = clocks.NewWidget(tviewApp, settings)
|
||||
case "cmdrunner":
|
||||
settings := cmdrunner.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cmdrunner.NewWidget(app, settings)
|
||||
widget = cmdrunner.NewWidget(tviewApp, settings)
|
||||
case "cryptolive":
|
||||
settings := cryptolive.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = cryptolive.NewWidget(app, settings)
|
||||
widget = cryptolive.NewWidget(tviewApp, settings)
|
||||
case "datadog":
|
||||
settings := datadog.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = datadog.NewWidget(app, pages, settings)
|
||||
widget = datadog.NewWidget(tviewApp, pages, settings)
|
||||
case "devto":
|
||||
settings := devto.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = devto.NewWidget(app, pages, settings)
|
||||
widget = devto.NewWidget(tviewApp, pages, settings)
|
||||
case "digitalclock":
|
||||
settings := digitalclock.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = digitalclock.NewWidget(app, settings)
|
||||
widget = digitalclock.NewWidget(tviewApp, settings)
|
||||
case "digitalocean":
|
||||
settings := digitalocean.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = digitalocean.NewWidget(app, pages, settings)
|
||||
widget = digitalocean.NewWidget(tviewApp, pages, settings)
|
||||
case "docker":
|
||||
settings := docker.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = docker.NewWidget(app, pages, settings)
|
||||
widget = docker.NewWidget(tviewApp, pages, settings)
|
||||
case "feedreader":
|
||||
settings := feedreader.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = feedreader.NewWidget(app, pages, settings)
|
||||
widget = feedreader.NewWidget(tviewApp, pages, settings)
|
||||
case "football":
|
||||
settings := football.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = football.NewWidget(app, pages, settings)
|
||||
widget = football.NewWidget(tviewApp, pages, settings)
|
||||
case "gcal":
|
||||
settings := gcal.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gcal.NewWidget(app, settings)
|
||||
widget = gcal.NewWidget(tviewApp, settings)
|
||||
case "gerrit":
|
||||
settings := gerrit.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gerrit.NewWidget(app, pages, settings)
|
||||
widget = gerrit.NewWidget(tviewApp, pages, settings)
|
||||
case "git":
|
||||
settings := git.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = git.NewWidget(app, pages, settings)
|
||||
widget = git.NewWidget(tviewApp, pages, settings)
|
||||
case "github":
|
||||
settings := github.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = github.NewWidget(app, pages, settings)
|
||||
widget = github.NewWidget(tviewApp, pages, settings)
|
||||
case "gitlab":
|
||||
settings := gitlab.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gitlab.NewWidget(app, pages, settings)
|
||||
widget = gitlab.NewWidget(tviewApp, pages, settings)
|
||||
case "gitlabtodo":
|
||||
settings := gitlabtodo.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gitlabtodo.NewWidget(app, pages, settings)
|
||||
widget = gitlabtodo.NewWidget(tviewApp, pages, settings)
|
||||
case "gitter":
|
||||
settings := gitter.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gitter.NewWidget(app, pages, settings)
|
||||
widget = gitter.NewWidget(tviewApp, pages, settings)
|
||||
case "googleanalytics":
|
||||
settings := googleanalytics.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = googleanalytics.NewWidget(app, settings)
|
||||
widget = googleanalytics.NewWidget(tviewApp, settings)
|
||||
case "gspreadsheets":
|
||||
settings := gspreadsheets.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = gspreadsheets.NewWidget(app, settings)
|
||||
widget = gspreadsheets.NewWidget(tviewApp, settings)
|
||||
case "grafana":
|
||||
settings := grafana.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = grafana.NewWidget(app, pages, settings)
|
||||
widget = grafana.NewWidget(tviewApp, pages, settings)
|
||||
case "hackernews":
|
||||
settings := hackernews.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = hackernews.NewWidget(app, pages, settings)
|
||||
widget = hackernews.NewWidget(tviewApp, pages, settings)
|
||||
case "hibp":
|
||||
settings := hibp.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = hibp.NewWidget(app, settings)
|
||||
widget = hibp.NewWidget(tviewApp, settings)
|
||||
case "ipapi":
|
||||
settings := ipapi.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = ipapi.NewWidget(app, settings)
|
||||
widget = ipapi.NewWidget(tviewApp, settings)
|
||||
case "ipinfo":
|
||||
settings := ipinfo.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = ipinfo.NewWidget(app, settings)
|
||||
widget = ipinfo.NewWidget(tviewApp, settings)
|
||||
case "jenkins":
|
||||
settings := jenkins.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = jenkins.NewWidget(app, pages, settings)
|
||||
widget = jenkins.NewWidget(tviewApp, pages, settings)
|
||||
case "jira":
|
||||
settings := jira.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = jira.NewWidget(app, pages, settings)
|
||||
widget = jira.NewWidget(tviewApp, pages, settings)
|
||||
case "kubernetes":
|
||||
settings := kubernetes.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = kubernetes.NewWidget(app, settings)
|
||||
widget = kubernetes.NewWidget(tviewApp, settings)
|
||||
case "krisinformation":
|
||||
settings := krisinformation.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = krisinformation.NewWidget(app, settings)
|
||||
widget = krisinformation.NewWidget(tviewApp, settings)
|
||||
case "logger":
|
||||
settings := logger.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = logger.NewWidget(app, settings)
|
||||
widget = logger.NewWidget(tviewApp, settings)
|
||||
case "mercurial":
|
||||
settings := mercurial.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = mercurial.NewWidget(app, pages, settings)
|
||||
widget = mercurial.NewWidget(tviewApp, pages, settings)
|
||||
case "nbascore":
|
||||
settings := nbascore.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = nbascore.NewWidget(app, pages, settings)
|
||||
widget = nbascore.NewWidget(tviewApp, pages, settings)
|
||||
case "newrelic":
|
||||
settings := newrelic.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = newrelic.NewWidget(app, pages, settings)
|
||||
widget = newrelic.NewWidget(tviewApp, pages, settings)
|
||||
case "opsgenie":
|
||||
settings := opsgenie.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = opsgenie.NewWidget(app, settings)
|
||||
widget = opsgenie.NewWidget(tviewApp, settings)
|
||||
case "pagerduty":
|
||||
settings := pagerduty.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = pagerduty.NewWidget(app, settings)
|
||||
widget = pagerduty.NewWidget(tviewApp, settings)
|
||||
case "pihole":
|
||||
settings := pihole.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = pihole.NewWidget(app, pages, settings)
|
||||
widget = pihole.NewWidget(tviewApp, pages, settings)
|
||||
case "power":
|
||||
settings := power.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = power.NewWidget(app, settings)
|
||||
widget = power.NewWidget(tviewApp, settings)
|
||||
case "prettyweather":
|
||||
settings := prettyweather.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = prettyweather.NewWidget(app, settings)
|
||||
widget = prettyweather.NewWidget(tviewApp, settings)
|
||||
case "pocket":
|
||||
settings := pocket.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = pocket.NewWidget(app, pages, settings)
|
||||
widget = pocket.NewWidget(tviewApp, pages, settings)
|
||||
case "resourceusage":
|
||||
settings := resourceusage.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = resourceusage.NewWidget(app, settings)
|
||||
widget = resourceusage.NewWidget(tviewApp, settings)
|
||||
case "rollbar":
|
||||
settings := rollbar.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = rollbar.NewWidget(app, pages, settings)
|
||||
widget = rollbar.NewWidget(tviewApp, pages, settings)
|
||||
case "security":
|
||||
settings := security.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = security.NewWidget(app, settings)
|
||||
widget = security.NewWidget(tviewApp, settings)
|
||||
case "spacex":
|
||||
settings := spacex.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = spacex.NewWidget(app, settings)
|
||||
widget = spacex.NewWidget(tviewApp, settings)
|
||||
case "spotify":
|
||||
settings := spotify.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = spotify.NewWidget(app, pages, settings)
|
||||
widget = spotify.NewWidget(tviewApp, pages, settings)
|
||||
case "spotifyweb":
|
||||
settings := spotifyweb.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = spotifyweb.NewWidget(app, pages, settings)
|
||||
widget = spotifyweb.NewWidget(tviewApp, pages, settings)
|
||||
case "status":
|
||||
settings := status.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = status.NewWidget(app, settings)
|
||||
widget = status.NewWidget(tviewApp, settings)
|
||||
case "subreddit":
|
||||
settings := subreddit.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = subreddit.NewWidget(app, pages, settings)
|
||||
widget = subreddit.NewWidget(tviewApp, pages, settings)
|
||||
case "textfile":
|
||||
settings := textfile.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = textfile.NewWidget(app, pages, settings)
|
||||
widget = textfile.NewWidget(tviewApp, pages, settings)
|
||||
case "todo":
|
||||
settings := todo.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = todo.NewWidget(app, pages, settings)
|
||||
widget = todo.NewWidget(tviewApp, pages, settings)
|
||||
case "todo_plus":
|
||||
settings := todo_plus.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = todo_plus.NewWidget(app, pages, settings)
|
||||
widget = todo_plus.NewWidget(tviewApp, pages, settings)
|
||||
case "todoist":
|
||||
settings := todo_plus.FromTodoist(moduleName, moduleConfig, config)
|
||||
widget = todo_plus.NewWidget(app, pages, settings)
|
||||
widget = todo_plus.NewWidget(tviewApp, pages, settings)
|
||||
case "transmission":
|
||||
settings := transmission.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = transmission.NewWidget(app, pages, settings)
|
||||
widget = transmission.NewWidget(tviewApp, pages, settings)
|
||||
case "travisci":
|
||||
settings := travisci.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = travisci.NewWidget(app, pages, settings)
|
||||
widget = travisci.NewWidget(tviewApp, pages, settings)
|
||||
case "trello":
|
||||
settings := todo_plus.FromTrello(moduleName, moduleConfig, config)
|
||||
widget = todo_plus.NewWidget(app, pages, settings)
|
||||
widget = todo_plus.NewWidget(tviewApp, pages, settings)
|
||||
case "twitch":
|
||||
settings := twitch.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = twitch.NewWidget(app, pages, settings)
|
||||
widget = twitch.NewWidget(tviewApp, pages, settings)
|
||||
case "twitter":
|
||||
settings := twitter.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = twitter.NewWidget(app, pages, settings)
|
||||
widget = twitter.NewWidget(tviewApp, pages, settings)
|
||||
case "twitterstats":
|
||||
settings := twitterstats.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = twitterstats.NewWidget(app, pages, settings)
|
||||
widget = twitterstats.NewWidget(tviewApp, pages, settings)
|
||||
case "uptimerobot":
|
||||
settings := uptimerobot.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = uptimerobot.NewWidget(app, pages, settings)
|
||||
widget = uptimerobot.NewWidget(tviewApp, pages, settings)
|
||||
case "victorops":
|
||||
settings := victorops.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = victorops.NewWidget(app, settings)
|
||||
widget = victorops.NewWidget(tviewApp, settings)
|
||||
case "weather":
|
||||
settings := weather.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = weather.NewWidget(app, pages, settings)
|
||||
widget = weather.NewWidget(tviewApp, pages, settings)
|
||||
case "zendesk":
|
||||
settings := zendesk.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = zendesk.NewWidget(app, pages, settings)
|
||||
widget = zendesk.NewWidget(tviewApp, pages, settings)
|
||||
case "exchangerates":
|
||||
settings := exchangerates.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = exchangerates.NewWidget(app, pages, settings)
|
||||
widget = exchangerates.NewWidget(tviewApp, pages, settings)
|
||||
case "finnhub":
|
||||
settings := finnhub.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = finnhub.NewWidget(app, settings)
|
||||
widget = finnhub.NewWidget(tviewApp, settings)
|
||||
default:
|
||||
settings := unknown.NewSettingsFromYAML(moduleName, moduleConfig, config)
|
||||
widget = unknown.NewWidget(app, settings)
|
||||
widget = unknown.NewWidget(tviewApp, settings)
|
||||
}
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
// MakeWidgets creates and returns a collection of enabled widgets
|
||||
func MakeWidgets(app *tview.Application, pages *tview.Pages, config *config.Config) []wtf.Wtfable {
|
||||
func MakeWidgets(tviewApp *tview.Application, pages *tview.Pages, config *config.Config) []wtf.Wtfable {
|
||||
widgets := []wtf.Wtfable{}
|
||||
|
||||
moduleNames, _ := config.Map("wtf.mods")
|
||||
|
||||
for moduleName := range moduleNames {
|
||||
widget := MakeWidget(app, pages, moduleName, config)
|
||||
widget := MakeWidget(tviewApp, pages, moduleName, config)
|
||||
|
||||
if widget != nil {
|
||||
widgets = append(widgets, widget)
|
||||
|
@ -18,36 +18,34 @@ import (
|
||||
// WtfApp is the container for a collection of widgets that are all constructed from a single
|
||||
// configuration file and displayed together
|
||||
type WtfApp struct {
|
||||
app *tview.Application
|
||||
config *config.Config
|
||||
configFilePath string
|
||||
display *Display
|
||||
focusTracker FocusTracker
|
||||
ghUser *support.GitHubUser
|
||||
pages *tview.Pages
|
||||
tviewApp *tview.Application
|
||||
validator *ModuleValidator
|
||||
widgets []wtf.Wtfable
|
||||
}
|
||||
|
||||
// NewWtfApp creates and returns an instance of WtfApp
|
||||
func NewWtfApp(app *tview.Application, config *config.Config, configFilePath string) *WtfApp {
|
||||
func NewWtfApp(tviewApp *tview.Application, config *config.Config, configFilePath string) *WtfApp {
|
||||
wtfApp := WtfApp{
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
config: config,
|
||||
configFilePath: configFilePath,
|
||||
pages: tview.NewPages(),
|
||||
}
|
||||
|
||||
wtfApp.app.SetBeforeDrawFunc(func(s tcell.Screen) bool {
|
||||
wtfApp.tviewApp.SetBeforeDrawFunc(func(s tcell.Screen) bool {
|
||||
s.Clear()
|
||||
return false
|
||||
})
|
||||
|
||||
wtfApp.app.SetInputCapture(wtfApp.keyboardIntercept)
|
||||
|
||||
wtfApp.widgets = MakeWidgets(wtfApp.app, wtfApp.pages, wtfApp.config)
|
||||
wtfApp.widgets = MakeWidgets(wtfApp.tviewApp, wtfApp.pages, wtfApp.config)
|
||||
wtfApp.display = NewDisplay(wtfApp.widgets, wtfApp.config)
|
||||
wtfApp.focusTracker = NewFocusTracker(wtfApp.app, wtfApp.widgets, wtfApp.config)
|
||||
wtfApp.focusTracker = NewFocusTracker(wtfApp.tviewApp, wtfApp.widgets, wtfApp.config)
|
||||
|
||||
githubAPIKey := readGitHubAPIKey(wtfApp.config)
|
||||
wtfApp.ghUser = support.NewGitHubUser(githubAPIKey)
|
||||
@ -55,7 +53,6 @@ func NewWtfApp(app *tview.Application, config *config.Config, configFilePath str
|
||||
wtfApp.validator = NewModuleValidator()
|
||||
|
||||
wtfApp.pages.AddPage("grid", wtfApp.display.Grid, true, true)
|
||||
wtfApp.app.SetRoot(wtfApp.pages, true)
|
||||
|
||||
wtfApp.validator.Validate(wtfApp.widgets)
|
||||
|
||||
@ -66,6 +63,9 @@ func NewWtfApp(app *tview.Application, config *config.Config, configFilePath str
|
||||
),
|
||||
)
|
||||
|
||||
wtfApp.tviewApp.SetInputCapture(wtfApp.keyboardIntercept)
|
||||
wtfApp.tviewApp.SetRoot(wtfApp.pages, true)
|
||||
|
||||
return &wtfApp
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ func (wtfApp *WtfApp) keyboardIntercept(event *tcell.EventKey) *tcell.EventKey {
|
||||
switch event.Key() {
|
||||
case tcell.KeyCtrlC:
|
||||
wtfApp.Stop()
|
||||
wtfApp.app.Stop()
|
||||
wtfApp.tviewApp.Stop()
|
||||
wtfApp.DisplayExitMessage()
|
||||
case tcell.KeyCtrlR:
|
||||
wtfApp.refreshAllWidgets()
|
||||
@ -154,7 +154,7 @@ func (wtfApp *WtfApp) watchForConfigChanges() {
|
||||
wtfApp.Stop()
|
||||
|
||||
config := cfg.LoadWtfConfigFile(wtfApp.configFilePath)
|
||||
newApp := NewWtfApp(wtfApp.app, config, wtfApp.configFilePath)
|
||||
newApp := NewWtfApp(wtfApp.tviewApp, config, wtfApp.configFilePath)
|
||||
openURLUtil := utils.ToStrs(config.UList("wtf.openUrlUtil", []interface{}{}))
|
||||
utils.Init(config.UString("wtf.openFileUtil", "open"), openURLUtil)
|
||||
|
||||
|
@ -9,16 +9,14 @@ import (
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
// NewWidget creates and returns an instance of Widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, settings.common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, settings.common),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,9 @@ type Widget struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,9 @@ type Widget struct {
|
||||
items []Item
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,15 +17,15 @@ import (
|
||||
type Widget struct {
|
||||
view.BarGraph
|
||||
|
||||
app *tview.Application
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: view.NewBarGraph(app, "Sample Bar Graph", settings.Common),
|
||||
BarGraph: view.NewBarGraph(tviewApp, "Sample Bar Graph", settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
}
|
||||
|
||||
widget.View.SetWrap(true)
|
||||
@ -69,7 +69,7 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
widget.View.Clear()
|
||||
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
display(widget)
|
||||
})
|
||||
|
||||
|
@ -15,9 +15,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "workflow", "workflows"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
Client: NewClient(settings.apiKey),
|
||||
|
||||
settings: settings,
|
||||
|
@ -8,18 +8,18 @@ import (
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
// app *tview.Application
|
||||
clockColl ClockCollection
|
||||
dateFormat string
|
||||
timeFormat string
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
app: app,
|
||||
// app: app,
|
||||
settings: settings,
|
||||
dateFormat: settings.dateFormat,
|
||||
timeFormat: settings.timeFormat,
|
||||
@ -34,10 +34,8 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
|
||||
// Refresh updates the onscreen contents of the widget
|
||||
func (widget *Widget) Refresh() {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
sortedClocks := widget.clockColl.Sorted(widget.settings.sort)
|
||||
widget.display(sortedClocks, widget.dateFormat, widget.timeFormat)
|
||||
})
|
||||
sortedClocks := widget.clockColl.Sorted(widget.settings.sort)
|
||||
widget.display(sortedClocks, widget.dateFormat, widget.timeFormat)
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
@ -27,9 +27,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
buffer: &bytes.Buffer{},
|
||||
|
@ -29,9 +29,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
summaryList: summaryList{},
|
||||
|
@ -18,9 +18,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
device_token: settings.deviceToken,
|
||||
settings: settings,
|
||||
|
@ -20,9 +20,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
priceWidget: price.NewWidget(settings.priceSettings),
|
||||
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -9,16 +9,14 @@ import (
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
// NewWidget creates a new widget using settings
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,11 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
app: app,
|
||||
app: tviewApp,
|
||||
pages: pages,
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ type Widget struct {
|
||||
displayBuffer string
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -63,9 +63,9 @@ func getShowText(feedItem *FeedItem, showType ShowType) string {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
parser: gofeed.NewParser(),
|
||||
settings: settings,
|
||||
|
@ -17,10 +17,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget ..
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
Client: NewClient(settings.symbols, settings.apiKey),
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
var widget Widget
|
||||
|
||||
leagueId, err := getLeague(settings.league)
|
||||
@ -51,7 +51,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
}
|
||||
|
||||
widget = Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
Client: NewClient(settings.apiKey),
|
||||
League: leagueId,
|
||||
settings: settings,
|
||||
|
@ -8,17 +8,17 @@ import (
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
calEvents []*CalEvent
|
||||
settings *Settings
|
||||
err error
|
||||
settings *Settings
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ func (widget *Widget) Refresh() {
|
||||
return
|
||||
}
|
||||
|
||||
widget.app.Suspend(widget.authenticate)
|
||||
widget.tviewApp.Suspend(widget.authenticate)
|
||||
widget.Refresh()
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,9 @@ var (
|
||||
GerritURLPattern = regexp.MustCompile(`^(http|https)://(.*)$`)
|
||||
)
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
Idx: 0,
|
||||
|
||||
|
@ -23,17 +23,17 @@ type Widget struct {
|
||||
|
||||
GitRepos []*GitRepo
|
||||
|
||||
app *tview.Application
|
||||
pages *tview.Pages
|
||||
settings *Settings
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
pages: pages,
|
||||
settings: settings,
|
||||
}
|
||||
@ -55,7 +55,7 @@ func (widget *Widget) Checkout() {
|
||||
repoToCheckout := widget.GitRepos[widget.Idx]
|
||||
repoToCheckout.checkout(text)
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
widget.display()
|
||||
widget.Refresh()
|
||||
}
|
||||
@ -93,7 +93,7 @@ func (widget *Widget) addButtons(form *tview.Form, checkoutFctn func()) {
|
||||
func (widget *Widget) addCancelButton(form *tview.Form) {
|
||||
cancelFn := func() {
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
widget.display()
|
||||
}
|
||||
|
||||
@ -102,10 +102,10 @@ func (widget *Widget) addCancelButton(form *tview.Form) {
|
||||
}
|
||||
|
||||
func (widget *Widget) modalFocus(form *tview.Form) {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
frame := widget.modalFrame(form)
|
||||
widget.pages.AddPage("modal", frame, false, true)
|
||||
widget.app.SetFocus(frame)
|
||||
widget.tviewApp.SetFocus(frame)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
context, err := newContext(settings)
|
||||
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
context: context,
|
||||
settings: settings,
|
||||
|
@ -18,9 +18,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -20,9 +20,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
Client: NewClient(settings),
|
||||
Selected: -1,
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -36,9 +36,9 @@ type ipinfo struct {
|
||||
}
|
||||
|
||||
// NewWidget constructor
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ type ipinfo struct {
|
||||
Organization string `json:"org"`
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of the widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
objects: settings.objects,
|
||||
title: settings.title,
|
||||
|
@ -17,16 +17,14 @@ const (
|
||||
type Widget struct {
|
||||
view.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
filePath string
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
app: app,
|
||||
filePath: log.LogFilePath(),
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -18,19 +18,19 @@ type Widget struct {
|
||||
view.MultiSourceWidget
|
||||
view.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
Data []*MercurialRepo
|
||||
pages *tview.Pages
|
||||
settings *Settings
|
||||
tviewApp *tview.Application
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "repository", "repositories"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
pages: pages,
|
||||
settings: settings,
|
||||
}
|
||||
@ -52,7 +52,7 @@ func (widget *Widget) Checkout() {
|
||||
repoToCheckout := widget.Data[widget.Idx]
|
||||
repoToCheckout.checkout(text)
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
|
||||
widget.display()
|
||||
|
||||
@ -91,7 +91,7 @@ func (widget *Widget) addButtons(form *tview.Form, checkoutFctn func()) {
|
||||
func (widget *Widget) addCancelButton(form *tview.Form) {
|
||||
cancelFn := func() {
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
widget.display()
|
||||
}
|
||||
|
||||
@ -100,10 +100,10 @@ func (widget *Widget) addCancelButton(form *tview.Form) {
|
||||
}
|
||||
|
||||
func (widget *Widget) modalFocus(form *tview.Form) {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
frame := widget.modalFrame(form)
|
||||
widget.pages.AddPage("modal", frame, false, true)
|
||||
widget.app.SetFocus(frame)
|
||||
widget.tviewApp.SetFocus(frame)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -24,9 +24,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "applicationID", "applicationIDs"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates and returns an instance of PagerDuty widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -15,10 +15,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
//func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,9 @@ type Widget struct {
|
||||
archivedView bool
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, nil, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, nil, settings.Common),
|
||||
settings: settings,
|
||||
client: NewClient(settings.consumerKey, "http://localhost"),
|
||||
archivedView: false,
|
||||
|
@ -15,9 +15,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
Battery: NewBattery(),
|
||||
|
||||
|
@ -14,18 +14,17 @@ import (
|
||||
|
||||
// Widget define wtf widget to register widget later
|
||||
type Widget struct {
|
||||
view.BarGraph
|
||||
|
||||
app *tview.Application
|
||||
settings *Settings
|
||||
tviewApp *tview.Application
|
||||
view.BarGraph
|
||||
}
|
||||
|
||||
// NewWidget Make new instance of widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
BarGraph: view.NewBarGraph(app, settings.Name, settings.Common),
|
||||
BarGraph: view.NewBarGraph(tviewApp, settings.Name, settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
@ -131,7 +130,7 @@ func (widget *Widget) Refresh() {
|
||||
return
|
||||
}
|
||||
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
widget.View.Clear()
|
||||
display(widget)
|
||||
})
|
||||
|
@ -18,9 +18,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
return widget
|
||||
|
@ -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 {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
Info: spotigopher.Info{},
|
||||
client: spotigopher.NewClient(),
|
||||
|
@ -60,7 +60,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// NewWidget creates a new widget for WTF
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
redirectURI = "http://localhost:" + settings.callbackPort + "/callback"
|
||||
|
||||
auth = spotify.NewAuthenticator(redirectURI, spotify.ScopeUserReadCurrentlyPlaying, spotify.ScopeUserReadPlaybackState, spotify.ScopeUserModifyPlaybackState)
|
||||
@ -71,7 +71,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
var playerState *spotify.PlayerState
|
||||
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
Info: Info{},
|
||||
|
||||
|
@ -13,9 +13,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
CurrentIcon: 0,
|
||||
|
||||
|
@ -16,9 +16,9 @@ type Widget struct {
|
||||
links []Link
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ type Widget struct {
|
||||
systemInfo *SystemInfo
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, date, version string, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
Date: date,
|
||||
|
||||
|
@ -29,10 +29,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "filePath", "filePaths"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -22,21 +22,20 @@ const (
|
||||
|
||||
// A Widget represents a Todo widget
|
||||
type Widget struct {
|
||||
view.ScrollableWidget
|
||||
|
||||
app *tview.Application
|
||||
filePath string
|
||||
list checklist.Checklist
|
||||
pages *tview.Pages
|
||||
settings *Settings
|
||||
tviewApp *tview.Application
|
||||
view.ScrollableWidget
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
settings: settings,
|
||||
filePath: settings.filePath,
|
||||
list: checklist.NewChecklist(settings.Sigils.Checkbox.Checked, settings.Sigils.Checkbox.Unchecked),
|
||||
@ -117,15 +116,15 @@ func (widget *Widget) newItem() {
|
||||
widget.SetItemCount(len(widget.list.Items))
|
||||
widget.persist()
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
widget.display()
|
||||
}
|
||||
|
||||
widget.addButtons(form, saveFctn)
|
||||
widget.modalFocus(form)
|
||||
|
||||
widget.app.QueueUpdate(func() {
|
||||
widget.app.Draw()
|
||||
widget.tviewApp.QueueUpdate(func() {
|
||||
widget.tviewApp.Draw()
|
||||
})
|
||||
}
|
||||
|
||||
@ -166,15 +165,15 @@ func (widget *Widget) updateSelected() {
|
||||
widget.updateSelectedItem(text)
|
||||
widget.persist()
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
widget.display()
|
||||
}
|
||||
|
||||
widget.addButtons(form, saveFctn)
|
||||
widget.modalFocus(form)
|
||||
|
||||
widget.app.QueueUpdate(func() {
|
||||
widget.app.Draw()
|
||||
widget.tviewApp.QueueUpdate(func() {
|
||||
widget.tviewApp.Draw()
|
||||
})
|
||||
}
|
||||
|
||||
@ -198,7 +197,7 @@ func (widget *Widget) addButtons(form *tview.Form, saveFctn func()) {
|
||||
func (widget *Widget) addCancelButton(form *tview.Form) {
|
||||
cancelFn := func() {
|
||||
widget.pages.RemovePage("modal")
|
||||
widget.app.SetFocus(widget.View)
|
||||
widget.tviewApp.SetFocus(widget.View)
|
||||
widget.display()
|
||||
}
|
||||
|
||||
@ -211,10 +210,10 @@ func (widget *Widget) addSaveButton(form *tview.Form, fctn func()) {
|
||||
}
|
||||
|
||||
func (widget *Widget) modalFocus(form *tview.Form) {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
frame := widget.modalFrame(form)
|
||||
widget.pages.AddPage("modal", frame, false, true)
|
||||
widget.app.SetFocus(frame)
|
||||
widget.tviewApp.SetFocus(frame)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,10 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "project", "projects"),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ type Stream struct {
|
||||
Title string
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
settings: settings,
|
||||
twitch: NewClient(settings.clientId),
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "screenName", "screenNames"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
idx: 0,
|
||||
settings: settings,
|
||||
|
@ -14,9 +14,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
client: NewClient(settings),
|
||||
settings: settings,
|
||||
|
@ -13,9 +13,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ type Widget struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := &Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new widget
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,10 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
locationData, err := GetLocationData(settings.city)
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
location: locationData,
|
||||
lastError: err,
|
||||
|
@ -17,9 +17,9 @@ type Widget struct {
|
||||
settings *Settings
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
TextWidget: view.NewTextWidget(app, nil, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, nil, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ 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 {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.Common, "cityid", "cityids"),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.Common),
|
||||
TextWidget: view.NewTextWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
pages: pages,
|
||||
settings: settings,
|
||||
|
@ -18,9 +18,9 @@ type Widget struct {
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
func NewWidget(tviewApp *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
ScrollableWidget: view.NewScrollableWidget(tviewApp, pages, settings.Common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ type Bar struct {
|
||||
}
|
||||
|
||||
// NewBarGraph creates and returns an instance of BarGraph
|
||||
func NewBarGraph(app *tview.Application, name string, commonSettings *cfg.Common) BarGraph {
|
||||
func NewBarGraph(tviewApp *tview.Application, name string, commonSettings *cfg.Common) BarGraph {
|
||||
widget := BarGraph{
|
||||
Base: NewBase(app, commonSettings),
|
||||
KeyboardWidget: NewKeyboardWidget(app, nil, commonSettings),
|
||||
Base: NewBase(commonSettings),
|
||||
KeyboardWidget: NewKeyboardWidget(tviewApp, nil, commonSettings),
|
||||
|
||||
maxStars: commonSettings.Config.UInt("graphStars", 20),
|
||||
starChar: commonSettings.Config.UString("graphIcon", "|"),
|
||||
|
@ -4,32 +4,29 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/rivo/tview"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
type Base struct {
|
||||
app *tview.Application
|
||||
bordered bool
|
||||
commonSettings *cfg.Common
|
||||
enabled bool
|
||||
enabledMutex *sync.Mutex
|
||||
focusChar string
|
||||
focusable bool
|
||||
name string
|
||||
quitChan chan bool
|
||||
refreshing bool
|
||||
refreshInterval int
|
||||
enabledMutex *sync.Mutex
|
||||
refreshing bool
|
||||
}
|
||||
|
||||
// NewBase creates and returns an instance of the Base module, the lowest-level
|
||||
// primitive module from which all others are derived
|
||||
func NewBase(app *tview.Application, commonSettings *cfg.Common) *Base {
|
||||
func NewBase(commonSettings *cfg.Common) *Base {
|
||||
base := &Base{
|
||||
commonSettings: commonSettings,
|
||||
|
||||
app: app,
|
||||
bordered: commonSettings.Bordered,
|
||||
enabled: commonSettings.Enabled,
|
||||
enabledMutex: &sync.Mutex{},
|
||||
|
@ -19,10 +19,10 @@ type helpItem struct {
|
||||
|
||||
// KeyboardWidget manages keyboard control for a widget
|
||||
type KeyboardWidget struct {
|
||||
app *tview.Application
|
||||
pages *tview.Pages
|
||||
view *tview.TextView
|
||||
settings *cfg.Common
|
||||
tviewApp *tview.Application
|
||||
view *tview.TextView
|
||||
|
||||
charMap map[string]func()
|
||||
keyMap map[tcell.Key]func()
|
||||
@ -32,9 +32,9 @@ type KeyboardWidget struct {
|
||||
}
|
||||
|
||||
// NewKeyboardWidget creates and returns a new instance of KeyboardWidget
|
||||
func NewKeyboardWidget(app *tview.Application, pages *tview.Pages, settings *cfg.Common) *KeyboardWidget {
|
||||
func NewKeyboardWidget(tviewApp *tview.Application, pages *tview.Pages, settings *cfg.Common) *KeyboardWidget {
|
||||
keyWidget := &KeyboardWidget{
|
||||
app: app,
|
||||
tviewApp: tviewApp,
|
||||
pages: pages,
|
||||
settings: settings,
|
||||
charMap: make(map[string]func()),
|
||||
@ -168,16 +168,16 @@ func (widget *KeyboardWidget) ShowHelp() {
|
||||
|
||||
closeFunc := func() {
|
||||
widget.pages.RemovePage("help")
|
||||
widget.app.SetFocus(widget.view)
|
||||
widget.tviewApp.SetFocus(widget.view)
|
||||
}
|
||||
|
||||
modal := NewBillboardModal(widget.HelpText(), closeFunc)
|
||||
|
||||
widget.pages.AddPage("help", modal, false, true)
|
||||
widget.app.SetFocus(modal)
|
||||
widget.tviewApp.SetFocus(modal)
|
||||
|
||||
widget.app.QueueUpdate(func() {
|
||||
widget.app.Draw()
|
||||
widget.tviewApp.QueueUpdate(func() {
|
||||
widget.tviewApp.Draw()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@ type ScrollableWidget struct {
|
||||
RenderFunction func()
|
||||
}
|
||||
|
||||
func NewScrollableWidget(app *tview.Application, pages *tview.Pages, commonSettings *cfg.Common) ScrollableWidget {
|
||||
func NewScrollableWidget(tviewApp *tview.Application, pages *tview.Pages, commonSettings *cfg.Common) ScrollableWidget {
|
||||
widget := ScrollableWidget{
|
||||
TextWidget: NewTextWidget(app, pages, commonSettings),
|
||||
TextWidget: NewTextWidget(tviewApp, pages, commonSettings),
|
||||
}
|
||||
|
||||
widget.Unselect()
|
||||
@ -84,7 +84,7 @@ func (widget *ScrollableWidget) Unselect() {
|
||||
func (widget *ScrollableWidget) Redraw(data func() (string, string, bool)) {
|
||||
widget.TextWidget.Redraw(data)
|
||||
|
||||
widget.Base.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
widget.View.Highlight(strconv.Itoa(widget.Selected)).ScrollToHighlight()
|
||||
})
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ type TextWidget struct {
|
||||
}
|
||||
|
||||
// NewTextWidget creates and returns an instance of TextWidget
|
||||
func NewTextWidget(app *tview.Application, pages *tview.Pages, commonSettings *cfg.Common) TextWidget {
|
||||
func NewTextWidget(tviewApp *tview.Application, pages *tview.Pages, commonSettings *cfg.Common) TextWidget {
|
||||
widget := TextWidget{
|
||||
Base: NewBase(app, commonSettings),
|
||||
KeyboardWidget: NewKeyboardWidget(app, pages, commonSettings),
|
||||
Base: NewBase(commonSettings),
|
||||
KeyboardWidget: NewKeyboardWidget(tviewApp, pages, commonSettings),
|
||||
}
|
||||
|
||||
widget.View = widget.createView(widget.bordered)
|
||||
@ -39,7 +39,7 @@ func (widget *TextWidget) TextView() *tview.TextView {
|
||||
}
|
||||
|
||||
func (widget *TextWidget) Redraw(data func() (string, string, bool)) {
|
||||
widget.Base.app.QueueUpdateDraw(func() {
|
||||
widget.tviewApp.QueueUpdateDraw(func() {
|
||||
title, content, wrap := data()
|
||||
|
||||
widget.View.Clear()
|
||||
|
Loading…
x
Reference in New Issue
Block a user