util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Key0 tcell.Key = iota + 48
	Key1
	Key2
	Key3
	Key4
	Key5
	Key6
	Key7
	Key8
	Key9
)

Defines numeric keys for container actions.

View Source
const (
	KeyShift0 tcell.Key = 41
	KeyShift1 tcell.Key = 33
	KeyShift2 tcell.Key = 64
	KeyShift3 tcell.Key = 35
	KeyShift4 tcell.Key = 36
	KeyShift5 tcell.Key = 37
	KeyShift6 tcell.Key = 94
	KeyShift7 tcell.Key = 38
	KeyShift8 tcell.Key = 42
	KeyShift9 tcell.Key = 40
)

Defines numeric keys for container actions.

View Source
const (
	KeyA tcell.Key = iota + 97
	KeyB
	KeyC
	KeyD
	KeyE
	KeyF
	KeyG
	KeyH
	KeyI
	KeyJ
	KeyK
	KeyL
	KeyM
	KeyN
	KeyO
	KeyP
	KeyQ
	KeyR
	KeyS
	KeyT
	KeyU
	KeyV
	KeyW
	KeyX
	KeyY
	KeyZ
	KeyHelp  = 63
	KeySlash = 47
	KeyColon = 58
	KeySpace = 32
)

Defines char keystrokes.

View Source
const (
	KeyShiftA tcell.Key = iota + 65
	KeyShiftB
	KeyShiftC
	KeyShiftD
	KeyShiftE
	KeyShiftF
	KeyShiftG
	KeyShiftH
	KeyShiftI
	KeyShiftJ
	KeyShiftK
	KeyShiftL
	KeyShiftM
	KeyShiftN
	KeyShiftO
	KeyShiftP
	KeyShiftQ
	KeyShiftR
	KeyShiftS
	KeyShiftT
	KeyShiftU
	KeyShiftV
	KeyShiftW
	KeyShiftX
	KeyShiftY
	KeyShiftZ
)

Define Shift Keys.

View Source
const (
	NAValue = "[dimgray]n/a[-]"

	EmptyValue = ""
)
View Source
const (
	ProgressBarWidth = 3

	ProgressBarHeight = 1

	ProgressBarCell = "▉"
)

Variables

View Source
var NumKeys = map[int]tcell.Key{
	0: Key0,
	1: Key1,
	2: Key2,
	3: Key3,
	4: Key4,
	5: Key5,
	6: Key6,
	7: Key7,
	8: Key8,
	9: Key9,
}

NumKeys tracks number keys.

Functions

func AsKey

func AsKey(evt *tcell.EventKey) tcell.Key

AsKey converts rune to keyboard key.

Types

type Avatar

type Avatar struct {
	*tview.Table
	// contains filtered or unexported fields
}

func NewAvatar

func NewAvatar(size int) *Avatar

func (*Avatar) SetAddress

func (a *Avatar) SetAddress(address common.Address)

SetAddress binds an account to this avatar widget, displays an identicon generated by account's address.

type KeyHandler

type KeyHandler func(*tcell.EventKey)

type KeyMap

type KeyMap struct {
	Key         tcell.Key
	Shortcut    string
	Description string
	Handler     KeyHandler
}

func NewSimpleKey

func NewSimpleKey(key tcell.Key, handler func()) KeyMap

NewSimpleKey creates a simple keymap with only key and handler.

type KeyMaps

type KeyMaps []KeyMap

func (KeyMaps) Add

func (km KeyMaps) Add(another KeyMaps) KeyMaps

func (KeyMaps) FindHandler

func (km KeyMaps) FindHandler(key tcell.Key) (KeyHandler, bool)

type Loader

type Loader struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(app *tview.Application) *Loader

func (*Loader) Display

func (l *Loader) Display(display bool)

func (*Loader) Draw

func (l *Loader) Draw(screen tcell.Screen)

Draw implements tview.Draw

func (*Loader) IsDisplay

func (l *Loader) IsDisplay() bool

func (*Loader) SetCellColor

func (l *Loader) SetCellColor(color tcell.Color)

func (*Loader) SetCentral

func (l *Loader) SetCentral(x, y, width, height int)

SetRect implements tview.SetRect

func (*Loader) Start

func (l *Loader) Start()

func (*Loader) Stop

func (l *Loader) Stop()

type Section

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

func NewSection

func NewSection(title string, text string) *Section

func NewSectionWithColor

func NewSectionWithColor(title string, titleColor tcell.Color, text string, textColor tcell.Color) *Section

func NewSectionWithStyle

func NewSectionWithStyle(title string, text string, style *style.Style) *Section

func (*Section) AddToTable

func (s *Section) AddToTable(table *tview.Table, row, column int)

func (*Section) GetText

func (s *Section) GetText() string

func (*Section) GetTextCell

func (s *Section) GetTextCell() *tview.TableCell

func (*Section) GetTitleCell

func (s *Section) GetTitleCell() *tview.TableCell

func (*Section) SetText

func (s *Section) SetText(text string)

type Spinner

type Spinner struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewSpinner

func NewSpinner(app *tview.Application) *Spinner

func (*Spinner) Display

func (s *Spinner) Display(display bool)

func (*Spinner) Draw

func (s *Spinner) Draw(screen tcell.Screen)

Draw implements tview.Draw

func (*Spinner) IsDisplay

func (s *Spinner) IsDisplay() bool

func (*Spinner) SetCentral

func (s *Spinner) SetCentral(x, y, width, height int)

func (*Spinner) SetRect

func (s *Spinner) SetRect(x, y, width, height int)

SetRect implements tview.SetRect

func (*Spinner) Start

func (s *Spinner) Start()

func (*Spinner) StartAndShow

func (s *Spinner) StartAndShow()

func (*Spinner) Stop

func (s *Spinner) Stop()

func (*Spinner) StopAndHide

func (s *Spinner) StopAndHide()

Jump to

Keyboard shortcuts

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