model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QWERTY  layout = "QWERTY"
	DVORAK  layout = "DVORAK"  // unsupported
	COLEMAK layout = "COLEMAK" // unsupported
)
View Source
const (
	Sequence practiceMode = "sequence"
	Random   practiceMode = "random"
)

Variables

View Source
var (
	// QWERTY 键盘布局
	QWERTYKeyBoardDisplay = [][]string{
		{" Tab ", "Q     ", "W     ", "E     ", "R     ", "T     ", "Y     ", "U     ", "I     ", "O     ", "P     ", " [{ ", " ]} ", " |\\ "},
		{"A     ", "S     ", "D     ", "F     ", "G     ", "H     ", "J     ", "K     ", "L     ", " ;: ", " '\" ", " Enter "},
		{"Z     ", "X     ", "C     ", "V     ", "B     ", "N     ", "M     ", " ,< ", " .> ", " /? "},
		{"                    "},
	}
	QWERTYKeyBoardChar = [][]string{
		{"", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "", "", ""},
		{"a", "s", "d", "f", "g", "h", "j", "k", "l", "", "", ""},
		{"z", "x", "c", "v", "b", "n", "m", "", "", ""},
		{""},
	}
	QWERTYKeyIndex = map[string]*position{
		"tab": {0, 0}, "q": {0, 1}, "w": {0, 2}, "e": {0, 3}, "r": {0, 4}, "t": {0, 5}, "y": {0, 6}, "u": {0, 7}, "i": {0, 8}, "o": {0, 9}, "p": {0, 10}, "[": {0, 11}, "]": {0, 12}, "\\": {0, 13},
		"Q": {0, 1}, "W": {0, 2}, "E": {0, 3}, "R": {0, 4}, "T": {0, 5}, "Y": {0, 6}, "U": {0, 7}, "I": {0, 8}, "O": {0, 9}, "P": {0, 10}, "{": {0, 11}, "}": {0, 12}, "|": {0, 13},
		"a": {1, 0}, "s": {1, 1}, "d": {1, 2}, "f": {1, 3}, "g": {1, 4}, "h": {1, 5}, "j": {1, 6}, "k": {1, 7}, "l": {1, 8}, ";": {1, 9}, "'": {1, 10}, "enter": {1, 11},
		"A": {1, 0}, "S": {1, 1}, "D": {1, 2}, "F": {1, 3}, "G": {1, 4}, "H": {1, 5}, "J": {1, 6}, "K": {1, 7}, "L": {1, 8}, ":": {1, 9}, "\"": {1, 10},
		"z": {2, 0}, "x": {2, 1}, "c": {2, 2}, "v": {2, 3}, "b": {2, 4}, "n": {2, 5}, "m": {2, 6}, ",": {2, 7}, ".": {2, 8}, "/": {2, 9},
		"Z": {2, 0}, "X": {2, 1}, "C": {2, 2}, "V": {2, 3}, "B": {2, 4}, "N": {2, 5}, "M": {2, 6}, "<": {2, 7}, ">": {2, 8}, "?": {2, 9},
		" ": {3, 0},
	}
)

Functions

This section is empty.

Types

type KeyBoard added in v0.0.5

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

func NewKeyBoard added in v0.0.5

func NewKeyBoard(keyBoardLayout ...layout) (keyboard *KeyBoard)

func (*KeyBoard) Hit added in v0.0.5

func (k *KeyBoard) Hit(keyMsg string)

Hit 显示按键回显

type Model

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

func NewModel added in v0.0.5

func NewModel(scheme, mode string, disablePyPrompt, disableKbPrompt bool) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type TickMsg added in v0.0.5

type TickMsg time.Time

type Word added in v0.0.5

type Word struct {
	Word       string   // "中"
	Shengyun   []string // ["zh", "ong"]
	Pinyin     string   // "zhong"
	Shuangpyin []string // ["v", "s"]
	Answer     string   // "vs"

	Transform *shuangpin.Transform
	// contains filtered or unexported fields
}

func NewWord added in v0.0.6

func NewWord(scheme shuangpin.ShuangpinScheme, mode practiceMode) *Word

func (*Word) Next added in v0.0.5

func (w *Word) Next()

Next 根据练习模式获取下一个汉字

Jump to

Keyboard shortcuts

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