config

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DirectionalModalHorizontal int = 0
View Source
const DirectionalModalVertical int = 1

Variables

This section is empty.

Functions

func NewMainDisplay

func NewMainDisplay(app *tview.Application, previousConfig *config.RocketPoolConfig, config *config.RocketPoolConfig, isNew bool, isUpdate bool, isNative bool) *mainDisplay

Creates a new MainDisplay instance.

Types

type AddonGwwPage added in v1.6.0

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

The page wrapper for the Graffiti Wall Writer addon config

func NewAddonGwwPage added in v1.6.0

func NewAddonGwwPage(addonsPage *AddonsPage, addon addons.SmartnodeAddon) *AddonGwwPage

Creates a new page for the Graffiti Wall Writer addon settings

type AddonRescueNodePage added in v1.11.1

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

The page wrapper for the Rescue Node addon config

func NewAddonRescueNodePage added in v1.11.1

func NewAddonRescueNodePage(addonsPage *AddonsPage, addon addons.SmartnodeAddon) *AddonRescueNodePage

Creates a new page for the Graffiti Wall Writer addon settings

type AddonsPage

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

The addons page

func NewAddonsPage

func NewAddonsPage(home *settingsHome) *AddonsPage

Create a new addons page

type AlertingConfigPage added in v1.12.0

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

The page wrapper for the alerting config

func NewAlertingConfigPage added in v1.12.0

func NewAlertingConfigPage(home *settingsHome) *AlertingConfigPage

func NewAlertingConfigPageForNative added in v1.12.0

func NewAlertingConfigPageForNative(home *settingsNativeHome) *AlertingConfigPage

type ConsensusConfigPage

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

The page wrapper for the EC config

func NewConsensusConfigPage

func NewConsensusConfigPage(home *settingsHome) *ConsensusConfigPage

Creates a new page for the Consensus client settings

type DirectionalModal

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

DirectionalModal is an extension of Modal that allows for vertically stacked buttons.

func NewDirectionalModal

func NewDirectionalModal(direction int, app *tview.Application) *DirectionalModal

NewDirectionalModal returns a new modal message window.

func (*DirectionalModal) AddButtons

func (m *DirectionalModal) AddButtons(labels []string) *DirectionalModal

AddButtons adds buttons to the window. There must be at least one button and a "done" handler so the window can be closed again.

func (*DirectionalModal) ClearButtons

func (m *DirectionalModal) ClearButtons() *DirectionalModal

ClearButtons removes all buttons from the window.

func (*DirectionalModal) Draw

func (m *DirectionalModal) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*DirectionalModal) Focus

func (m *DirectionalModal) Focus(delegate func(p tview.Primitive))

Focus is called when this primitive receives focus.

func (*DirectionalModal) HasFocus

func (m *DirectionalModal) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*DirectionalModal) InputHandler

