mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Make every widget a keyboard widget
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
parent
2430fe9f56
commit
4a820dd0e5
@ -22,8 +22,8 @@ type WtfApp struct {
|
|||||||
config *config.Config
|
config *config.Config
|
||||||
configFilePath string
|
configFilePath string
|
||||||
display *Display
|
display *Display
|
||||||
ghUser *support.GitHubUser
|
|
||||||
focusTracker FocusTracker
|
focusTracker FocusTracker
|
||||||
|
ghUser *support.GitHubUser
|
||||||
pages *tview.Pages
|
pages *tview.Pages
|
||||||
validator *ModuleValidator
|
validator *ModuleValidator
|
||||||
widgets []wtf.Wtfable
|
widgets []wtf.Wtfable
|
||||||
|
@ -21,7 +21,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package buildkite
|
package buildkite
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,7 @@ import (
|
|||||||
"github.com/wtfutil/wtf/view"
|
"github.com/wtfutil/wtf/view"
|
||||||
)
|
)
|
||||||
|
|
||||||
const HelpText = `
|
|
||||||
Keyboard commands for Buildkite:
|
|
||||||
`
|
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
settings *Settings
|
settings *Settings
|
||||||
|
|
||||||
@ -22,13 +17,11 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
settings: settings,
|
||||||
settings: settings,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.View.SetScrollable(true)
|
widget.View.SetScrollable(true)
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next workflow")
|
widget.SetKeyboardChar("j", widget.Next, "Select next workflow")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous workflow")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous workflow")
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
// Widget define wtf widget to register widget later
|
// Widget define wtf widget to register widget later
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
workflows []sdk.Workflow
|
workflows []sdk.Workflow
|
||||||
@ -30,16 +29,14 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.Unselect()
|
widget.Unselect()
|
||||||
@ -110,11 +107,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpText displays the widgets controls
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) buildWorkflowsCollection() []sdk.Workflow {
|
func (widget *Widget) buildWorkflowsCollection() []sdk.Workflow {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next workflow")
|
widget.SetKeyboardChar("j", widget.Next, "Select next workflow")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous workflow")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous workflow")
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
// Widget define wtf widget to register widget later
|
// Widget define wtf widget to register widget later
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
filters []string
|
filters []string
|
||||||
@ -30,16 +29,14 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.Unselect()
|
widget.Unselect()
|
||||||
@ -111,11 +108,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpText displays the widgets controls
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) currentFilter() string {
|
func (widget *Widget) currentFilter() string {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next line")
|
widget.SetKeyboardChar("j", widget.Next, "Select next line")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous line")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous line")
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
// Widget define wtf widget to register widget later
|
// Widget define wtf widget to register widget later
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
filters []string
|
filters []string
|
||||||
@ -30,16 +29,14 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "workflow", "workflows"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.Unselect()
|
widget.Unselect()
|
||||||
@ -111,11 +108,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpText displays the widgets controls
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) openWorkflow() {
|
func (widget *Widget) openWorkflow() {
|
||||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
Client: NewClient(settings.apiKey),
|
Client: NewClient(settings.apiKey),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -29,7 +29,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
buffer: &bytes.Buffer{},
|
buffer: &bytes.Buffer{},
|
||||||
|
@ -31,7 +31,7 @@ type Widget struct {
|
|||||||
// NewWidget Make new instance of widget
|
// NewWidget Make new instance of widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
summaryList: summaryList{},
|
summaryList: summaryList{},
|
||||||
|
@ -20,7 +20,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
device_token: settings.deviceToken,
|
device_token: settings.deviceToken,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -22,7 +22,7 @@ type Widget struct {
|
|||||||
// NewWidget Make new instance of widget
|
// NewWidget Make new instance of widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
priceWidget: price.NewWidget(settings.priceSettings),
|
priceWidget: price.NewWidget(settings.priceSettings),
|
||||||
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
toplistWidget: toplist.NewWidget(settings.toplistSettings),
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
monitors []datadog.Monitor
|
monitors []datadog.Monitor
|
||||||
@ -20,15 +19,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
@ -66,10 +63,6 @@ func (widget *Widget) Render() {
|
|||||||
widget.Redraw(widget.content)
|
widget.Redraw(widget.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
|
@ -3,7 +3,7 @@ package devto
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("d", widget.Next, "Select next item")
|
widget.SetKeyboardChar("d", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("a", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("a", widget.Prev, "Select previous item")
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
articles []devto.ListedArticle
|
articles []devto.ListedArticle
|
||||||
settings *Settings
|
settings *Settings
|
||||||
err error
|
err error
|
||||||
@ -21,8 +21,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -30,7 +29,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.View.SetScrollable(true)
|
widget.View.SetScrollable(true)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new widget using settings
|
// NewWidget creates a new widget using settings
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -3,7 +3,7 @@ package digitalocean
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("?", widget.showInfo, "Show info about the selected droplet")
|
widget.SetKeyboardChar("?", widget.showInfo, "Show info about the selected droplet")
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ func (t *tokenSource) Token() (*oauth2.Token, error) {
|
|||||||
|
|
||||||
// Widget is the container for droplet data
|
// Widget is the container for droplet data
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
app *tview.Application
|
app *tview.Application
|
||||||
@ -45,8 +44,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
pages: pages,
|
pages: pages,
|
||||||
@ -54,7 +52,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.View.SetScrollable(true)
|
widget.View.SetScrollable(true)
|
||||||
|
|
||||||
@ -79,11 +76,6 @@ func (widget *Widget) Fetch() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpText returns the help text for this widget
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next selects the next item in the list
|
// Next selects the next item in the list
|
||||||
func (widget *Widget) Next() {
|
func (widget *Widget) Next() {
|
||||||
widget.ScrollableWidget.Next()
|
widget.ScrollableWidget.Next()
|
||||||
|
@ -18,7 +18,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package feedreader
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -28,7 +28,6 @@ type FeedItem struct {
|
|||||||
|
|
||||||
// Widget is the container for RSS and Atom data
|
// Widget is the container for RSS and Atom data
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
stories []*FeedItem
|
stories []*FeedItem
|
||||||
@ -66,8 +65,7 @@ func getShowText(feedItem *FeedItem, showType ShowType) string {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
parser: gofeed.NewParser(),
|
parser: gofeed.NewParser(),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
@ -76,7 +74,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ type Widget struct {
|
|||||||
// NewWidget ..
|
// NewWidget ..
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
|
||||||
Client: NewClient(settings.symbols, settings.apiKey),
|
Client: NewClient(settings.symbols, settings.apiKey),
|
||||||
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
var widget Widget
|
var widget Widget
|
||||||
|
|
||||||
leagueId, err := getLeague(settings.league)
|
leagueId, err := getLeague(settings.league)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
widget = Widget{
|
widget = Widget{
|
||||||
@ -45,14 +46,17 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
Client: NewClient(settings.apiKey),
|
Client: NewClient(settings.apiKey),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &widget
|
return &widget
|
||||||
}
|
}
|
||||||
|
|
||||||
widget = Widget{
|
widget = Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
Client: NewClient(settings.apiKey),
|
Client: NewClient(settings.apiKey),
|
||||||
League: leagueId,
|
League: leagueId,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &widget
|
return &widget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("h", widget.prevProject, "Select previous project")
|
widget.SetKeyboardChar("h", widget.prevProject, "Select previous project")
|
||||||
widget.SetKeyboardChar("l", widget.nextProject, "Select next project")
|
widget.SetKeyboardChar("l", widget.nextProject, "Select next project")
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
gerrit *glb.Client
|
gerrit *glb.Client
|
||||||
@ -32,8 +31,7 @@ var (
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
|
||||||
|
|
||||||
Idx: 0,
|
Idx: 0,
|
||||||
|
|
||||||
@ -41,7 +39,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
@ -92,10 +89,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) nextProject() {
|
func (widget *Widget) nextProject() {
|
||||||
|
@ -3,7 +3,7 @@ package git
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
||||||
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
||||||
|
@ -36,7 +36,3 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
func (widget *Widget) ConfigText() string {
|
func (widget *Widget) ConfigText() string {
|
||||||
return utils.HelpFromInterface(Settings{})
|
return utils.HelpFromInterface(Settings{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
@ -18,7 +18,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
@ -31,9 +30,8 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
pages: pages,
|
pages: pages,
|
||||||
@ -41,7 +39,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
// Widget define wtf widget to register widget later
|
// Widget define wtf widget to register widget later
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
GithubRepos []*Repo
|
GithubRepos []*Repo
|
||||||
@ -26,9 +25,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -37,7 +35,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.Unselect()
|
widget.Unselect()
|
||||||
@ -103,11 +100,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpText displays the widgets controls
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) buildRepoCollection(repoData []string) []*Repo {
|
func (widget *Widget) buildRepoCollection(repoData []string) []*Repo {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -15,7 +15,6 @@ type ContentItem struct {
|
|||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
GitlabProjects []*GitlabProject
|
GitlabProjects []*GitlabProject
|
||||||
@ -34,9 +33,8 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
context, err := newContext(settings)
|
context, err := newContext(settings)
|
||||||
|
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
context: context,
|
context: context,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
@ -48,7 +46,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.Unselect()
|
widget.Unselect()
|
||||||
@ -73,10 +70,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetItemCount sets the amount of PRs RRs and other PRs throughout the widgets display creation
|
// SetItemCount sets the amount of PRs RRs and other PRs throughout the widgets display creation
|
||||||
func (widget *Widget) SetItemCount(items int) {
|
func (widget *Widget) SetItemCount(items int) {
|
||||||
widget.maxItems = items
|
widget.maxItems = items
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
todos []*gitlab.Todo
|
todos []*gitlab.Todo
|
||||||
@ -21,8 +20,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -31,7 +29,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package gitter
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
// A Widget represents a Gitter widget
|
// A Widget represents a Gitter widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
messages []Message
|
messages []Message
|
||||||
@ -20,15 +19,13 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Refresh)
|
widget.SetRenderFunction(widget.Refresh)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
@ -65,10 +62,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) display() {
|
func (widget *Widget) display() {
|
||||||
|
@ -13,7 +13,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
Client *Client
|
Client *Client
|
||||||
@ -23,8 +22,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
|
||||||
|
|
||||||
Client: NewClient(settings),
|
Client: NewClient(settings),
|
||||||
Selected: -1,
|
Selected: -1,
|
||||||
@ -34,7 +32,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
@ -91,10 +88,6 @@ func (widget *Widget) Unselect() {
|
|||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (widget *Widget) openAlert() {
|
func (widget *Widget) openAlert() {
|
||||||
currentSelection := widget.View.GetHighlights()
|
currentSelection := widget.View.GetHighlights()
|
||||||
if widget.Selected >= 0 && currentSelection[0] != "" {
|
if widget.Selected >= 0 && currentSelection[0] != "" {
|
||||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package hackernews
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
stories []Story
|
stories []Story
|
||||||
@ -21,15 +20,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ type ipinfo struct {
|
|||||||
// NewWidget constructor
|
// NewWidget constructor
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ type ipinfo struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package jenkins
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
settings *Settings
|
settings *Settings
|
||||||
@ -20,15 +19,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
result *SearchResult
|
result *SearchResult
|
||||||
@ -19,15 +18,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of the widget
|
// NewWidget creates a new instance of the widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
objects: settings.objects,
|
objects: settings.objects,
|
||||||
title: settings.title,
|
title: settings.title,
|
||||||
|
@ -24,7 +24,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
filePath: log.LogFilePath(),
|
filePath: log.LogFilePath(),
|
||||||
|
@ -3,7 +3,7 @@ package mercurial
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
||||||
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
||||||
|
@ -15,7 +15,6 @@ const (
|
|||||||
|
|
||||||
// A Widget represents a Mercurial widget
|
// A Widget represents a Mercurial widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
@ -28,9 +27,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
pages: pages,
|
pages: pages,
|
||||||
@ -40,7 +38,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
@ -82,10 +79,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) addCheckoutButton(form *tview.Form, fctn func()) {
|
func (widget *Widget) addCheckoutButton(form *tview.Form, fctn func()) {
|
||||||
|
@ -3,7 +3,7 @@ package nbascore
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("l", widget.next, "Select next item")
|
widget.SetKeyboardChar("l", widget.next, "Select next item")
|
||||||
widget.SetKeyboardChar("h", widget.prev, "Select previous item")
|
widget.SetKeyboardChar("h", widget.prev, "Select previous item")
|
||||||
|
@ -17,7 +17,6 @@ var offset = 0
|
|||||||
|
|
||||||
// A Widget represents an NBA Score widget
|
// A Widget represents an NBA Score widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
language string
|
language string
|
||||||
@ -27,14 +26,12 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.View.SetScrollable(true)
|
widget.View.SetScrollable(true)
|
||||||
|
|
||||||
@ -47,10 +44,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(widget.nbascore)
|
widget.Redraw(widget.nbascore)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (widget *Widget) nbascore() (string, string, bool) {
|
func (widget *Widget) nbascore() (string, string, bool) {
|
||||||
title := widget.CommonSettings().Title
|
title := widget.CommonSettings().Title
|
||||||
cur := time.Now().AddDate(0, 0, offset) // Go back/forward offset days
|
cur := time.Now().AddDate(0, 0, offset) // Go back/forward offset days
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
@ -20,15 +19,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "applicationID", "applicationIDs"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "applicationID", "applicationIDs"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
for _, id := range utils.ToInts(widget.settings.applicationIDs) {
|
for _, id := range utils.ToInts(widget.settings.applicationIDs) {
|
||||||
widget.Clients = append(widget.Clients, NewClient(widget.settings.apiKey, id))
|
widget.Clients = append(widget.Clients, NewClient(widget.settings.apiKey, id))
|
||||||
@ -53,10 +50,6 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) currentData() *Client2 {
|
func (widget *Widget) currentData() *Client2 {
|
||||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ type Widget struct {
|
|||||||
// NewWidget creates and returns an instance of PagerDuty widget
|
// NewWidget creates and returns an instance of PagerDuty widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package pihole
|
package pihole
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("d", widget.disable, "disable Pi-hole")
|
widget.SetKeyboardChar("d", widget.disable, "disable Pi-hole")
|
||||||
widget.SetKeyboardChar("e", widget.enable, "enable Pi-hole")
|
widget.SetKeyboardChar("e", widget.enable, "enable Pi-hole")
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
@ -19,13 +18,11 @@ type Widget struct {
|
|||||||
//func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
//func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
settings: settings,
|
||||||
settings: settings,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.settings.common.RefreshInterval = 30
|
widget.settings.common.RefreshInterval = 30
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.SetDisplayFunction(widget.Refresh)
|
widget.SetDisplayFunction(widget.Refresh)
|
||||||
widget.View.SetWordWrap(true)
|
widget.View.SetWordWrap(true)
|
||||||
@ -46,10 +43,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(widget.content)
|
widget.Redraw(widget.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
|
@ -3,8 +3,8 @@ package pocket
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
|
||||||
widget.SetKeyboardChar("a", widget.toggleLink, "Toggle Link")
|
widget.SetKeyboardChar("a", widget.toggleLink, "Toggle Link")
|
||||||
widget.SetKeyboardChar("t", widget.toggleView, "Toggle view (links ,archived links)")
|
widget.SetKeyboardChar("t", widget.toggleView, "Toggle view (links ,archived links)")
|
||||||
widget.SetKeyboardKey(tcell.KeyDown, widget.Next, "Select Next Link")
|
widget.SetKeyboardKey(tcell.KeyDown, widget.Next, "Select Next Link")
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
view.KeyboardWidget
|
|
||||||
|
|
||||||
settings *Settings
|
settings *Settings
|
||||||
client *Client
|
client *Client
|
||||||
@ -24,15 +23,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, nil, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
client: NewClient(settings.consumerKey, "http://localhost"),
|
client: NewClient(settings.consumerKey, "http://localhost"),
|
||||||
archivedView: false,
|
archivedView: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.CommonSettings()
|
widget.CommonSettings()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.View.SetScrollable(true)
|
widget.View.SetScrollable(true)
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
Battery: NewBattery(),
|
Battery: NewBattery(),
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package rollbar
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
// A Widget represents a Rollbar widget
|
// A Widget represents a Rollbar widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
items *Result
|
items *Result
|
||||||
@ -21,15 +20,13 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
return widget
|
return widget
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("l", widget.next, "Select next item")
|
widget.SetKeyboardChar("l", widget.next, "Select next item")
|
||||||
widget.SetKeyboardChar("h", widget.previous, "Select previous item")
|
widget.SetKeyboardChar("h", widget.previous, "Select previous item")
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
// A Widget represents a Spotify widget
|
// A Widget represents a Spotify widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
client spotigopher.SpotifyClient
|
client spotigopher.SpotifyClient
|
||||||
@ -22,8 +21,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
|
||||||
|
|
||||||
Info: spotigopher.Info{},
|
Info: spotigopher.Info{},
|
||||||
client: spotigopher.NewClient(),
|
client: spotigopher.NewClient(),
|
||||||
@ -34,7 +32,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
widget.settings.common.RefreshInterval = 5
|
widget.settings.common.RefreshInterval = 5
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
widget.View.SetWordWrap(true)
|
widget.View.SetWordWrap(true)
|
||||||
@ -54,10 +51,6 @@ func (w *Widget) Refresh() {
|
|||||||
w.Redraw(w.createOutput)
|
w.Redraw(w.createOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *Widget) createOutput() (string, string, bool) {
|
func (w *Widget) createOutput() (string, string, bool) {
|
||||||
var content string
|
var content string
|
||||||
err := w.refreshSpotifyInfos()
|
err := w.refreshSpotifyInfos()
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("h", widget.selectPrevious, "Select previous item")
|
widget.SetKeyboardChar("h", widget.selectPrevious, "Select previous item")
|
||||||
widget.SetKeyboardChar("l", widget.selectNext, "Select next item")
|
widget.SetKeyboardChar("l", widget.selectNext, "Select next item")
|
||||||
|
@ -32,7 +32,6 @@ type Info struct {
|
|||||||
|
|
||||||
// Widget is the struct used by all WTF widgets to transfer to the main widget controller
|
// Widget is the struct used by all WTF widgets to transfer to the main widget controller
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
Info
|
Info
|
||||||
@ -72,8 +71,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
var playerState *spotify.PlayerState
|
var playerState *spotify.PlayerState
|
||||||
|
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
|
||||||
|
|
||||||
Info: Info{},
|
Info: Info{},
|
||||||
|
|
||||||
@ -124,7 +122,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
widget.settings.common.RefreshInterval = 5
|
widget.settings.common.RefreshInterval = 5
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
widget.View.SetWordWrap(true)
|
widget.View.SetWordWrap(true)
|
||||||
@ -165,10 +162,6 @@ func (w *Widget) Refresh() {
|
|||||||
w.Redraw(w.createOutput)
|
w.Redraw(w.createOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *Widget) createOutput() (string, string, bool) {
|
func (w *Widget) createOutput() (string, string, bool) {
|
||||||
var output string
|
var output string
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
CurrentIcon: 0,
|
CurrentIcon: 0,
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package subreddit
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
settings *Settings
|
settings *Settings
|
||||||
@ -19,15 +18,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, date, version string, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
Date: date,
|
Date: date,
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(nil)
|
widget.InitializeRefreshKeyboardControl(nil)
|
||||||
|
|
||||||
widget.SetKeyboardChar("l", widget.NextSource, "Select next file")
|
widget.SetKeyboardChar("l", widget.NextSource, "Select next file")
|
||||||
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous file")
|
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous file")
|
||||||
|
@ -22,7 +22,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
@ -32,9 +31,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "filePath", "filePaths"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "filePath", "filePaths"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -43,7 +41,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
widget.settings.common.RefreshInterval = 0
|
widget.settings.common.RefreshInterval = 0
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.SetDisplayFunction(widget.Refresh)
|
widget.SetDisplayFunction(widget.Refresh)
|
||||||
widget.View.SetWordWrap(true)
|
widget.View.SetWordWrap(true)
|
||||||
@ -64,10 +61,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(widget.content)
|
widget.Redraw(widget.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -22,7 +22,6 @@ const (
|
|||||||
|
|
||||||
// A Widget represents a Todo widget
|
// A Widget represents a Todo widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
app *tview.Application
|
app *tview.Application
|
||||||
@ -35,8 +34,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
app: app,
|
app: app,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
@ -48,7 +46,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
widget.init()
|
widget.init()
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.View.SetRegions(true)
|
widget.View.SetRegions(true)
|
||||||
widget.View.SetScrollable(true)
|
widget.View.SetScrollable(true)
|
||||||
@ -61,11 +58,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
|
|
||||||
// HelpText returns the help text for this widget
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SelectedItem returns the currently-selected checklist item or nil if no item is selected
|
// SelectedItem returns the currently-selected checklist item or nil if no item is selected
|
||||||
func (widget *Widget) SelectedItem() *checklist.ChecklistItem {
|
func (widget *Widget) SelectedItem() *checklist.ChecklistItem {
|
||||||
var selectedItem *checklist.ChecklistItem
|
var selectedItem *checklist.ChecklistItem
|
||||||
|
@ -3,7 +3,7 @@ package todo_plus
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("d", widget.Delete, "Delete item")
|
widget.SetKeyboardChar("d", widget.Delete, "Delete item")
|
||||||
widget.SetKeyboardChar("j", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("j", widget.Prev, "Select previous item")
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
// A Widget represents a Todoist widget
|
// A Widget represents a Todoist widget
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
@ -22,9 +21,8 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "project", "projects"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "project", "projects"),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
@ -35,7 +33,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
|||||||
|
|
||||||
widget.SetRenderFunction(widget.display)
|
widget.SetRenderFunction(widget.display)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.SetDisplayFunction(widget.display)
|
widget.SetDisplayFunction(widget.display)
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
@ -83,10 +80,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (widget *Widget) NextSource() {
|
func (widget *Widget) NextSource() {
|
||||||
widget.MultiSourceWidget.NextSource()
|
widget.MultiSourceWidget.NextSource()
|
||||||
widget.Selected = widget.CurrentProject().Index
|
widget.Selected = widget.CurrentProject().Index
|
||||||
|
@ -3,7 +3,7 @@ package transmission
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(nil)
|
widget.InitializeRefreshKeyboardControl(nil)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("j", widget.Prev, "Select previous item")
|
||||||
widget.SetKeyboardChar("k", widget.Next, "Select next item")
|
widget.SetKeyboardChar("k", widget.Next, "Select next item")
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
// Widget is the container for transmission data
|
// Widget is the container for transmission data
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
client *transmissionrpc.Client
|
client *transmissionrpc.Client
|
||||||
@ -24,15 +23,13 @@ type Widget struct {
|
|||||||
// NewWidget creates a new instance of a widget
|
// NewWidget creates a new instance of a widget
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.display)
|
widget.SetRenderFunction(widget.display)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
@ -88,11 +85,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.display()
|
widget.display()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HelpText returns the help text for this widget
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next selects the next item in the list
|
// Next selects the next item in the list
|
||||||
func (widget *Widget) Next() {
|
func (widget *Widget) Next() {
|
||||||
widget.ScrollableWidget.Next()
|
widget.ScrollableWidget.Next()
|
||||||
|
@ -3,7 +3,7 @@ package travisci
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
builds *Builds
|
builds *Builds
|
||||||
@ -20,15 +19,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package twitch
|
|||||||
import "github.com/gdamore/tcell"
|
import "github.com/gdamore/tcell"
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
settings *Settings
|
settings *Settings
|
||||||
@ -30,15 +29,13 @@ type Stream struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
twitch: NewClient(settings.clientId),
|
twitch: NewClient(settings.clientId),
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
return widget
|
return widget
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (widget *Widget) initializeKeyboardControls() {
|
func (widget *Widget) initializeKeyboardControls() {
|
||||||
widget.InitializeCommonControls(widget.Refresh)
|
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||||
|
|
||||||
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
widget.SetKeyboardChar("l", widget.NextSource, "Select next source")
|
||||||
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
widget.SetKeyboardChar("h", widget.PrevSource, "Select previous source")
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.MultiSourceWidget
|
view.MultiSourceWidget
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
@ -23,16 +22,14 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
|
||||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "screenName", "screenNames"),
|
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "screenName", "screenNames"),
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||||
|
|
||||||
idx: 0,
|
idx: 0,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.SetDisplayFunction(widget.Refresh)
|
widget.SetDisplayFunction(widget.Refresh)
|
||||||
|
|
||||||
@ -54,10 +51,6 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Redraw(widget.content)
|
widget.Redraw(widget.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) HelpText() string {
|
|
||||||
return widget.KeyboardWidget.HelpText()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
|
@ -16,7 +16,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
client: NewClient(settings),
|
client: NewClient(settings),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
|
@ -15,7 +15,7 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.KeyboardWidget
|
|
||||||
view.ScrollableWidget
|
view.ScrollableWidget
|
||||||
|
|
||||||
monitors []Monitor
|
monitors []Monitor
|
||||||
@ -24,15 +23,13 @@ type Widget struct {
|
|||||||
|
|
||||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||||
widget := &Widget{
|
widget := &Widget{
|
||||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
|
||||||
|
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetRenderFunction(widget.Render)
|
widget.SetRenderFunction(widget.Render)
|
||||||
widget.initializeKeyboardControls()
|
widget.initializeKeyboardControls()
|
||||||
widget.View.SetInputCapture(widget.InputCapture)
|
|
||||||
|
|
||||||
widget.KeyboardWidget.SetView(widget.View)
|
widget.KeyboardWidget.SetView(widget.View)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ type Widget struct {
|
|||||||
// NewWidget creates a new widget
|
// NewWidget creates a new widget
|
||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
view.TextWidget
|
view.TextWidget
|
||||||
|
|
||||||
location *location
|
location *location
|
||||||
lastError error
|
lastError error
|
||||||
settings *Settings
|
settings *Settings
|
||||||
@ -17,10 +18,11 @@ type Widget struct {
|
|||||||
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
locationData, err := GetLocationData(settings.city)
|
locationData, err := GetLocationData(settings.city)
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: view.NewTextWidget(app, settings.common),
|
TextWidget: view.NewTextWidget(app, nil, settings.common),
|
||||||
location: locationData,
|
|
||||||
lastError: err,
|
location: locationData,
|
||||||
settings: settings,
|
lastError: err,
|
||||||
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.View.SetWrap(true)
|
widget.View.SetWrap(true)
|
||||||
@ -42,7 +44,6 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
|
|
||||||
widget.Redraw(widget.content)
|
widget.Redraw(widget.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user