widget

package
v0.0.0-...-3b00f83 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	English = 0
	Korean
)

Variables

This section is empty.

Functions

func Bento

func Bento() palette

Bento returns gmk bento theme colour code

func Dark

func Dark() palette

Dark returns default colour code

func Dots

func Dots() palette

Dots returns dots theme colour code

func Dracula

func Dracula() palette

Dracula returns dracula theme colour code

func Dualshot

func Dualshot() palette

Dualshot returns dualshot theme colour code

func Hammerhead

func Hammerhead() palette

Hammerhead returns gmk hammerhead theme colour code

func Laser

func Laser() palette

Laser returns gmk laser theme colour code

func Nautilus

func Nautilus() palette

Nautilus returns gmk nautilus theme colour code

func NewThemes

func NewThemes() themes

func Oblivion

func Oblivion() palette

Oblivion returns oblivion theme colour code

func Olive

func Olive() palette

Olive returns gmk olive theme colour code

Types

type ConfigWidget

type ConfigWidget struct {
	*tview.Flex
	LanguageList  *tview.DropDown
	SoundList     *tview.DropDown
	WordCountList *tview.DropDown
	// contains filtered or unexported fields
}

func NewConfigWidget

func NewConfigWidget() *ConfigWidget

func (*ConfigWidget) ApplyColor

func (w *ConfigWidget) ApplyColor(p palette)

func (*ConfigWidget) GetNextOption

func (w *ConfigWidget) GetNextOption() (opt *tview.DropDown)

func (*ConfigWidget) SetLanguage

func (w *ConfigWidget) SetLanguage(lang int)
type MenuAction int
const (
	MenuActionNone MenuAction = iota
	MenuActionImportTheme
)

type Status

type Status struct {
	Entries      int       // total character count
	WrongEntries int       // wrong character count
	Words        []Word    // word list
	StartTime    time.Time // start time
	// contains filtered or unexported fields
}

Status describe general typing status (wpm, time, accuracy ..)

func NewStatus

func NewStatus() *Status

func (*Status) AddCount

func (t *Status) AddCount()

func (*Status) GetCurrentWord

func (t *Status) GetCurrentWord() Word

type StatusWidget

type StatusWidget struct {
	*tview.Flex
	Wpm      *tview.TextView
	Accuracy *tview.TextView
	Timer    *tview.TextView
	Count    *tview.TextView
	Status   *Status
	// contains filtered or unexported fields
}

StatusWidget is frame which display general typing information ( wpm, time ,,) it include tview.TextView struct

func NewStatusWidget

func NewStatusWidget() *StatusWidget

NewStatusWidget returns initialized StatusWidget

func (*StatusWidget) ApplyColor

func (t *StatusWidget) ApplyColor(p palette)

ApplyColor set color

func (*StatusWidget) GetAccuracy

func (t *StatusWidget) GetAccuracy() float64

GetAccuracy returns current word accuracy

func (*StatusWidget) GetCount

func (t *StatusWidget) GetCount() int

GetCount returns typed sentence count

func (*StatusWidget) GetElapsed

func (t *StatusWidget) GetElapsed() float64

GetElapsed returns current time elapsed

func (*StatusWidget) GetGrossWpm

func (t *StatusWidget) GetGrossWpm() float64

GetGrossWpm returns current wpm (word per minutes) * Gross WPM = (All typed entries) / Time (min)

func (*StatusWidget) GetNetWpm

func (t *StatusWidget) GetNetWpm() float64

GetNetWpm returns current wpm include errors * Net WPM = (All typed entries / 5) - ( Uncorrected Errors / Time (min) )

func (*StatusWidget) Init

func (w *StatusWidget) Init(words []string)

Init initialize string slice of status widget

func (*StatusWidget) IsStarted

func (t *StatusWidget) IsStarted() bool

IsStarted returns typing is started

func (*StatusWidget) Reset

func (t *StatusWidget) Reset()

type ThemeList

type ThemeList struct {
	*tview.List
	Theme themes
	// contains filtered or unexported fields
}

ThemeList is a box which display text theme list

func NewThemeList

func NewThemeList() *ThemeList

func (*ThemeList) ApplyColor

func (t *ThemeList) ApplyColor(p palette)

func (*ThemeList) GetCurrentTheme

func (t *ThemeList) GetCurrentTheme() string

func (*ThemeList) InputHandler

func (t *ThemeList) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*ThemeList) SetActionFunc

func (t *ThemeList) SetActionFunc(doneFunc func(action MenuAction))

func (*ThemeList) SetDoneFunc

func (t *ThemeList) SetDoneFunc(doneFunc func())

func (*ThemeList) SetVisible

func (t *ThemeList) SetVisible(visible bool)

type TypingWidget

type TypingWidget struct {
	*tview.Flex
	Text         *tview.TextView
	Input        *tview.InputField
	Words        languages
	DisplayWords languages
	CurrentIndex int
	// contains filtered or unexported fields
}

TypingBox is a box which display words be typed It include struct of tview.TextView , tview.InputField

func NewTypingWidget

func NewTypingWidget() *TypingWidget

func (*TypingWidget) ApplyColor

func (w *TypingWidget) ApplyColor(p palette)

ApplyColor apply current theme color on widget

func (*TypingWidget) ClearInputBox

func (w *TypingWidget) ClearInputBox()

func (*TypingWidget) ProcessNextWord

func (w *TypingWidget) ProcessNextWord()

func (*TypingWidget) Reset

func (w *TypingWidget) Reset()

func (*TypingWidget) Update

func (w *TypingWidget) Update(colored string, index int)

Update updates word list whether it is correct or not

func (*TypingWidget) UpdateWords

func (w *TypingWidget) UpdateWords(number int)

type Word

type Word struct {
	Text    string
	Iswrong []bool
}

func (*Word) CopyWord

func (w *Word) CopyWord(src string)

Jump to

Keyboard shortcuts

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