func (m *DirectionalModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler returns the handler for this primitive.

func (*DirectionalModal) SetBackgroundColor

func (m *DirectionalModal) SetBackgroundColor(color tcell.Color) *DirectionalModal

SetBackgroundColor sets the color of the modal frame background.

func (*DirectionalModal) SetButtonBackgroundColor

func (m *DirectionalModal) SetButtonBackgroundColor(color tcell.Color) *DirectionalModal

SetButtonBackgroundColor sets the background color of the buttons.

func (*DirectionalModal) SetButtonTextColor

func (m *DirectionalModal) SetButtonTextColor(color tcell.Color) *DirectionalModal

SetButtonTextColor sets the color of the button texts.

func (*DirectionalModal) SetDoneFunc

func (m *DirectionalModal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *DirectionalModal

SetDoneFunc sets a handler which is called when one of the buttons was pressed. It receives the index of the button as well as its label text. The handler is also called when the user presses the Escape key. The index will then be negative and the label text an emptry string.

func (*DirectionalModal) SetFocus

func (m *DirectionalModal) SetFocus(index int) *DirectionalModal

SetFocus shifts the focus to the button with the given index.

func (*DirectionalModal) SetText

func (m *DirectionalModal) SetText(text string) *DirectionalModal

SetText sets the message text of the window. The text may contain line breaks. Note that words are wrapped, too, based on the final size of the window.

func (*DirectionalModal) SetTextColor

func (m *DirectionalModal) SetTextColor(color tcell.Color) *DirectionalModal

SetTextColor sets the color of the message text.

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

DropDown implements a selection widget whose options become visible in a drop-down list when activated.

See https://github.com/rivo/tview/wiki/DropDown for an example.

func NewDropDown

func NewDropDown() *DropDown

NewDropDown returns a new drop-down.

func (d *DropDown) AddOption(text string, selected func()) *DropDown

AddOption adds a new selectable option to this drop-down. The "selected" callback is called when this option was selected. It may be nil.

func (d *DropDown) CloseList(app *tview.Application)

Closes a list, reverting the selected index.

func (d *DropDown) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (d *DropDown) Focus(delegate func(p tview.Primitive))

Focus is called by the application when the primitive receives focus.

func (d *DropDown) GetCurrentOption() (int, string)

GetCurrentOption returns the index of the currently selected option as well as its text. If no option was selected, -1 and an empty string is returned.

func (d *DropDown) GetFieldHeight() int

GetFieldHeight returns this primitive's field height.

func (d *DropDown) GetFieldWidth() int

GetFieldWidth returns this primitive's field screen width.

func (d *DropDown) GetLabel() string

GetLabel returns the text to be displayed before the input area.

func (d *DropDown) GetList() *tview.List

Get the underlying list.

func (d *DropDown) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (d *DropDown) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler returns the handler for this primitive.

func (d *DropDown) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)

MouseHandler returns the mouse handler for this primitive.

func (d *DropDown) SetChangedFunc(handler func(index int, mainText, secondaryText string, shortcut rune)) *DropDown
func (d *DropDown) SetCurrentOption(index int) *DropDown

SetCurrentOption sets the index of the currently selected option. This may be a negative value to indicate that no option is currently selected. Calling this function will also trigger the "selected" callback (if there is one).

func (d *DropDown) SetDoneFunc(handler func(key tcell.Key)) *DropDown

SetDoneFunc sets a handler which is called when the user is done selecting options. The callback function is provided with the key that was pressed, which is one of the following:

  • KeyEscape: Abort selection.
  • KeyTab: Move to the next field.
  • KeyBacktab: Move to the previous field.
func (d *DropDown) SetFieldBackgroundColor(color tcell.Color) *DropDown

SetFieldBackgroundColor sets the background color of the options area.

func (d *DropDown) SetFieldTextColor(color tcell.Color) *DropDown

SetFieldTextColor sets the text color of the options area.

func (d *DropDown) SetFieldWidth(width int) *DropDown

SetFieldWidth sets the screen width of the options area. A value of 0 means extend to as long as the longest option text.

func (d *DropDown) SetFinishedFunc(handler func(key tcell.Key)) tview.FormItem

SetFinishedFunc sets a callback invoked when the user leaves this form item.

func (d *DropDown) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldTextColor, fieldBgColor tcell.Color) tview.FormItem

SetFormAttributes sets attributes shared by all form items.

func (d *DropDown) SetLabel(label string) *DropDown

SetLabel sets the text to be displayed before the input area.

func (d *DropDown) SetLabelColor(color tcell.Color) *DropDown

SetLabelColor sets the color of the label.

func (d *DropDown) SetLabelWidth(width int) *DropDown

SetLabelWidth sets the screen width of the label. A value of 0 will cause the primitive to use the width of the label string.

func (d *DropDown) SetListStyles(unselected, selected tcell.Style) *DropDown

SetListStyles sets the styles of the items in the drop-down list (unselected as well as selected items). Style attributes are currently ignored but may be used in the future.

func (d *DropDown) SetOptions(texts []string, selected func(text string, index int)) *DropDown

SetOptions replaces all current options with the ones provided and installs one callback function which is called when one of the options is selected. It will be called with the option's text and its index into the options slice. The "selected" parameter may be nil.

func (d *DropDown) SetPrefixTextColor(color tcell.Color) *DropDown

SetPrefixTextColor sets the color of the prefix string. The prefix string is shown when the user starts typing text, which directly selects the first option that starts with the typed string.

func (d *DropDown) SetSelectedFunc(handler func(text string, index int)) *DropDown

SetSelectedFunc sets a handler which is called when the user changes the drop-down's option. This handler will be called in addition and prior to an option's optional individual handler. The handler is provided with the selected option's text and index. If "no option" was selected, these values are an empty string and -1.

func (d *DropDown) SetTextOptions(prefix, suffix, currentPrefix, currentSuffix, noSelection string) *DropDown

