tree

package module
v0.22.51 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: BSD-3-Clause Imports: 21 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_toolkitConfig_proto protoreflect.FileDescriptor
View Source
var TREE *log.LogFlag
View Source
var TREEWARN *log.LogFlag

Functions

func ListWidgets added in v0.20.2

func ListWidgets()

func MakeDatestamp added in v0.22.25

func MakeDatestamp(t time.Time) string

TODO; let the user choose the date format

func ShowButtons added in v0.20.2

func ShowButtons()

Types

type Node

type Node struct {
	Parent *Node

	WidgetId   int // widget ID
	WidgetType widget.WidgetType
	ParentId   int // parent ID

	State widget.State

	// the internal plugin toolkit structure
	// in the gtk plugin, it has gtk things like margin & border settings
	// in the text console one, it has text console things like colors for menus & buttons
	TK any
	// contains filtered or unexported fields
}

func FindWidgetById added in v0.22.29

func FindWidgetById(id int) *Node

func FindWidgetId added in v0.20.2

func FindWidgetId(id int) *Node

searches the binary tree for a WidgetId

func (*Node) Bool

func (n *Node) Bool() bool

func (*Node) CurrentS added in v0.20.1

func (n *Node) CurrentS() string

func (*Node) DumpWidget

func (n *Node) DumpWidget(pad string)

func (*Node) FindWidgetId

func (n *Node) FindWidgetId(id int) *Node

searches the binary tree for a WidgetId

func (*Node) GetLabel

func (n *Node) GetLabel() string

func (*Node) GetProgName

func (n *Node) GetProgName() string

func (*Node) Hidden added in v0.20.0

func (n *Node) Hidden() bool

func (*Node) InTable added in v0.22.29

func (n *Node) InTable() bool

returns true if widget is in a table

func (*Node) IsEnabled added in v0.22.8

func (n *Node) IsEnabled() bool

func (*Node) Json

func (n *Node) Json() []string

func (*Node) ListWidgets

func (n *Node) ListWidgets()

func (*Node) ProgName added in v0.20.0

func (n *Node) ProgName() string

func (*Node) SetCurrentS added in v0.20.0

func (n *Node) SetCurrentS(s string)

func (*Node) ShowButtons

func (n *Node) ShowButtons()

func (*Node) String

func (n *Node) String() string

func (*Node) Strings

func (n *Node) Strings() []string

func (*Node) VerifyParentId added in v0.22.22

func (me *Node) VerifyParentId() bool

used for debugging the 'gui' package to make sure things are valid fixes any errors along the way

type ToolkitConfig added in v0.22.7

type ToolkitConfig struct {
	Plugin string `protobuf:"bytes,1,opt,name=plugin,proto3" json:"plugin,omitempty"` // 'gocui', 'andlabs', etc `autogenpb:unique`
	Name   string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`     // variable name 'fullscreen' `autogenpb:unique`
	Value  string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`   // value "true"
	// contains filtered or unexported fields
}

func (*ToolkitConfig) Descriptor deprecated added in v0.22.7

func (*ToolkitConfig) Descriptor() ([]byte, []int)

Deprecated: Use ToolkitConfig.ProtoReflect.Descriptor instead.

func (*ToolkitConfig) GetName added in v0.22.7

func (x *ToolkitConfig) GetName() string

func (*ToolkitConfig) GetPlugin added in v0.22.7

func (x *ToolkitConfig) GetPlugin() string

func (*ToolkitConfig) GetValue added in v0.22.7

func (x *ToolkitConfig) GetValue() string

func (*ToolkitConfig) ProtoMessage added in v0.22.7

func (*ToolkitConfig) ProtoMessage()

func (*ToolkitConfig) ProtoReflect added in v0.22.7

func (x *ToolkitConfig) ProtoReflect() protoreflect.Message

func (*ToolkitConfig) Reset added in v0.22.7

func (x *ToolkitConfig) Reset()

func (*ToolkitConfig) String added in v0.22.7

func (x *ToolkitConfig) String() string

type ToolkitConfigScanner added in v0.22.36

type ToolkitConfigScanner struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*ToolkitConfigScanner) Next added in v0.22.36

func (it *ToolkitConfigScanner) Next() *ToolkitConfig

Next() returns the next thing in the array

func (*ToolkitConfigScanner) Scan added in v0.22.36

func (it *ToolkitConfigScanner) Scan() bool

type ToolkitConfigs added in v0.22.7

type ToolkitConfigs struct {
	Uuid           string           `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`       // `autogenpb:uuid:d7886d47-a3b9-43b9-b0f6-17074a9844e6`
	Version        string           `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1`
	ToolkitConfigs []*ToolkitConfig `protobuf:"bytes,3,rep,name=ToolkitConfigs,proto3" json:"ToolkitConfigs,omitempty"`
	Filename       string           `protobuf:"bytes,4,opt,name=filename,proto3" json:"filename,omitempty"` // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save()
	// contains filtered or unexported fields
}

