tui

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger() logrus.StdLogger

NewLogger returns a new well configured logger.

Types

type Item

type Item struct {
	ID string
	// contains filtered or unexported fields
}

An Item is the graphical representation of an libsf.Item.

func NewItem

func NewItem(item *libsf.Item, sync func(item *libsf.Item) *time.Time) *Item

NewItem returns a new Item.

func (*Item) Editor

func (w *Item) Editor() *ItemEditor

Editor returns the ItemContent of the Item.

func (*Item) Render

func (w *Item) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

Render implements gowid.IWidget

func (*Item) RenderSize

func (w *Item) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox

RenderSize implements gowid.IWidget

func (*Item) Selectable

func (w *Item) Selectable() bool

Selectable implements gowid.IWidget

func (*Item) Title

func (w *Item) Title() string

Title returns the name of the editor.

func (*Item) UserInput

func (w *Item) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

UserInput implements gowid.IWidget

type ItemEditor

type ItemEditor struct {
	*columns.Widget
	// contains filtered or unexported fields
}

An ItemEditor is the graphical representation of editable libsf.Item text.

func (*ItemEditor) Render

func (w *ItemEditor) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

Render implements gowid.IWidget

func (*ItemEditor) UserInput

func (w *ItemEditor) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

UserInput implements gowid.IWidget

type NoteList

type NoteList struct {
	// contains filtered or unexported fields
}

A NoteList is a list of Items to interract with. It implements gowid.IWidget by delegating to its presentation.

func NewNoteList

func NewNoteList(ui *TUI) *NoteList

NewNoteList returns a new NoteList.

func (*NoteList) Register

func (w *NoteList) Register(i *Item)

Register registers an item to this list.

func (*NoteList) Render

func (w *NoteList) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

Render implements gowid.IWidget

func (*NoteList) RenderSize

func (w *NoteList) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox

RenderSize implements gowid.IWidget

func (*NoteList) Selectable

func (w *NoteList) Selectable() bool

Selectable implements gowid.IWidget

func (*NoteList) Sort

func (w *NoteList) Sort(field string)

Sort orders items by the given field.

func (*NoteList) UserInput

func (w *NoteList) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

UserInput implements gowid.IWidget

type TUI

type TUI struct {
	App    *gowid.App
	SortBy string
	// contains filtered or unexported fields
}

A TUI is a text-based interface.

func New

func New() (*TUI, error)

New returns a new TUI.

func (*TUI) Cleanup added in v0.4.0

func (ui *TUI) Cleanup()

Cleanup cleans the application properly (in case of panic).

func (*TUI) DisplayStatus

func (ui *TUI) DisplayStatus(message string)

DisplayStatus displays a message in the status bar (aka notifications).

func (*TUI) Register

func (ui *TUI) Register(i *Item)

Register registers an item.

func (*TUI) Run

func (ui *TUI) Run()

Run starts the application and thus the event loop.

func (*TUI) SortItems

func (ui *TUI) SortItems()

SortItems sorts the items on ui.SortBy.

Jump to

Keyboard shortcuts

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