SetTextOptions sets the text to be placed before and after each drop-down option (prefix/suffix), the text placed before and after the currently selected option (currentPrefix/currentSuffix) as well as the text to be displayed when no option is currently selected. Per default, all of these strings are empty.

type ExecutionConfigPage

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

The page wrapper for the EC config

func NewExecutionConfigPage

func NewExecutionConfigPage(home *settingsHome) *ExecutionConfigPage

Creates a new page for the Execution client settings

type FallbackConfigPage added in v1.5.0

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

The page wrapper for the fallback config

func NewFallbackConfigPage added in v1.5.0

func NewFallbackConfigPage(home *settingsHome) *FallbackConfigPage

Creates a new page for the fallback client settings

type Form

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

Form allows you to combine multiple one-line form elements into a vertical or horizontal layout. Form elements include types such as InputField or Checkbox. These elements can be optionally followed by one or more buttons for which you can define form-wide actions (e.g. Save, Clear, Cancel).

See https://github.com/rivo/tview/wiki/Form for an example.

func NewForm

func NewForm() *Form

NewForm returns a new form.

func (*Form) AddButton

func (f *Form) AddButton(label string, selected func()) *Form

AddButton adds a new button to the form. The "selected" function is called when the user selects this button. It may be nil.

func (*Form) AddCheckbox

func (f *Form) AddCheckbox(label string, checked bool, changed func(checked bool)) *Form

AddCheckbox adds a checkbox to the form. It has a label, an initial state, and an (optional) callback function which is invoked when the state of the checkbox was changed by the user.

func (*Form) AddDropDown

func (f *Form) AddDropDown(label string, options []string, initialOption int, selected func(option string, optionIndex int)) *Form

AddDropDown adds a drop-down element to the form. It has a label, options, and an (optional) callback function which is invoked when an option was selected. The initial option may be a negative value to indicate that no option is currently selected.

func (*Form) AddFormItem

func (f *Form) AddFormItem(item tview.FormItem) *Form

AddFormItem adds a new item to the form. This can be used to add your own objects to the form. Note, however, that the Form class will override some of its attributes to make it work in the form context. Specifically, these are:

  • The label width
  • The label color
  • The background color
  • The field text color
  • The field background color

func (*Form) AddInputField

func (f *Form) AddInputField(label, value string, fieldWidth int, accept func(textToCheck string, lastChar rune) bool, changed func(text string)) *Form

AddInputField adds an input field to the form. It has a label, an optional initial value, a field width (a value of 0 extends it as far as possible), an optional accept function to validate the item's value (set to nil to accept any text), and an (optional) callback function which is invoked when the input field's text has changed.

func (*Form) AddPasswordField

func (f *Form) AddPasswordField(label, value string, fieldWidth int, mask rune, changed func(text string)) *Form

AddPasswordField adds a password field to the form. This is similar to an input field except that the user's input not shown. Instead, a "mask" character is displayed. The password field has a label, an optional initial value, a field width (a value of 0 extends it as far as possible), and an (optional) callback function which is invoked when the input field's text has changed.

func (*Form) Clear

func (f *Form) Clear(includeButtons bool) *Form

Clear removes all input elements from the form, including the buttons if specified.

func (*Form) ClearButtons

func (f *Form) ClearButtons() *Form

ClearButtons removes all buttons from the form.

func (*Form) Draw

func (f *Form) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Form) Focus

func (f *Form) Focus(delegate func(p tview.Primitive))

Focus is called by the application when the primitive receives focus.

func (*Form) GetButton

func (f *Form) GetButton(index int) *tview.Button

GetButton returns the button at the specified 0-based index. Note that buttons have been specially prepared for this form and modifying some of their attributes may have unintended side effects.

func (*Form) GetButtonCount

func (f *Form) GetButtonCount() int

GetButtonCount returns the number of buttons in this form.

func (*Form) GetButtonIndex

func (f *Form) GetButtonIndex(label string) int

GetButtonIndex returns the index of the button with the given label, starting with 0 for the button that was added first. If no such label was found, -1 is returned.

func (*Form) GetFocusedItemIndex

func (f *Form) GetFocusedItemIndex() (formItem, button int)

GetFocusedItemIndex returns the indices of the form element or button which currently has focus. If they don't, -1 is returned resepectively.

func (*Form) GetFormItem

