ui

package
v0.0.0-...-7d1b45a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_COMMAND_PREFIX = "w3p"
View Source
const NOTIFICATION_TIME = 3

Variables

View Source
var ActiveRequest *bus.Message
View Source
var AuxP_Id int
View Source
var DarkTheme = ThemeStruct{
	Name: "dark",

	BgColor:       gocui.GetColor("#090300"),
	FgColor:       gocui.GetColor("#A5A2A2"),
	FrameColor:    gocui.GetColor("#a7a7a7"),
	SelBgColor:    gocui.GetColor("#090300"),
	SelFgColor:    gocui.GetColor("#f3f3f3"),
	SelFrameColor: gocui.GetColor("#7FFFD4"),

	ActionBgColor:    gocui.GetColor("#FFD700"),
	ActionFgColor:    gocui.GetColor("#0000cc"),
	ActionSelBgColor: gocui.ColorCyan,
	ActionSelFgColor: gocui.ColorBlack,

	ErrorFgColor: gocui.GetColor("#ff0000"),
	EmFgColor:    gocui.ColorCyan,

	HelpFgColor:  gocui.GetColor("#f1f1f1"),
	HelpBgColor:  gocui.GetColor("#028002"),
	InputBgColor: gocui.GetColor("#292320"),
}
View Source
var Gui *gocui.Gui
View Source
var HQMutex = &sync.Mutex{}
View Source
var HailQueue []*bus.Message
View Source
var Is_ready = false
View Source
var Is_ready_wg sync.WaitGroup
View Source
var LightTheme = ThemeStruct{
	Name: "light",

	BgColor:       gocui.GetColor("#f1f1f1"),
	FgColor:       gocui.ColorBlack,
	FrameColor:    gocui.ColorBlack,
	SelBgColor:    gocui.ColorCyan,
	SelFgColor:    gocui.ColorBlack,
	SelFrameColor: gocui.ColorCyan,

	ActionBgColor:    gocui.ColorCyan,
	ActionFgColor:    gocui.GetColor("#ffff00"),
	ActionSelBgColor: gocui.ColorCyan,
	ActionSelFgColor: gocui.ColorBlack,

	ErrorFgColor: gocui.GetColor("#ff0000"),
	EmFgColor:    gocui.ColorCyan,

	HelpFgColor:  gocui.GetColor("#f1f1f1"),
	HelpBgColor:  gocui.GetColor("#013220"),
	InputBgColor: gocui.GetColor("#717171"),
}
View Source
var RUNES = []rune{'─', '│', '┌', '┐', '└', '┘', '├', '┤', '┬', '┴', '┼'}
View Source
var TopLeftFlow = NewFlow(
	FlowVertical,
	[]Pane{
		&Status,
	},
	&PaneDescriptor{
		MinWidth:  45,
		MinHeight: 1,
	})

Functions

func AppsLoop

func AppsLoop()

func B

func B(c gocui.Attribute) string

set background

func DlgAddressAdd

func DlgAddressAdd(addr string, signer string, path string) *gocui.Popup

func DlgAddressAddWatch

func DlgAddressAddWatch(addr string) *gocui.Popup

func DlgAddressEdit

func DlgAddressEdit(name string) *gocui.Popup

func DlgBlockchain

func DlgBlockchain(chain_id int) *gocui.Popup

chain_id = 0 means add new custom blockchain

func DlgConfirm

func DlgConfirm(title string, text string, action func() bool) *gocui.Popup

func DlgLP_V2_add

func DlgLP_V2_add(b *cmn.Blockchain, factory string, router string, name string, url string, subgraphID string) *gocui.Popup

func DlgLP_V2_edit

func DlgLP_V2_edit(b *cmn.Blockchain, factory string, name string, url string, subgraphID string) *gocui.Popup

func DlgLP_V3_add

func DlgLP_V3_add(b *cmn.Blockchain, address string, name string, url string) *gocui.Popup

func DlgLP_V3_edit

