ui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GlossariesDialog

type GlossariesDialog struct {
	tview.Flex
	// contains filtered or unexported fields
}

GlossariesDialog is used to let the user choose a glossary displays the corresponding entries.

func (*GlossariesDialog) SetAcceptedFunc

func (w *GlossariesDialog) SetAcceptedFunc(accepted func(string, string)) *GlossariesDialog

SetAcceptedFunc sets the handler which is called when the user accepts the current option by selecting the `accept` button. The handler receives the id and name of the selected glossary.

func (*GlossariesDialog) SetCancelFunc

func (w *GlossariesDialog) SetCancelFunc(cancel func()) *GlossariesDialog

SetCancelFunc sets the handler which is called when the user selects the `cancel` button.

func (*GlossariesDialog) SetDataFunc

SetDataFunc sets the handler that is used to get the glossary meta information and entries to display when a glossary is selected. The handler receives the id of the glossary.

func (*GlossariesDialog) SetOptions

func (w *GlossariesDialog) SetOptions(options [][2]string) *GlossariesDialog

SetOptions replaces all current glossary options with the ones provided.

type GlossariesPage

type GlossariesPage struct {
	*tview.Flex
	// contains filtered or unexported fields
}

GlossariesPage provides widgets to manage glossaries.

func (*GlossariesPage) SetGlossaryCreateFunc

func (w *GlossariesPage) SetGlossaryCreateFunc(create func(string, string, string, [][2]string))

SetGlossaryCreateFunc sets the handler that is called when the user selects the glossary `create` button. The handler receives the name, source lang, target lang and entries for the glossary.

func (*GlossariesPage) SetGlossaryDataFunc

func (w *GlossariesPage) SetGlossaryDataFunc(data func(string) (deepl.GlossaryInfo, []deepl.GlossaryEntry)) *GlossariesPage

SetGlossaryDataFunc sets the handler that is used to get the glossary meta information and entries to display when a glossary is selected. The handler receives the id of the glossary.

func (*GlossariesPage) SetGlossaryDeleteFunc

func (w *GlossariesPage) SetGlossaryDeleteFunc(del func(string))

SetGlossaryDeleteFunc sets the handler that is called when the user selects the glossary `delete` button. The handler receives the id of the glossary.

func (*GlossariesPage) SetGlossaryUpdateFunc

func (w *GlossariesPage) SetGlossaryUpdateFunc(update func(string, string, [][2]string))

SetGlossaryUpdateFunc sets the handler that is called when the user selects the glossary `update` button. The handler receives the id, name and entries of the glossary.

func (*GlossariesPage) SetLanguageOptions

func (w *GlossariesPage) SetLanguageOptions(langs []string) *GlossariesPage

SetLanguageOptions replaces the glossary info form source and target language options with the ones provided.

func (*GlossariesPage) SetOptions

func (w *GlossariesPage) SetOptions(options [][2]string) *GlossariesPage

SetOptions replaces the glossary list items with the ones provided.

type GlossaryEntryForm

type GlossaryEntryForm struct {
	*tview.Form
	// contains filtered or unexported fields
}

GlossaryEntryForm is used to manage glossary entries.

func (*GlossaryEntryForm) SetEntry

type GlossaryInfoForm

type GlossaryInfoForm struct {
	*tview.Form
	// contains filtered or unexported fields
}

GlossaryInfoForm displays glossary meta information in a form layout.

func (*GlossaryInfoForm) SetInfo

SetInfo sets the glossary meta information.

func (*GlossaryInfoForm) SetLanguageOptions

func (w *GlossaryInfoForm) SetLanguageOptions(langs []string) *GlossaryInfoForm

SetLanguageOptions replaces all glossary source and target language options with the ones provided.

type TranslatePage

type TranslatePage struct {
	tview.Pages
	// contains filtered or unexported fields
}

TranslatePage provides widgets to translate input text and specify translation options.

func (*TranslatePage) SetGlossarySelectedFunc

func (w *TranslatePage) SetGlossarySelectedFunc(selected func(string)) *TranslatePage

SetGlossarySelectedFunc sets a handler that is called when a glossary is selected.

type UI

type UI struct {
	tview.Application
	// contains filtered or unexported fields
}

func NewUI

func NewUI() *UI

func (*UI) ClearOutputText

func (ui *UI) ClearOutputText()

func (*UI) GetInputText

func (ui *UI) GetInputText() string

func (*UI) SetFooter

func (ui *UI) SetFooter(text string)

func (*UI) SetFormalityOptions

func (ui *UI) SetFormalityOptions(opts []string, selected func(string, int))

func (*UI) SetGlossaryCreateFunc

func (ui *UI) SetGlossaryCreateFunc(handler func(string, string, string, [][2]string))

func (*UI) SetGlossaryDataFunc

func (ui *UI) SetGlossaryDataFunc(handler func(string) (deepl.GlossaryInfo, []deepl.GlossaryEntry))

SetGlossaryDataFunc sets a handler which can be called by the ui widgets to request glossary data. It receives the glossary ID as an argument.

func (*UI) SetGlossaryDeleteFunc

func (ui *UI) SetGlossaryDeleteFunc(handler func(string))

func (*UI) SetGlossaryLanguageOptions

func (ui *UI) SetGlossaryLanguageOptions(langs []string)

SetGlossaryLanguageOptions provides the ui with a list of supported glossary languages.

func (*UI) SetGlossaryOptions

func (ui *UI) SetGlossaryOptions(options [][2]string)

SetGlossaryOptions provides the ui with a list of available glossary ids and names.

func (*UI) SetGlossarySelectedFunc

func (ui *UI) SetGlossarySelectedFunc(handler func(string))

func (*UI) SetGlossaryUpdateFunc

func (ui *UI) SetGlossaryUpdateFunc(handler func(string, string, [][2]string))

func (*UI) SetInputTextChangedFunc

func (ui *UI) SetInputTextChangedFunc(handler func())

SetInputTextChangedFunc sets a handler that is called when the input text changes.

func (*UI) SetSourceLangOptions

func (ui *UI) SetSourceLangOptions(opts []string, selected func(string, int))

func (*UI) SetTargetLangOptions

func (ui *UI) SetTargetLangOptions(opts []string, selected func(string, int))

func (*UI) WriteOutputText

func (ui *UI) WriteOutputText(r io.Reader) error

Jump to

Keyboard shortcuts

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