func (f *Form) GetFormItem(index int) tview.FormItem

GetFormItem returns the form item at the given position, starting with index 0. Elements are referenced in the order they were added. Buttons are not included.

func (*Form) GetFormItemByLabel

func (f *Form) GetFormItemByLabel(label string) tview.FormItem

GetFormItemByLabel returns the first form element with the given label. If no such element is found, nil is returned. Buttons are not searched and will therefore not be returned.

func (*Form) GetFormItemCount

func (f *Form) GetFormItemCount() int

GetFormItemCount returns the number of items in the form (not including the buttons).

func (*Form) GetFormItemIndex

func (f *Form) GetFormItemIndex(label string) int

GetFormItemIndex returns the index of the first form element with the given label. If no such element is found, -1 is returned. Buttons are not searched and will therefore not be returned.

func (*Form) HasFocus

func (f *Form) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*Form) InputHandler

func (f *Form) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler returns the handler for this primitive.

func (*Form) MouseHandler

func (f *Form) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)

MouseHandler returns the mouse handler for this primitive.

func (*Form) RemoveButton

func (f *Form) RemoveButton(index int) *Form

RemoveButton removes the button at the specified position, starting with 0 for the button that was added first.

func (*Form) RemoveFormItem

func (f *Form) RemoveFormItem(index int) *Form

RemoveFormItem removes the form element at the given position, starting with index 0. Elements are referenced in the order they were added. Buttons are not included.

func (*Form) SetButtonBackgroundActivatedColor

func (f *Form) SetButtonBackgroundActivatedColor(color tcell.Color) *Form

SetButtonBackgroundColor sets the background color of the buttons when activated.

func (*Form) SetButtonBackgroundColor

func (f *Form) SetButtonBackgroundColor(color tcell.Color) *Form

SetButtonBackgroundColor sets the background color of the buttons.

func (*Form) SetButtonTextActivatedColor

func (f *Form) SetButtonTextActivatedColor(color tcell.Color) *Form

SetButtonTextColor sets the color of the button texts when activated.

func (*Form) SetButtonTextColor

func (f *Form) SetButtonTextColor(color tcell.Color) *Form

SetButtonTextColor sets the color of the button texts.

func (*Form) SetButtonsAlign

func (f *Form) SetButtonsAlign(align int) *Form

SetButtonsAlign sets how the buttons align horizontally, one of AlignLeft (the default), AlignCenter, and AlignRight. This is only

func (*Form) SetCancelFunc

func (f *Form) SetCancelFunc(callback func()) *Form

SetCancelFunc sets a handler which is called when the user hits the Escape key.

func (*Form) SetChangedFunc

func (f *Form) SetChangedFunc(callback func(index int)) *Form

SetChangedFunc sets a handler which is called when the user moves to another field in the form.

func (*Form) SetFieldBackgroundColor

func (f *Form) SetFieldBackgroundColor(color tcell.Color) *Form

SetFieldBackgroundColor sets the background color of the input areas.

func (*Form) SetFieldTextColor

func (f *Form) SetFieldTextColor(color tcell.Color) *Form

SetFieldTextColor sets the text color of the input areas.

func (*Form) SetFocus

func (f *Form) SetFocus(index int) *Form

SetFocus shifts the focus to the form element with the given index, counting non-button items first and buttons last. Note that this index is only used when the form itself receives focus.

func (*Form) SetHorizontal

func (f *Form) SetHorizontal(horizontal bool) *Form

SetHorizontal sets the direction the form elements are laid out. If set to true, instead of positioning them from top to bottom (the default), they are positioned from left to right, moving into the next row if there is not enough space.

func (*Form) SetItemPadding

func (f *Form) SetItemPadding(padding int) *Form

SetItemPadding sets the number of empty rows between form items for vertical layouts and the number of empty cells between form items for horizontal layouts.

func (*Form) SetLabelColor

func (f *Form) SetLabelColor(color tcell.Color) *Form

SetLabelColor sets the color of the labels.

type MetricsConfigPage

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

The page wrapper for the metrics config

func NewMetricsConfigPage

func NewMetricsConfigPage(home *settingsHome) *MetricsConfigPage

Creates a new page for the metrics / stats settings

type MevBoostConfigPage added in v1.5.0

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

The page wrapper for the MEV-boost config

func NewMevBoostConfigPage added in v1.5.0