func NewToolkitConfigs added in v0.22.7

func NewToolkitConfigs() *ToolkitConfigs

func (*ToolkitConfigs) All added in v0.22.7

func (*ToolkitConfigs) Append added in v0.22.7

func (x *ToolkitConfigs) Append(y *ToolkitConfig)

a Append() shortcut (that does Clone() with a mutex) notsure if it really works doesn't allow nil

func (*ToolkitConfigs) AppendByName added in v0.22.36

func (x *ToolkitConfigs) AppendByName(y *ToolkitConfig) bool

func (*ToolkitConfigs) AppendByPlugin added in v0.22.36

func (x *ToolkitConfigs) AppendByPlugin(y *ToolkitConfig) bool

func (*ToolkitConfigs) Clone added in v0.22.43

a Clone() shortcut (with a mutex). notsure if it really works

func (*ToolkitConfigs) CloneByName added in v0.22.43

func (x *ToolkitConfigs) CloneByName(y *ToolkitConfig) bool

func (*ToolkitConfigs) CloneByPlugin added in v0.22.43

func (x *ToolkitConfigs) CloneByPlugin(y *ToolkitConfig) bool

func (*ToolkitConfigs) Delete added in v0.22.7

func (x *ToolkitConfigs) Delete(y *ToolkitConfig) bool

func (*ToolkitConfigs) DeleteByName added in v0.22.36

func (x *ToolkitConfigs) DeleteByName(s string) bool

func (*ToolkitConfigs) DeleteByPlugin added in v0.22.36

func (x *ToolkitConfigs) DeleteByPlugin(s string) bool

func (*ToolkitConfigs) Descriptor deprecated added in v0.22.7

func (*ToolkitConfigs) Descriptor() ([]byte, []int)

Deprecated: Use ToolkitConfigs.ProtoReflect.Descriptor instead.

func (*ToolkitConfigs) FindByName added in v0.22.36

func (x *ToolkitConfigs) FindByName(s string) *ToolkitConfig

lookup a ToolkitConfigs by the Name

func (*ToolkitConfigs) FindByPlugin added in v0.22.36

func (x *ToolkitConfigs) FindByPlugin(s string) *ToolkitConfig

lookup a ToolkitConfigs by the Plugin

func (*ToolkitConfigs) FormatJSON added in v0.22.7

func (v *ToolkitConfigs) FormatJSON() string

human readable JSON

func (*ToolkitConfigs) FormatTEXT added in v0.22.7

func (v *ToolkitConfigs) FormatTEXT() string

apparently this isn't stable, but it's awesomely better https://protobuf.dev/reference/go/faq/#unstable-text it's brilliant for config files!

func (*ToolkitConfigs) GetFilename added in v0.22.47

func (x *ToolkitConfigs) GetFilename() string

func (*ToolkitConfigs) GetToolkitConfigs added in v0.22.7

func (x *ToolkitConfigs) GetToolkitConfigs() []*ToolkitConfig

func (*ToolkitConfigs) GetUuid added in v0.22.7

func (x *ToolkitConfigs) GetUuid() string

func (*ToolkitConfigs) GetVersion added in v0.22.7

func (x *ToolkitConfigs) GetVersion() string

func (*ToolkitConfigs) InsertByName added in v0.22.36

func (x *ToolkitConfigs) InsertByName(y string) *ToolkitConfig

returns a ToolkitConfig if Name matches, otherwise create

func (*ToolkitConfigs) InsertByPlugin added in v0.22.36

func (x *ToolkitConfigs) InsertByPlugin(y string) *ToolkitConfig

returns a ToolkitConfig if Plugin matches, otherwise create

func (*ToolkitConfigs) IterAll added in v0.22.26

func (x *ToolkitConfigs) IterAll() iter.Seq[*ToolkitConfig]

Iterate 'for x := range' syntax using the awesome golang 1.24 'iter'

func (*ToolkitConfigs) Len added in v0.22.7

func (x *ToolkitConfigs) Len() int

func (*ToolkitConfigs) Load added in v0.22.47

func (pb *ToolkitConfigs) Load() error

func (*ToolkitConfigs) Marshal added in v0.22.7

func (v *ToolkitConfigs) Marshal() ([]byte, error)

marshal to wire. This is called winning.

func (*ToolkitConfigs) MarshalJSON added in v0.22.7

func (v *ToolkitConfigs) MarshalJSON() ([]byte, error)

marshal json

func (*ToolkitConfigs) ProtoMessage added in v0.22.7

func (*ToolkitConfigs) ProtoMessage()

func (*ToolkitConfigs) ProtoReflect added in v0.22.7