func DlgLP_V3_edit(b *cmn.Blockchain, address string, name string, url string) *gocui.Popup

func DlgLP_V4_add

func DlgLP_V4_add(b *cmn.Blockchain, provider string, poolManager string, stateView string, name string, url string, subgraphURL string) *gocui.Popup

func DlgLP_V4_edit

func DlgLP_V4_edit(b *cmn.Blockchain, provider string, name string, url string, subgraphURL string) *gocui.Popup

func DlgSend

func DlgSend(b *cmn.Blockchain, t *cmn.Token, from *cmn.Address, to string, amount string) *gocui.Popup

func DlgSignerAdd

func DlgSignerAdd(t string, name string) *gocui.Popup

func DlgSignerEdit

func DlgSignerEdit(name string) *gocui.Popup

func DlgStakingAdd

func DlgStakingAdd(b *cmn.Blockchain) *gocui.Popup

func DlgStakingEdit

func DlgStakingEdit(b *cmn.Blockchain, s *cmn.Staking) *gocui.Popup

func DlgTokenEdit

func DlgTokenEdit(t *cmn.Token) *gocui.Popup

name == "" mreans add new custom blockchain

func DlgWaletCreate

func DlgWaletCreate() *gocui.Popup

func DlgWaletOpen

func DlgWaletOpen(name string) *gocui.Popup

func DlgWalletPassword

func DlgWalletPassword() *gocui.Popup

func DlgWalletRestore

func DlgWalletRestore(backupFile string) *gocui.Popup

func F

func F(c gocui.Attribute) string

set foreground

func FB

func FB(fg, bg gocui.Attribute) string

set foreground and background

func FastEstimateLines

func FastEstimateLines(p Pane, w int) int

func Flush

func Flush()

func GetTerminalWidth

func GetTerminalWidth() int

GetTerminalWidth returns the width of the terminal screen in characters

func HidePane

func HidePane(p Pane)

func Init

func Init()

func LP_V2Loop

func LP_V2Loop()

func LP_V3Loop

func LP_V3Loop()

func LP_V4Loop

func LP_V4Loop()

func Layout

func Layout(g *gocui.Gui) error

func Loop

func Loop()

func OnAutocompleteMouseDown

func OnAutocompleteMouseDown(g *gocui.Gui, v *gocui.View) error

func PrintErrorf

func PrintErrorf(format string, a ...interface{})

func Printf

func Printf(format string, a ...interface{})

func ProcessOnClickHotspot

func ProcessOnClickHotspot(v *gocui.View, hs *gocui.Hotspot)

func ProcessOnOverHotspot

func ProcessOnOverHotspot(v *gocui.View, hs *gocui.Hotspot)

func ResetColors

func ResetColors()

func SetKeybindings

func SetKeybindings() error

func SetTheme

func SetTheme(theme string)

func ShowPane

func ShowPane(p Pane)

func StakingLoop

func StakingLoop()

func StatusLoop

func StatusLoop()

func TokenLoop

func TokenLoop()

Types

type ACOption

type ACOption struct {
	Name   string
	Result string
}

type AppPane

type AppPane struct {
	PaneDescriptor
	On bool
}
var App AppPane = AppPane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               45,
		MinHeight:              1,
		MaxHeight:              20,
		SupportCachedHightCalc: true,
	},
}

func (*AppPane) EstimateLines

func (p *AppPane) EstimateLines(w int) int

func (*AppPane) GetDesc

func (p *AppPane) GetDesc() *PaneDescriptor

func (*AppPane) IsOn

func (p *AppPane) IsOn() bool

func (*AppPane) SetOn

func (p *AppPane) SetOn(on bool)

func (*AppPane) SetView

func (p *AppPane) SetView(x0, y0, x1, y1 int, overlap byte)

type AuxPane

type AuxPane struct {
	PaneDescriptor
	On       bool
	Id       int
	Title    string
	ViewName string
}

func NewAuxPane

func NewAuxPane(title, template string) *AuxPane

func (*AuxPane) EstimateLines