func NewMevBoostConfigPage(home *settingsHome) *MevBoostConfigPage

Creates a new page for the MEV-Boost settings

type NativeFallbackConfigPage added in v1.5.0

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

The page wrapper for the fallback config

func NewNativeFallbackConfigPage added in v1.5.0

func NewNativeFallbackConfigPage(home *settingsNativeHome) *NativeFallbackConfigPage

Creates a new page for the fallback client settings

type NativeMetricsConfigPage

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

The page wrapper for the metrics config

func NewNativeMetricsConfigPage

func NewNativeMetricsConfigPage(home *settingsNativeHome) *NativeMetricsConfigPage

Creates a new page for the metrics / stats settings

type NativePage

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

The page wrapper for the native config

func NewNativePage

func NewNativePage(home *settingsNativeHome) *NativePage

Creates a new page for the native settings

type NativeSmartnodeConfigPage

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

The page wrapper for the Smartnode config

func NewNativeSmartnodeConfigPage

func NewNativeSmartnodeConfigPage(home *settingsNativeHome) *NativeSmartnodeConfigPage

Creates a new page for the Native Smartnode settings

type Pseudomodal

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

func NewPseudomodal

func NewPseudomodal(direction int, app *tview.Application) *Pseudomodal

NewPseudomodal returns a new modal message window.

func (*Pseudomodal) AddButtons

func (m *Pseudomodal) AddButtons(labels []string) *Pseudomodal

AddButtons adds buttons to the window. There must be at least one button and a "done" handler so the window can be closed again.

func (*Pseudomodal) ClearButtons

func (m *Pseudomodal) ClearButtons() *Pseudomodal

ClearButtons removes all buttons from the window.

func (*Pseudomodal) Draw

func (m *Pseudomodal) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Pseudomodal) Focus

func (m *Pseudomodal) Focus(delegate func(p tview.Primitive))

Focus is called when this primitive receives focus.

func (*Pseudomodal) HasFocus

func (m *Pseudomodal) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*Pseudomodal) InputHandler

func (m *Pseudomodal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler returns the handler for this primitive.

func (*Pseudomodal) SetBackgroundColor

func (m *Pseudomodal) SetBackgroundColor(color tcell.Color) *Pseudomodal

SetBackgroundColor sets the color of the modal frame background.

func (*Pseudomodal) SetButtonBackgroundColor

func (m *Pseudomodal) SetButtonBackgroundColor(color tcell.Color) *Pseudomodal

SetButtonBackgroundColor sets the background color of the buttons.

func (*Pseudomodal) SetButtonTextColor

func (m *Pseudomodal) SetButtonTextColor(color tcell.Color) *Pseudomodal

SetButtonTextColor sets the color of the button texts.

func (*Pseudomodal) SetDoneFunc

func (m *Pseudomodal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *Pseudomodal

SetDoneFunc sets a handler which is called when one of the buttons was pressed. It receives the index of the button as well as its label text. The handler is also called when the user presses the Escape key. The index will then be negative and the label text an emptry string.

func (*Pseudomodal) SetFocus

func (m *Pseudomodal) SetFocus(index int) *Pseudomodal

SetFocus shifts the focus to the button with the given index.

func (*Pseudomodal) SetText

func (m *Pseudomodal) SetText(text string) *Pseudomodal

SetText sets the message text of the window. The text may contain line breaks. Note that words are wrapped, too, based on the final size of the window.

func (*Pseudomodal) SetTextColor

func (m *Pseudomodal) SetTextColor(color tcell.Color) *Pseudomodal

SetTextColor sets the color of the message text.

type ReviewNativePage

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

The changed settings review page

type ReviewPage

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

The changed settings review page

func NewReviewNativePage

func NewReviewNativePage(md *mainDisplay, oldConfig *config.RocketPoolConfig, newConfig *config.RocketPoolConfig) *ReviewPage

Create a page to review any changes

func NewReviewPage

func NewReviewPage(md *mainDisplay, oldConfig *config.RocketPoolConfig, newConfig *config.RocketPoolConfig) *ReviewPage

Create a page to review any changes

type SmartnodeConfigPage

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

The page wrapper for the Smartnode config

func NewSmartnodeConfigPage

func NewSmartnodeConfigPage(home *settingsHome) *SmartnodeConfigPage

Creates a new page for the Smartnode settings

Jump to

Keyboard shortcuts

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