app

package
v0.43.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2023 License: MPL-2.0 Imports: 101 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeWidget added in v0.20.0

func MakeWidget(
	tviewApp *tview.Application,
	pages *tview.Pages,
	moduleName string,
	config *config.Config,
	redrawChan chan bool,
) wtf.Wtfable

MakeWidget creates and returns instances of widgets

func MakeWidgets added in v0.20.0

func MakeWidgets(tviewApp *tview.Application, pages *tview.Pages, config *config.Config, redrawChan chan bool) []wtf.Wtfable

MakeWidgets creates and returns a collection of enabled widgets

func Schedule

func Schedule(widget wtf.Wtfable)

Schedule kicks off the first refresh of a module's data and then queues the rest of the data refreshes on a timer

Types

type Display

type Display struct {
	Grid *tview.Grid
	// contains filtered or unexported fields
}

Display is the container for the onscreen representation of a WtfApp

func NewDisplay

func NewDisplay(widgets []wtf.Wtfable, config *config.Config) *Display

NewDisplay creates and returns a Display

type FocusState

type FocusState int

FocusState is a custom type that differentiates focusable scopes

type FocusTracker

type FocusTracker struct {
	Idx       int
	IsFocused bool
	Widgets   []wtf.Wtfable
	// contains filtered or unexported fields
}

FocusTracker is used by the app to track which onscreen widget currently has focus, and to move focus between widgets.

func NewFocusTracker

func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker

NewFocusTracker creates and returns an instance of FocusTracker

func (*FocusTracker) FocusOn

func (tracker *FocusTracker) FocusOn(char string) bool

FocusOn puts the focus on the item that belongs to the focus character passed in

func (*FocusTracker) Next

func (tracker *FocusTracker) Next()

Next sets the focus on the next widget in the widget list. If the current widget is the last widget, sets focus on the first widget.

func (*FocusTracker) None

func (tracker *FocusTracker) None()

None removes focus from the currently-focused widget.

func (*FocusTracker) Prev

func (tracker *FocusTracker) Prev()

Prev sets the focus on the previous widget in the widget list. If the current widget is the last widget, sets focus on the last widget.

func (*FocusTracker) Refocus

func (tracker *FocusTracker) Refocus()

Refocus forces the focus back to the currently-selected item

type ModuleValidator

type ModuleValidator struct{}

ModuleValidator is responsible for validating the state of a module's configuration

func NewModuleValidator

func NewModuleValidator() *ModuleValidator

NewModuleValidator creates and returns an instance of ModuleValidator

func (*ModuleValidator) Validate

func (val *ModuleValidator) Validate(widgets []wtf.Wtfable)

Validate rolls through all the enabled widgets and looks for configuration errors. If it finds any it stringifies them, writes them to the console, and kills the app gracefully

type WtfApp

type WtfApp struct {
	TViewApp *tview.Application
	// contains filtered or unexported fields
}

WtfApp is the container for a collection of widgets that are all constructed from a single configuration file and displayed together

func NewWtfApp

func NewWtfApp(tviewApp *tview.Application, config *config.Config, configFilePath string) *WtfApp

NewWtfApp creates and returns an instance of WtfApp

func (*WtfApp) DisplayExitMessage added in v0.33.0

func (wtfApp *WtfApp) DisplayExitMessage()

DisplayExitMessage displays the onscreen exit message when the app quits

func (*WtfApp) Execute added in v0.42.0

func (wtfApp *WtfApp) Execute() error

Execute starts the underlying tview app

func (*WtfApp) Exit added in v0.42.0

func (wtfApp *WtfApp) Exit()

Exit quits the app

func (*WtfApp) Start

func (wtfApp *WtfApp) Start()

Start initializes the app

func (*WtfApp) Stop

func (wtfApp *WtfApp) Stop()

Stop kills all the currently-running widgets in this app

type WtfAppManager added in v0.35.0

type WtfAppManager struct {
	WtfApps []*WtfApp
	// contains filtered or unexported fields
}

WtfAppManager handles the instances of WtfApp, ensuring that they're displayed as requested

func NewAppManager added in v0.35.0

func NewAppManager() WtfAppManager

NewAppManager creates and returns an instance of AppManager

func (*WtfAppManager) Add added in v0.35.0

func (appMan *WtfAppManager) Add(wtfApp *WtfApp)

Add adds a WtfApp to the collection of apps that the AppManager manages. This app is then available for display onscreen.

func (*WtfAppManager) Current added in v0.35.0

func (appMan *WtfAppManager) Current() (*WtfApp, error)

Current returns the currently-displaying instance of WtfApp

func (*WtfAppManager) MakeNewWtfApp added in v0.35.0

func (appMan *WtfAppManager) MakeNewWtfApp(config *config.Config, configFilePath string)

MakeNewWtfApp creates and starts a new instance of WtfApp from a set of configuration params

func (*WtfAppManager) Next added in v0.35.0

func (appMan *WtfAppManager) Next() (*WtfApp, error)

Next cycles the WtfApps forward by one, making the next one in the list the current one. If there are none after the current one, it wraps around.

func (*WtfAppManager) Prev added in v0.35.0

func (appMan *WtfAppManager) Prev() (*WtfApp, error)

Prev cycles the WtfApps backwards by one, making the previous one in the list the current one. If there are none before the current one, it wraps around.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL