tui

package
v0.1.0-test.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MenuTitle    = fmt.Sprintf("Menu [ %s ]", tcell.KeyNames[KeyMapping[KeyMenuOp]])
	PreviewTitle = fmt.Sprintf("Preview [ %s ]", tcell.KeyNames[KeyMapping[KeyPreviewOp]])

	// TitleFooterView is the title for Footer view.
	FooterText = "Navigate: Arrow keys [Up, Down, Right, Left] · Preview specific: Return [ Enter ] · Exit [ Ctrl-C ]"
)
View Source
var (
	KeyMapping = map[KeyOp]tcell.Key{
		KeyMenuOp:    tcell.KeyCtrlA,
		KeyPreviewOp: tcell.KeyCtrlD,
	}
)

Functions

This section is empty.

Types

type KeyOp

type KeyOp int16

KeyOp defines digo-tui specific hotkey operations.

const (

	// KeyMenuOp is the operation corresponding to the activation of the Menu view.
	KeyMenuOp KeyOp = iota
	// KeyPreviewOp is the operation corresponding to the activation of the Preview table.
	KeyPreviewOp
)

type TUI

type TUI struct {
	Client *client.DiscogsClient
	Config *configs.AppConfig

	App        *tview.Application
	Pages      *tview.Pages
	Grid       *tview.Grid
	Navigation *tview.List
	Footer     *tview.TextView

	Preview         *tview.Grid
	CollectionPrims []*tview.Flex
	WishlistPrims   []*tview.Flex
	OrderPrims      []*tview.Flex

	SelectedSource  client.DataSource
	PreviewPosition [2]int
	LastUpdated     time.Time
}

func New

func New(c *client.DiscogsClient, config *configs.AppConfig) *TUI

New creates a new TUI instance.

func (*TUI) DrawPreviewGrid

func (t *TUI) DrawPreviewGrid()

func (*TUI) LoadData

func (t *TUI) LoadData() error

LoadData maintains backward compatibility but with timeout

func (*TUI) LoadDataWithContext

func (t *TUI) LoadDataWithContext(ctx context.Context) error

LoadDataWithContext loads the data from all sources with context support

func (*TUI) Start

func (t *TUI) Start() error

Start starts terminal user interface application.

func (*TUI) StartWithContext

func (t *TUI) StartWithContext(ctx context.Context) error

StartWithContext starts the TUI with context support

func (*TUI) Stop

func (t *TUI) Stop()

Stop stops terminal user interface application.

Jump to

Keyboard shortcuts

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