func (p *AuxPane) EstimateLines(w int) int

func (*AuxPane) GetDesc

func (p *AuxPane) GetDesc() *PaneDescriptor

func (*AuxPane) IsOn

func (p *AuxPane) IsOn() bool

func (*AuxPane) SetOn

func (p *AuxPane) SetOn(on bool)

func (*AuxPane) SetView

func (p *AuxPane) SetView(x0, y0, x1, y1 int, overlap byte)

type BottomPane

type BottomPane struct {
	*gocui.View
	MinWidth  int
	MinHeight int
}
var Bottom *BottomPane = &BottomPane{
	MinWidth:  0,
	MinHeight: 1,
}

func (*BottomPane) Printf

func (p *BottomPane) Printf(format string, args ...interface{})

func (*BottomPane) SetView

func (p *BottomPane) SetView(g *gocui.Gui)

type HailPaneType

type HailPaneType struct {
	PaneDescriptor
	On bool
}
var HailPane HailPaneType = HailPaneType{
	PaneDescriptor: PaneDescriptor{
		MinWidth:  50,
		MinHeight: 1,

		SupportCachedHightCalc: false,
		// contains filtered or unexported fields
	},
}

func (*HailPaneType) EstimateLines

func (p *HailPaneType) EstimateLines(w int) int

func (*HailPaneType) GetDesc

func (p *HailPaneType) GetDesc() *PaneDescriptor

func (*HailPaneType) IsOn

func (p *HailPaneType) IsOn() bool

func (*HailPaneType) SetOn

func (p *HailPaneType) SetOn(on bool)

func (*HailPaneType) SetView

func (p *HailPaneType) SetView(x0, y0, x1, y1 int, overlap byte)

func (*HailPaneType) UpdateSubtitle

func (p *HailPaneType) UpdateSubtitle(left_map map[int]time.Duration)

type LP_V2Pane

type LP_V2Pane struct {
	PaneDescriptor
	On bool
}
var LP_V2 LP_V2Pane = LP_V2Pane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               90,
		MinHeight:              2,
		MaxHeight:              30,
		SupportCachedHightCalc: true,
	},
}

func (*LP_V2Pane) EstimateLines

func (p *LP_V2Pane) EstimateLines(w int) int

func (*LP_V2Pane) GetDesc

func (p *LP_V2Pane) GetDesc() *PaneDescriptor

func (*LP_V2Pane) IsOn

func (p *LP_V2Pane) IsOn() bool

func (*LP_V2Pane) SetOn

func (p *LP_V2Pane) SetOn(on bool)

func (*LP_V2Pane) SetView

func (p *LP_V2Pane) SetView(x0, y0, x1, y1 int, overlap byte)

type LP_V3Pane

type LP_V3Pane struct {
	PaneDescriptor
	On bool
}
var LP_V3 LP_V3Pane = LP_V3Pane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               90,
		MinHeight:              2,
		MaxHeight:              30,
		SupportCachedHightCalc: true,
	},
}

func (*LP_V3Pane) EstimateLines

func (p *LP_V3Pane) EstimateLines(w int) int

func (*LP_V3Pane) GetDesc

func (p *LP_V3Pane) GetDesc() *PaneDescriptor

func (*LP_V3Pane) IsOn

func (p *LP_V3Pane) IsOn() bool

func (*LP_V3Pane) SetOn

func (p *LP_V3Pane) SetOn(on bool)

func (*LP_V3Pane) SetView

func (p *LP_V3Pane) SetView(x0, y0, x1, y1 int, overlap byte)

type LP_V4Pane

type LP_V4Pane struct {
	PaneDescriptor
	On bool
}
var LP_V4 LP_V4Pane = LP_V4Pane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               90,
		MinHeight:              2,
		MaxHeight:              30,
		SupportCachedHightCalc: true,
	},
}

func (*LP_V4Pane) EstimateLines

func (p *LP_V4Pane) EstimateLines(w int) int

func (*LP_V4Pane) GetDesc

func (p *LP_V4Pane) GetDesc() *PaneDescriptor