func (x *ToolkitConfigs) ProtoReflect() protoreflect.Message

func (*ToolkitConfigs) Reset added in v0.22.7

func (x *ToolkitConfigs) Reset()

func (*ToolkitConfigs) Save added in v0.22.47

func (pb *ToolkitConfigs) Save() error

func (*ToolkitConfigs) String added in v0.22.7

func (x *ToolkitConfigs) String() string

func (*ToolkitConfigs) Unmarshal added in v0.22.7

func (v *ToolkitConfigs) Unmarshal(data []byte) error

unmarshal from wire. You have won.

func (*ToolkitConfigs) UnmarshalJSON added in v0.22.7

func (v *ToolkitConfigs) UnmarshalJSON(data []byte) error

unmarshal json

func (*ToolkitConfigs) UnmarshalTEXT added in v0.22.7

func (v *ToolkitConfigs) UnmarshalTEXT(data []byte) error

unmarshalTEXT. This reads the .text config file back in after the user edits it

type ToolkitConfigsScanner added in v0.22.36

type ToolkitConfigsScanner struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*ToolkitConfigsScanner) Next added in v0.22.36

Next() returns the next thing in the array

func (*ToolkitConfigsScanner) Scan added in v0.22.36

func (it *ToolkitConfigsScanner) Scan() bool

type TreeInfo

type TreeInfo struct {
	sync.Mutex // a lock around the tree to serialize access

	PluginName string // used to identify the plugin

	Add          func(*Node)         // add a new widget
	AddText      func(*Node, string) // add a string to a dropdown widget
	SetText      func(*Node, string) // set the text of a widget
	SetTitle     func(*Node, string) // update the title of a window or tab
	SetLabel     func(*Node, string) // update the "label" (aka "Name") for a widget
	SetChecked   func(*Node, bool)   // set the state of a checkbox
	ToolkitInit  func()              // init the plugin
	ToolkitClose func()              // shutdown and unload the plugin
	Show         func(*Node)         // show a widget
	Hide         func(*Node)         // hide a widget
	Enable       func(*Node)         // enable a widget
	Disable      func(*Node)         // disable a widget
	ShowTable    func(*guipb.Table)  // attempt at sending a whole table
	// contains filtered or unexported fields
}

func New

func New() *TreeInfo

func (*TreeInfo) AddNode

func (me *TreeInfo) AddNode(a *widget.Action) *Node

func (*TreeInfo) Callback

func (me *TreeInfo) Callback(guiCallback chan widget.Action)

Other goroutines must use this to access the GUI

You can not acess / process the GUI thread directly from other goroutines. This is due to the nature of how Linux, MacOS and Windows work (they all work differently. suprise. surprise.)

this sets the channel to send user events back from the plugin

func (*TreeInfo) ConfigFind added in v0.22.7

func (t *TreeInfo) ConfigFind(n string) (string, error)

func (*TreeInfo) ConfigSave added in v0.22.29

func (t *TreeInfo) ConfigSave(newopt *ToolkitConfig)

func (*TreeInfo) DeleteNode added in v0.22.22

func (me *TreeInfo) DeleteNode(n *Node)

func (*TreeInfo) FrozenChannel added in v0.22.20

func (me *TreeInfo) FrozenChannel() chan widget.Action

this is the function that receives things from the application

func (*TreeInfo) InitOK added in v0.22.9

func (me *TreeInfo) InitOK()

func (*TreeInfo) PluginChannel

func (me *TreeInfo) PluginChannel() chan widget.Action

this is the function that receives things from the application

func (*TreeInfo) SendEnableDebugger

func (me *TreeInfo) SendEnableDebugger()

func (*TreeInfo) SendFromUser added in v0.19.2

func (me *TreeInfo) SendFromUser(n *Node)

func (*TreeInfo) SendToolkitLoad

func (me *TreeInfo) SendToolkitLoad(s string)

func (*TreeInfo) SendToolkitPanic

func (me *TreeInfo) SendToolkitPanic()

func (*TreeInfo) SendUserEvent

func (me *TreeInfo) SendUserEvent(n *Node)

Other goroutines must use this to access the GUI

func (*TreeInfo) SendWidgetEvent added in v0.19.2

func (me *TreeInfo) SendWidgetEvent(n *Node)

The user clicked on something. Or typed something

func (*TreeInfo) SendWindowCloseEvent

func (me *TreeInfo) SendWindowCloseEvent(n *Node)

func (*TreeInfo) WaitOK added in v0.22.9

func (me *TreeInfo) WaitOK()

this hack is to wait for the application to send something before trying to do anything. todo: rethink this someday

type TreeTable added in v0.22.11

type TreeTable struct {
	PB *guipb.Table
}

Jump to

Keyboard shortcuts

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