func (*LP_V4Pane) IsOn

func (p *LP_V4Pane) IsOn() bool

func (*LP_V4Pane) SetOn

func (p *LP_V4Pane) SetOn(on bool)

func (*LP_V4Pane) SetView

func (p *LP_V4Pane) SetView(x0, y0, x1, y1 int, overlap byte)

type NotificationPane

type NotificationPane struct {
	*gocui.View
	On      bool
	Message string
	Error   bool
}
var Notification *NotificationPane = &NotificationPane{}

func (*NotificationPane) Hide

func (n *NotificationPane) Hide()

func (*NotificationPane) SetView

func (p *NotificationPane) SetView(g *gocui.Gui)

func (*NotificationPane) Show

func (n *NotificationPane) Show(text string)

func (*NotificationPane) ShowError

func (n *NotificationPane) ShowError(text string)

func (*NotificationPane) ShowErrorf

func (n *NotificationPane) ShowErrorf(format string, args ...interface{})

func (*NotificationPane) ShowEx

func (n *NotificationPane) ShowEx(text string, err_flag bool)

func (*NotificationPane) Showf

func (n *NotificationPane) Showf(format string, args ...interface{})

type Orientation

type Orientation int
const (
	FlowHorizontal Orientation = iota
	FlowVertical
)

type Pane

type Pane interface {
	SetView(int, int, int, int, byte)
	GetDesc() *PaneDescriptor
	EstimateLines(int) int
	IsOn() bool
	SetOn(bool)
}

type PaneDescriptor

type PaneDescriptor struct {
	MinWidth  int
	MinHeight int
	MaxHeight int
	MaxWidth  int

	View                   *gocui.View
	SupportCachedHightCalc bool
	// contains filtered or unexported fields
}

func (*PaneDescriptor) GetTemplate

func (d *PaneDescriptor) GetTemplate() string

func (*PaneDescriptor) SetTemplate

func (d *PaneDescriptor) SetTemplate(t string)

type PaneFlow

type PaneFlow struct {
	PaneDescriptor
	Orientation Orientation
	Panes       []Pane
}

func NewFlow

func NewFlow(o Orientation, panes []Pane, descr *PaneDescriptor) *PaneFlow

func (*PaneFlow) AddPane

func (p *PaneFlow) AddPane(pane Pane)

func (*PaneFlow) EstimateLines

func (p *PaneFlow) EstimateLines(w int) int

func (*PaneFlow) GetDesc

func (p *PaneFlow) GetDesc() *PaneDescriptor

func (*PaneFlow) IsOn

func (p *PaneFlow) IsOn() bool

func (*PaneFlow) RemovePane

func (p *PaneFlow) RemovePane(pane Pane)

func (*PaneFlow) SetOn

func (p *PaneFlow) SetOn(on bool)

func (*PaneFlow) SetView

func (p *PaneFlow) SetView(x0, y0, x1, y1 int, overlap byte)

type StakingPane

type StakingPane struct {
	PaneDescriptor
	On bool
}
var Staking StakingPane = StakingPane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               80,
		MinHeight:              2,
		MaxHeight:              20,
		SupportCachedHightCalc: true,
	},
}

func (*StakingPane) EstimateLines

func (p *StakingPane) EstimateLines(w int) int

func (*StakingPane) GetDesc

func (p *StakingPane) GetDesc() *PaneDescriptor

func (*StakingPane) IsOn

func (p *StakingPane) IsOn() bool

func (*StakingPane) SetOn

func (p *StakingPane) SetOn(on bool)

func (*StakingPane) SetView

func (p *StakingPane) SetView(x0, y0, x1, y1 int, overlap byte)

type StatusPane

type StatusPane struct {
	PaneDescriptor
	On bool
}
var Status StatusPane = StatusPane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               45,
		MinHeight:              1,
		SupportCachedHightCalc: true,
	},
}

func (*StatusPane) EstimateLines

func (p *StatusPane) EstimateLines(w int) int

func (*StatusPane) GetDesc

func (p *StatusPane) GetDesc() *PaneDescriptor

func (*StatusPane) IsOn

func (p *StatusPane) IsOn() bool

func (*StatusPane) SetOn

func (p *StatusPane) SetOn(on bool)

func (*StatusPane) SetView

func (p *StatusPane) SetView(x0, y0, x1, y1 int, overlap byte)

type TerminalPane

type TerminalPane struct {
	PaneDescriptor
	Screen           *gocui.View
	Input            *gocui.View
	Prefix           *gocui.View
	AutoComplete     *gocui.View
	AutoCompleteOn   bool
	ACOptions        *[]ACOption // autocomplete options
	ACTitle          string      //autocomplete title
	ACHighlite       string      //autocomplete highlite
	CommandPrefix    string
	FormattedPrefix  string
	AutoCompleteFunc func(string) (string, *[]ACOption, string)
	History          []string
	On               bool
}
var Terminal TerminalPane = TerminalPane{
	CommandPrefix:  DEFAULT_COMMAND_PREFIX,
	History:        []string{},
	ACOptions:      &[]ACOption{},
	AutoCompleteOn: false,
	On:             true,
	PaneDescriptor: PaneDescriptor{
		MinWidth:               10000,
		MinHeight:              1,
		SupportCachedHightCalc: false,
	},
}

func (*TerminalPane) EstimateLines

func (p *TerminalPane) EstimateLines(w int) int

func (*TerminalPane) GetDesc

func (p *TerminalPane) GetDesc() *PaneDescriptor

func (*TerminalPane) HideAutocomplete

func (p *TerminalPane) HideAutocomplete()

func (*TerminalPane) IsOn

func (p *TerminalPane) IsOn() bool

func (*TerminalPane) SetCommandPrefix

func (t *TerminalPane) SetCommandPrefix(prefix string)

func (*TerminalPane) SetInputView

func (p *TerminalPane) SetInputView(x0, y0, x1, y1 int)

func (*TerminalPane) SetOn

func (p *TerminalPane) SetOn(on bool)

func (*TerminalPane) SetPrefixView

func (p *TerminalPane) SetPrefixView(x0, y0, x1, y1 int)

func (*TerminalPane) SetScreenView

func (p *TerminalPane) SetScreenView(x0, y0, x1, y1 int)

func (*TerminalPane) SetView

func (p *TerminalPane) SetView(x0, y0, x1, y1 int, overlap byte)

func (*TerminalPane) ShowAutocomplete

func (t *TerminalPane) ShowAutocomplete(title string, options *[]ACOption, highlite string)

type ThemeStruct

type ThemeStruct struct {
	Name string

	BgColor, FgColor, FrameColor          gocui.Attribute
	SelBgColor, SelFgColor, SelFrameColor gocui.Attribute

	ActionBgColor, ActionFgColor, ActionSelBgColor, ActionSelFgColor gocui.Attribute

	ErrorFgColor gocui.Attribute
	EmFgColor    gocui.Attribute
	InputBgColor gocui.Attribute

	HelpFgColor, HelpBgColor gocui.Attribute
}
var Theme *ThemeStruct

type TokenPane

type TokenPane struct {
	PaneDescriptor
	On bool
}
var Token TokenPane = TokenPane{
	PaneDescriptor: PaneDescriptor{
		MinWidth:               80,
		MinHeight:              2,
		MaxHeight:              30,
		SupportCachedHightCalc: true,
	},
}

func (*TokenPane) EstimateLines

func (p *TokenPane) EstimateLines(w int) int

func (*TokenPane) GetDesc

func (p *TokenPane) GetDesc() *PaneDescriptor

func (*TokenPane) IsOn

func (p *TokenPane) IsOn() bool

func (*TokenPane) SetOn

func (p *TokenPane) SetOn(on bool)

func (*TokenPane) SetView

func (p *TokenPane) SetView(x0, y0, x1, y1 int, overlap byte)

Jump to

Keyboard shortcuts

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