Documentation ¶
Index ¶
- Constants
- Variables
- func BlameDialog(ctx gi.Widget, fname string, blame, fbytes []byte) *texteditor.TwinEditors
- func FileAtRevDialog(ctx gi.Widget, repo vci.Repo, file, rev string) *gi.Body
- func IsVersCtrlSystem(str string) bool
- func NodeNameCountSort(ecs []NodeNameCount)
- func OSOpenCommand() string
- func VCSLabelFunc(fn *Node, label string) string
- func VCSLogViewDialog(ctx gi.Widget, repo vci.Repo, lg vci.Log, file, since string) *gi.Body
- type DirFlagMap
- func (dm *DirFlagMap) ClearMarks()
- func (dm *DirFlagMap) DeleteStale()
- func (dm *DirFlagMap) Init()
- func (dm *DirFlagMap) IsOpen(path string) bool
- func (dm *DirFlagMap) SetMark(path string)
- func (dm *DirFlagMap) SetOpen(path string, open bool)
- func (dm *DirFlagMap) SetSortBy(path string, modTime bool)
- func (dm *DirFlagMap) SortByModTime(path string) bool
- func (dm *DirFlagMap) SortByName(path string) bool
- type DirFlags
- func (i DirFlags) BitIndexString() string
- func (i DirFlags) Desc() string
- func (i DirFlags) HasFlag(f enums.BitFlag) bool
- func (i DirFlags) Int64() int64
- func (i DirFlags) IsValid() bool
- func (i DirFlags) MarshalText() ([]byte, error)
- func (i *DirFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *DirFlags) SetInt64(in int64)
- func (i *DirFlags) SetString(s string) error
- func (i *DirFlags) SetStringOr(s string) error
- func (i DirFlags) String() string
- func (i *DirFlags) UnmarshalText(text []byte) error
- func (i DirFlags) Values() []enums.Enum
- type Node
- func (fn *Node) AddToVcs()
- func (fn *Node) AddToVcsSel()
- func (t *Node) AsNode() *Node
- func (fn *Node) BaseType() *gti.Type
- func (fn *Node) BlameVcs() ([]byte, error)
- func (fn *Node) BlameVcsSel()
- func (fn *Node) CloseAll()
- func (fn *Node) CloseBuf() bool
- func (fn *Node) CloseDir()
- func (fn *Node) CommitToVcs(message string) (err error)
- func (fn *Node) CommitToVcsSel()
- func (fn *Node) ConfigOfFiles(path string) ki.Config
- func (fn *Node) ContextMenu(m *gi.Scene)
- func (fn *Node) CopyFileToDir(filename string, perm os.FileMode)
- func (fn *Node) DeleteFile() (err error)
- func (fn *Node) DeleteFiles()
- func (fn *Node) DeleteFilesImpl()
- func (fn *Node) DeleteFromVcs()
- func (fn *Node) DeleteFromVcsSel()
- func (fn *Node) DetectVcsRepo(updateFiles bool) bool
- func (fn *Node) DiffVcs(rev_a, rev_b string) error
- func (fn *Node) DiffVcsSel(rev_a string, rev_b string)
- func (fn *Node) DirsTo(path string) (*Node, error)
- func (fn *Node) DuplicateFile() error
- func (fn *Node) DuplicateFiles()
- func (fn *Node) FileExtCounts(cat fi.Cat) []NodeNameCount
- func (fn *Node) FileNodeContextMenu(m *gi.Scene)
- func (fn *Node) FileNodeStyles()
- func (fn *Node) FilesMatching(match string, ignoreCase bool) []*Node
- func (fn *Node) FindDirNode(path string) (*Node, error)
- func (fn *Node) FindFile(fnm string) (*Node, bool)
- func (fn *Node) FirstVCS() (vci.Repo, *Node)
- func (fn *Node) FlagType() enums.BitFlagSetter
- func (fn *Node) HandleFileNodeEvents()
- func (fn *Node) HasClosedParent() bool
- func (fn *Node) InitFileInfo() error
- func (fn *Node) IsAutoSave() bool
- func (fn *Node) IsChanged() bool
- func (fn *Node) IsDir() bool
- func (fn *Node) IsExec() bool
- func (fn *Node) IsExternal() bool
- func (fn *Node) IsIrregular() bool
- func (fn *Node) IsNotSaved() bool
- func (fn *Node) IsOpen() bool
- func (fn *Node) IsSymLink() bool
- func (fn *Node) KeyInput(kt events.Event)
- func (t *Node) KiType() *gti.Type
- func (fn *Node) LatestFileMod(cat fi.Cat) time.Time
- func (fn *Node) LogVcs(allFiles bool, since string) (vci.Log, error)
- func (fn *Node) LogVcsSel(allFiles bool, since string)
- func (fn *Node) MyRelPath() string
- func (t *Node) New() ki.Ki
- func (fn *Node) NewFile(filename string, addToVcs bool)
- func (fn *Node) NewFiles(filename string, addToVcs bool)
- func (fn *Node) NewFolder(foldername string)
- func (fn *Node) NewFolders(foldername string)
- func (fn *Node) OnClose()
- func (fn *Node) OnInit()
- func (fn *Node) OnOpen()
- func (fn *Node) OpenAll()
- func (fn *Node) OpenBuf() (bool, error)
- func (fn *Node) OpenDir()
- func (fn *Node) OpenDirs()
- func (fn *Node) OpenEmptyDir() bool
- func (fn *Node) OpenFileDefault() error
- func (fn *Node) OpenFileWith(command string) error
- func (fn *Node) OpenFilesDefault()
- func (fn *Node) OpenFilesWith()
- func (fn *Node) ReadDir(path string) error
- func (fn *Node) RelPath(fpath gi.FileName) string
- func (fn *Node) RemoveFromExterns()
- func (fn *Node) RenameFile(newpath string) (err error)
- func (fn *Node) RenameFiles()
- func (fn *Node) Repo() (vci.Repo, *Node)
- func (fn *Node) RevertVcs() (err error)
- func (fn *Node) RevertVcsSel()
- func (t *Node) SetClass(v string) *Node
- func (t *Node) SetCustomContextMenu(v func(m *gi.Scene)) *Node
- func (fn *Node) SetFileIcon()
- func (t *Node) SetIcon(v icons.Icon) *Node
- func (t *Node) SetIndent(v units.Value) *Node
- func (fn *Node) SetNodePath(path string) error
- func (t *Node) SetOpenDepth(v int) *Node
- func (t *Node) SetPriorityEvents(v []events.Types) *Node
- func (t *Node) SetRootView(v *giv.TreeView) *Node
- func (t *Node) SetSelectedNodes(v []giv.TreeViewer) *Node
- func (t *Node) SetText(v string) *Node
- func (t *Node) SetTooltip(v string) *Node
- func (t *Node) SetViewIdx(v int) *Node
- func (t *Node) SetWidgetSize(v mat32.Vec2) *Node
- func (fn *Node) ShowFileInfo()
- func (fn *Node) SortBy(modTime bool)
- func (fn *Node) SortBys(modTime bool)
- func (fn *Node) SortConfigByModTime(confg ki.Config)
- func (fn *Node) UpdateAllVcs()
- func (fn *Node) UpdateBranchIcons()
- func (fn *Node) UpdateDir()
- func (fn *Node) UpdateNode() error
- func (fn *Node) UpdateRepoFiles()
- type NodeEmbedder
- type NodeFlags
- func (i NodeFlags) BitIndexString() string
- func (i NodeFlags) Desc() string
- func (i NodeFlags) HasFlag(f enums.BitFlag) bool
- func (i NodeFlags) Int64() int64
- func (i NodeFlags) IsValid() bool
- func (i NodeFlags) MarshalText() ([]byte, error)
- func (i *NodeFlags) SetFlag(on bool, f ...enums.BitFlag)
- func (i *NodeFlags) SetInt64(in int64)
- func (i *NodeFlags) SetString(s string) error
- func (i *NodeFlags) SetStringOr(s string) error
- func (i NodeFlags) String() string
- func (i *NodeFlags) UnmarshalText(text []byte) error
- func (i NodeFlags) Values() []enums.Enum
- type NodeNameCount
- type Tree
- func (ft *Tree) AddExtFile(fpath string) (*Node, error)
- func (ft *Tree) ConfigWatcher() error
- func (ft *Tree) CopyFieldsFrom(frm any)
- func (fv *Tree) Destroy()
- func (ft *Tree) DirSortByModTime(fpath gi.FileName) bool
- func (ft *Tree) DirSortByName(fpath gi.FileName) bool
- func (ft *Tree) ExtNodeByPath(fpath string) (*Node, error)
- func (ft *Tree) HasExtFile(fpath string) (bool, int)
- func (ft *Tree) IsDirOpen(fpath gi.FileName) bool
- func (t *Tree) KiType() *gti.Type
- func (t *Tree) New() ki.Ki
- func (ft *Tree) OnInit()
- func (ft *Tree) OpenPath(path string)
- func (ft *Tree) RemoveExtFile(fpath string) bool
- func (t *Tree) SetClass(v string) *Tree
- func (t *Tree) SetCustomContextMenu(v func(m *gi.Scene)) *Tree
- func (ft *Tree) SetDirClosed(fpath gi.FileName)
- func (ft *Tree) SetDirOpen(fpath gi.FileName)
- func (ft *Tree) SetDirSortBy(fpath gi.FileName, modTime bool)
- func (t *Tree) SetDirs(v DirFlagMap) *Tree
- func (t *Tree) SetDirsOnTop(v bool) *Tree
- func (t *Tree) SetDoneWatcher(v chan bool) *Tree
- func (t *Tree) SetExtFiles(v []string) *Tree
- func (t *Tree) SetIcon(v icons.Icon) *Tree
- func (t *Tree) SetInOpenAll(v bool) *Tree
- func (t *Tree) SetIndent(v units.Value) *Tree
- func (t *Tree) SetLastWatchTime(v time.Time) *Tree
- func (t *Tree) SetLastWatchUpdt(v string) *Tree
- func (t *Tree) SetNodeType(v *gti.Type) *Tree
- func (t *Tree) SetOpenDepth(v int) *Tree
- func (t *Tree) SetPriorityEvents(v []events.Types) *Tree
- func (t *Tree) SetRootView(v *giv.TreeView) *Tree
- func (t *Tree) SetSelectedNodes(v []giv.TreeViewer) *Tree
- func (t *Tree) SetText(v string) *Tree
- func (t *Tree) SetTooltip(v string) *Tree
- func (t *Tree) SetUpdtMu(v sync.Mutex) *Tree
- func (t *Tree) SetViewIdx(v int) *Tree
- func (t *Tree) SetWatchedPaths(v map[string]bool) *Tree
- func (t *Tree) SetWatcher(v *fsnotify.Watcher) *Tree
- func (t *Tree) SetWidgetSize(v mat32.Vec2) *Tree
- func (ft *Tree) UnWatchPath(path gi.FileName)
- func (ft *Tree) UpdateAll()
- func (ft *Tree) UpdateExtFiles(efn *Node)
- func (ft *Tree) UpdateNewFile(filename string)
- func (ft *Tree) WatchPath(path gi.FileName) error
- func (ft *Tree) WatchUpdt(path string)
- func (ft *Tree) WatchWatcher()
- type VCSLogView
- func (lv *VCSLogView) ConfigRepo(repo vci.Repo, lg vci.Log, file, since string)
- func (lv *VCSLogView) ConfigToolbar()
- func (t *VCSLogView) KiType() *gti.Type
- func (t *VCSLogView) New() ki.Ki
- func (lv *VCSLogView) OnInit()
- func (t *VCSLogView) SetClass(v string) *VCSLogView
- func (t *VCSLogView) SetCustomContextMenu(v func(m *gi.Scene)) *VCSLogView
- func (t *VCSLogView) SetFile(v string) *VCSLogView
- func (t *VCSLogView) SetLog(v vci.Log) *VCSLogView
- func (t *VCSLogView) SetPriorityEvents(v []events.Types) *VCSLogView
- func (t *VCSLogView) SetRepo(v vci.Repo) *VCSLogView
- func (lv *VCSLogView) SetRevA(rev string)
- func (lv *VCSLogView) SetRevB(rev string)
- func (t *VCSLogView) SetSetA(v bool) *VCSLogView
- func (t *VCSLogView) SetSince(v string) *VCSLogView
- func (t *VCSLogView) SetStackTop(v int) *VCSLogView
- func (t *VCSLogView) SetTooltip(v string) *VCSLogView
- func (lv *VCSLogView) TableView() *giv.TableView
- func (lv *VCSLogView) ToggleRev()
- func (lv *VCSLogView) Toolbar() *gi.Toolbar
- type VersCtrlName
- type VersCtrlValue
Constants ¶
const (
// ExternalFilesName is the name of the node that represents external files
ExternalFilesName = "[external files]"
)
Variables ¶
var NodeHiStyle = histyle.StyleDefault
NodeHiStyle is the default style for syntax highlighting to use for file node buffers
var NodeType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/filetree.Node", ShortName: "filetree.Node", IDName: "node", Doc: "Node represents a file in the file system, as a TreeView node.\nThe name of the node is the name of the file.\nFolders have children containing further nodes.", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "embedder", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"FPath", >i.Field{Name: "FPath", Type: "goki.dev/gi/v2/gi.FileName", LocalType: "gi.FileName", Doc: "full path to this file", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\" json:\"-\" xml:\"-\" copy:\"-\""}}, {"Info", >i.Field{Name: "Info", Type: "goki.dev/pi/v2/fi.FileInfo", LocalType: "fi.FileInfo", Doc: "full standard file info about this file", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\" json:\"-\" xml:\"-\" copy:\"-\""}}, {"Buf", >i.Field{Name: "Buf", Type: "*goki.dev/gi/v2/texteditor.Buf", LocalType: "*texteditor.Buf", Doc: "file buffer for editing this file", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\" json:\"-\" xml:\"-\" copy:\"-\""}}, {"FRoot", >i.Field{Name: "FRoot", Type: "*goki.dev/gi/v2/filetree.Tree", LocalType: "*Tree", Doc: "root of the tree -- has global state", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\" json:\"-\" xml:\"-\" copy:\"-\""}}, {"DirRepo", >i.Field{Name: "DirRepo", Type: "goki.dev/vci/v2.Repo", LocalType: "vci.Repo", Doc: "version control system repository for this directory,\nonly non-nil if this is the highest-level directory in the tree under vcs control", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\" json:\"-\" xml:\"-\" copy:\"-\""}}, {"RepoFiles", >i.Field{Name: "RepoFiles", Type: "goki.dev/vci/v2.Files", LocalType: "vci.Files", Doc: "version control system repository file status -- only valid during ReadDir", Directives: gti.Directives{}, Tag: "edit:\"-\" set:\"-\" json:\"-\" xml:\"-\" copy:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"TreeView", >i.Field{Name: "TreeView", Type: "goki.dev/gi/v2/giv.TreeView", LocalType: "giv.TreeView", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{ {"OpenFilesDefault", >i.Method{Name: "OpenFilesDefault", Doc: "OpenFilesDefault opens selected files with default app for that file type (os defined).\nruns open on Mac, xdg-open on Linux, and start on Windows", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"DuplicateFiles", >i.Method{Name: "DuplicateFiles", Doc: "makes a copy of selected files", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"DeleteFiles", >i.Method{Name: "DeleteFiles", Doc: "deletes any selected files or directories. If any directory is selected,\nall files and subdirectories in that directory are also deleted.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"RenameFiles", >i.Method{Name: "RenameFiles", Doc: "renames any selected files", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"RenameFile", >i.Method{Name: "RenameFile", Doc: "RenameFile renames file to new name", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"newpath", >i.Field{Name: "newpath", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"err", >i.Field{Name: "err", Type: "error", LocalType: "error", Doc: "", Directives: gti.Directives{}, Tag: ""}}, })}}, {"NewFiles", >i.Method{Name: "NewFiles", Doc: "makes a new file in selected directory", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"filename", >i.Field{Name: "filename", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, {"addToVcs", >i.Field{Name: "addToVcs", Type: "bool", LocalType: "bool", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"NewFolders", >i.Method{Name: "NewFolders", Doc: "makes a new folder in the given selected directory", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"foldername", >i.Field{Name: "foldername", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"NewFolder", >i.Method{Name: "NewFolder", Doc: "NewFolder makes a new folder (directory) in this directory node", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"foldername", >i.Field{Name: "foldername", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"ShowFileInfo", >i.Method{Name: "ShowFileInfo", Doc: "Shows file information about selected file(s)", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"SortBys", >i.Method{Name: "SortBys", Doc: "SortBys determines how to sort the selected files in the directory.\nDefault is alpha by name, optionally can be sorted by modification time.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"modTime", >i.Field{Name: "modTime", Type: "bool", LocalType: "bool", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"OpenAll", >i.Method{Name: "OpenAll", Doc: "OpenAll opens all directories under this one", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"CloseAll", >i.Method{Name: "CloseAll", Doc: "CloseAll closes all directories under this one, this included", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"RemoveFromExterns", >i.Method{Name: "RemoveFromExterns", Doc: "RemoveFromExterns removes file from list of external files", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"AddToVcsSel", >i.Method{Name: "AddToVcsSel", Doc: "AddToVcsSel adds selected files to version control system", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"DeleteFromVcsSel", >i.Method{Name: "DeleteFromVcsSel", Doc: "DeleteFromVcsSel removes selected files from version control system", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"CommitToVcsSel", >i.Method{Name: "CommitToVcsSel", Doc: "CommitToVcsSel commits to version control system based on last selected file", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"RevertVcsSel", >i.Method{Name: "RevertVcsSel", Doc: "RevertVcsSel removes selected files from version control system", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"DiffVcsSel", >i.Method{Name: "DiffVcsSel", Doc: "DiffVcsSel shows the diffs between two versions of selected files, given by the\nrevision specifiers -- if empty, defaults to A = current HEAD, B = current WC file.\n-1, -2 etc also work as universal ways of specifying prior revisions.\nDiffs are shown in a DiffViewDialog.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"rev_a", >i.Field{Name: "rev_a", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, {"rev_b", >i.Field{Name: "rev_b", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"LogVcsSel", >i.Method{Name: "LogVcsSel", Doc: "LogVcsSel shows the VCS log of commits for selected files, optionally with a\nsince date qualifier: If since is non-empty, it should be\na date-like expression that the VCS will understand, such as\n1/1/2020, yesterday, last year, etc. SVN only understands a\nnumber as a maximum number of items to return.\nIf allFiles is true, then the log will show revisions for all files, not just\nthis one.\nReturns the Log and also shows it in a VCSLogView which supports further actions.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"allFiles", >i.Field{Name: "allFiles", Type: "bool", LocalType: "bool", Doc: "", Directives: gti.Directives{}, Tag: ""}}, {"since", >i.Field{Name: "since", Type: "string", LocalType: "string", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, {"BlameVcsSel", >i.Method{Name: "BlameVcsSel", Doc: "BlameVcsSel shows the VCS blame report for this file, reporting for each line\nthe revision and author of the last change.", Directives: gti.Directives{ >i.Directive{Tool: "gti", Directive: "add", Args: []string{}}, }, Args: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Returns: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{})}}, }), Instance: &Node{}, })
NodeType is the gti.Type for Node
var TreeType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/filetree.Tree", ShortName: "filetree.Tree", IDName: "tree", Doc: "Tree is the root of a tree representing files in a given directory\n(and subdirectories thereof), and has some overall management state for how to\nview things. The Tree can be viewed by a TreeView to provide a GUI\ninterface into it.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"ExtFiles", >i.Field{Name: "ExtFiles", Type: "[]string", LocalType: "[]string", Doc: "external files outside the root path of the tree -- abs paths are stored -- these are shown in the first sub-node if present -- use AddExtFile to add and update", Directives: gti.Directives{}, Tag: ""}}, {"Dirs", >i.Field{Name: "Dirs", Type: "goki.dev/gi/v2/filetree.DirFlagMap", LocalType: "DirFlagMap", Doc: "records state of directories within the tree (encoded using paths relative to root),\ne.g., open (have been opened by the user) -- can persist this to restore prior view of a tree", Directives: gti.Directives{}, Tag: ""}}, {"DirsOnTop", >i.Field{Name: "DirsOnTop", Type: "bool", LocalType: "bool", Doc: "if true, then all directories are placed at the top of the tree view\notherwise everything is mixed", Directives: gti.Directives{}, Tag: ""}}, {"NodeType", >i.Field{Name: "NodeType", Type: "*goki.dev/gti.Type", LocalType: "*gti.Type", Doc: "type of node to create -- defaults to giv.Node but can use custom node types", Directives: gti.Directives{}, Tag: "view:\"-\" json:\"-\" xml:\"-\""}}, {"InOpenAll", >i.Field{Name: "InOpenAll", Type: "bool", LocalType: "bool", Doc: "if true, we are in midst of an OpenAll call -- nodes should open all dirs", Directives: gti.Directives{}, Tag: ""}}, {"Watcher", >i.Field{Name: "Watcher", Type: "*gopkg.in/fsnotify.v1.Watcher", LocalType: "*fsnotify.Watcher", Doc: "change notify for all dirs", Directives: gti.Directives{}, Tag: "view:\"-\""}}, {"DoneWatcher", >i.Field{Name: "DoneWatcher", Type: "chan bool", LocalType: "chan bool", Doc: "channel to close watcher watcher", Directives: gti.Directives{}, Tag: "view:\"-\""}}, {"WatchedPaths", >i.Field{Name: "WatchedPaths", Type: "map[string]bool", LocalType: "map[string]bool", Doc: "map of paths that have been added to watcher -- only active if bool = true", Directives: gti.Directives{}, Tag: "view:\"-\""}}, {"LastWatchUpdt", >i.Field{Name: "LastWatchUpdt", Type: "string", LocalType: "string", Doc: "last path updated by watcher", Directives: gti.Directives{}, Tag: "view:\"-\""}}, {"LastWatchTime", >i.Field{Name: "LastWatchTime", Type: "time.Time", LocalType: "time.Time", Doc: "timestamp of last update", Directives: gti.Directives{}, Tag: "view:\"-\""}}, {"UpdtMu", >i.Field{Name: "UpdtMu", Type: "sync.Mutex", LocalType: "sync.Mutex", Doc: "Update mutex", Directives: gti.Directives{}, Tag: "view:\"-\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Node", >i.Field{Name: "Node", Type: "goki.dev/gi/v2/filetree.Node", LocalType: "Node", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Tree{}, })
TreeType is the gti.Type for Tree
var VCSLogViewType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/filetree.VCSLogView", ShortName: "filetree.VCSLogView", IDName: "vcs-log-view", Doc: "VCSLogView is a view of the VCS log data", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Log", >i.Field{Name: "Log", Type: "goki.dev/vci/v2.Log", LocalType: "vci.Log", Doc: "current log", Directives: gti.Directives{}, Tag: ""}}, {"File", >i.Field{Name: "File", Type: "string", LocalType: "string", Doc: "file that this is a log of -- if blank then it is entire repository", Directives: gti.Directives{}, Tag: ""}}, {"Since", >i.Field{Name: "Since", Type: "string", LocalType: "string", Doc: "date expression for how long ago to include log entries from", Directives: gti.Directives{}, Tag: ""}}, {"Repo", >i.Field{Name: "Repo", Type: "goki.dev/vci/v2.Repo", LocalType: "vci.Repo", Doc: "version control system repository", Directives: gti.Directives{}, Tag: "json:\"-\" xml:\"-\" copy:\"-\""}}, {"RevA", >i.Field{Name: "RevA", Type: "string", LocalType: "string", Doc: "revision A -- defaults to HEAD", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"RevB", >i.Field{Name: "RevB", Type: "string", LocalType: "string", Doc: "revision B -- blank means current working copy", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"SetA", >i.Field{Name: "SetA", Type: "bool", LocalType: "bool", Doc: "double-click will set the A revision -- else B", Directives: gti.Directives{}, Tag: ""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &VCSLogView{}, })
VCSLogViewType is the gti.Type for VCSLogView
var VersCtrlSystems = []string{"git", "svn", "bzr", "hg"}
VersCtrlSystems is a list of supported Version Control Systems. These must match the VCS Types from goki/pi/vci which in turn is based on masterminds/vcs
Functions ¶
func BlameDialog ¶
func BlameDialog(ctx gi.Widget, fname string, blame, fbytes []byte) *texteditor.TwinEditors
BlameDialog opens a dialog for displaying VCS blame data using textview.TwinViews. blame is the annotated blame code, while fbytes is the original file contents.
func FileAtRevDialog ¶
FileAtRevDialog Shows a file at a given revision in a new dialog window
func IsVersCtrlSystem ¶
IsVersCtrlSystem returns true if the given string matches one of the standard VersCtrlSystems -- uses lowercase version of str.
func NodeNameCountSort ¶
func NodeNameCountSort(ecs []NodeNameCount)
func OSOpenCommand ¶
func OSOpenCommand() string
OSOpenCommand returns the generic file 'open' command to open file with default app open on Mac, xdg-open on Linux, and start on Windows
func VCSLabelFunc ¶
VCSLabelFunc gets the appropriate label for removing from version control
Types ¶
type DirFlagMap ¶
type DirFlagMap struct { // map of paths and associated flags Map map[string]DirFlags // mutex for accessing map Mu sync.Mutex `view:"-" json:"-" xml:"-"` }
DirFlagMap is a map for encoding directories that are open in the file tree. The strings are typically relative paths. The bool value is used to mark active paths and inactive (unmarked) ones can be removed. Map access is protected by Mutex.
func (*DirFlagMap) ClearMarks ¶
func (dm *DirFlagMap) ClearMarks()
ClearMarks clears all the marks -- do this prior to traversing full set of active paths -- can then call DeleteStale to get rid of unused paths.
func (*DirFlagMap) DeleteStale ¶
func (dm *DirFlagMap) DeleteStale()
DeleteStale removes all entries with a bool = false value indicating that they have not been accessed since ClearFlags was called.
func (*DirFlagMap) Init ¶
func (dm *DirFlagMap) Init()
Init initializes the map, and sets the Mutex lock -- must unlock manually
func (*DirFlagMap) IsOpen ¶
func (dm *DirFlagMap) IsOpen(path string) bool
IsOpen returns true if path has IsOpen bit flag set
func (*DirFlagMap) SetMark ¶
func (dm *DirFlagMap) SetMark(path string)
SetMark sets the mark flag indicating we visited file
func (*DirFlagMap) SetOpen ¶
func (dm *DirFlagMap) SetOpen(path string, open bool)
SetOpenState sets the given directory's open flag
func (*DirFlagMap) SetSortBy ¶
func (dm *DirFlagMap) SetSortBy(path string, modTime bool)
SetSortBy sets the given directory's sort by option
func (*DirFlagMap) SortByModTime ¶
func (dm *DirFlagMap) SortByModTime(path string) bool
SortByModTime returns true if path is sorted by mod time
func (*DirFlagMap) SortByName ¶
func (dm *DirFlagMap) SortByName(path string) bool
SortByName returns true if path is sorted by name (default if not in map)
type DirFlags ¶
type DirFlags int64 //enums:bitflag -trim-prefix Dir
DirFlags are flags on directories: Open, SortBy etc These flags are stored in the DirFlagMap for persistence.
const ( // DirMark means directory is marked -- unmarked entries are deleted post-update DirMark DirFlags = iota // DirIsOpen means directory is open -- else closed DirIsOpen // DirSortByName means sort the directory entries by name. // this is mutex with other sorts -- keeping option open for non-binary sort choices. DirSortByName // DirSortByModTime means sort the directory entries by modification time DirSortByModTime )
const DirFlagsN DirFlags = 4
DirFlagsN is the highest valid value for type DirFlags, plus one.
func DirFlagsValues ¶
func DirFlagsValues() []DirFlags
DirFlagsValues returns all possible values for the type DirFlags.
func (DirFlags) BitIndexString ¶
BitIndexString returns the string representation of this DirFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (DirFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*DirFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*DirFlags) SetString ¶
SetString sets the DirFlags value from its string representation, and returns an error if the string is invalid.
func (*DirFlags) SetStringOr ¶
SetStringOr sets the DirFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*DirFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Node ¶
type Node struct { giv.TreeView // full path to this file FPath gi.FileName `edit:"-" set:"-" json:"-" xml:"-" copy:"-"` // full standard file info about this file Info fi.FileInfo `edit:"-" set:"-" json:"-" xml:"-" copy:"-"` // file buffer for editing this file Buf *texteditor.Buf `edit:"-" set:"-" json:"-" xml:"-" copy:"-"` // root of the tree -- has global state FRoot *Tree `edit:"-" set:"-" json:"-" xml:"-" copy:"-"` // version control system repository for this directory, // only non-nil if this is the highest-level directory in the tree under vcs control DirRepo vci.Repo `edit:"-" set:"-" json:"-" xml:"-" copy:"-"` // version control system repository file status -- only valid during ReadDir RepoFiles vci.Files `edit:"-" set:"-" json:"-" xml:"-" copy:"-"` }
Node represents a file in the file system, as a TreeView node. The name of the node is the name of the file. Folders have children containing further nodes.
func AsNode ¶
func AsNode(k ki.Ki) *Node
AsNode returns the given value as a value of type Node if the type of the given value embeds Node, or nil otherwise
func NewNode ¶
NewNode adds a new Node with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Node) AddToVcsSel ¶
func (fn *Node) AddToVcsSel()
AddToVcsSel adds selected files to version control system
func (*Node) BlameVcs ¶
BlameVcs shows the VCS blame report for this file, reporting for each line the revision and author of the last change.
func (*Node) BlameVcsSel ¶
func (fn *Node) BlameVcsSel()
BlameVcsSel shows the VCS blame report for this file, reporting for each line the revision and author of the last change.
func (*Node) CloseAll ¶
func (fn *Node) CloseAll()
CloseAll closes all directories under this one, this included
func (*Node) CloseBuf ¶
CloseBuf closes the file in its buffer if it is open. returns true if closed.
func (*Node) CloseDir ¶
func (fn *Node) CloseDir()
CloseDir closes given directory node -- updates memory state
func (*Node) CommitToVcs ¶
CommitToVcs commits file changes to version control system
func (*Node) CommitToVcsSel ¶
func (fn *Node) CommitToVcsSel()
CommitToVcsSel commits to version control system based on last selected file
func (*Node) ConfigOfFiles ¶
ConfigOfFiles returns a type-and-name list for configuring nodes based on files immediately within given path
func (*Node) ContextMenu ¶
func (*Node) CopyFileToDir ¶
CopyFileToDir copies given file path into node that is a directory. This does NOT check for overwriting -- that must be done at higher level!
func (*Node) DeleteFiles ¶
func (fn *Node) DeleteFiles()
deletes any selected files or directories. If any directory is selected, all files and subdirectories in that directory are also deleted.
func (*Node) DeleteFilesImpl ¶
func (fn *Node) DeleteFilesImpl()
DeleteFilesImpl does the actual deletion, no prompts
func (*Node) DeleteFromVcs ¶
func (fn *Node) DeleteFromVcs()
DeleteFromVcs removes file from version control
func (*Node) DeleteFromVcsSel ¶
func (fn *Node) DeleteFromVcsSel()
DeleteFromVcsSel removes selected files from version control system
func (*Node) DetectVcsRepo ¶
DetectVcsRepo detects and configures DirRepo if this directory is root of a VCS repository. if updateFiles is true, gets the files in the dir. returns true if a repository was newly found here.
func (*Node) DiffVcs ¶
DiffVcs shows the diffs between two versions of this file, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffViewDialog.
func (*Node) DiffVcsSel ¶
DiffVcsSel shows the diffs between two versions of selected files, given by the revision specifiers -- if empty, defaults to A = current HEAD, B = current WC file. -1, -2 etc also work as universal ways of specifying prior revisions. Diffs are shown in a DiffViewDialog.
func (*Node) DirsTo ¶
DirsTo opens all the directories above the given filename, and returns the node for element at given path (can be a file or directory itself -- not opened -- just returned)
func (*Node) DuplicateFile ¶
DuplicateFile creates a copy of given file -- only works for regular files, not directories
func (*Node) FileExtCounts ¶
func (fn *Node) FileExtCounts(cat fi.Cat) []NodeNameCount
FileExtCounts returns a count of all the different file extensions, sorted from highest to lowest. If cat is != fi.Unknown then it only uses files of that type (e.g., fi.Code to find any code files)
func (*Node) FileNodeContextMenu ¶
func (*Node) FileNodeStyles ¶
func (fn *Node) FileNodeStyles()
func (*Node) FilesMatching ¶
FilesMatching returns list of all nodes whose file name contains given string (no regexp). ignoreCase transforms everything into lowercase
func (*Node) FindDirNode ¶
FindDirNode finds directory node by given path. Must be a relative path already rooted at tree, or absolute path within tree.
func (*Node) FindFile ¶
FindFile finds first node representing given file (false if not found) -- looks for full path names that have the given string as their suffix, so you can include as much of the path (including whole thing) as is relevant to disambiguate. See FilesMatching for a list of files that match a given string.
func (*Node) FirstVCS ¶
FirstVCS returns the first VCS repository starting from this node and going down. also returns the node having that repository
func (*Node) FlagType ¶
func (fn *Node) FlagType() enums.BitFlagSetter
func (*Node) HandleFileNodeEvents ¶
func (fn *Node) HandleFileNodeEvents()
func (*Node) HasClosedParent ¶
HasClosedParent returns true if node has a parent node with !IsOpen flag set
func (*Node) IsAutoSave ¶
IsAutoSave returns true if file is an auto-save file (starts and ends with #)
func (*Node) IsChanged ¶
IsChanged returns true if the file is open and has been changed (edited) since last EditDone
func (*Node) IsExternal ¶
IsExternal returns true if file is external to main file tree
func (*Node) IsIrregular ¶
IsIrregular returns true if file is a special "Irregular" node
func (*Node) IsNotSaved ¶
IsNotSaved returns true if the file is open and has been changed (edited) since last Save
func (*Node) LatestFileMod ¶
LatestFileMod returns the most recent mod time of files in the tree. If cat is != fi.Unknown then it only uses files of that type (e.g., fi.Code to find any code files)
func (*Node) LogVcs ¶
LogVcs shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.
func (*Node) LogVcsSel ¶
LogVcsSel shows the VCS log of commits for selected files, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.
func (*Node) NewFolders ¶
makes a new folder in the given selected directory
func (*Node) OpenBuf ¶
OpenBuf opens the file in its buffer if it is not already open. returns true if file is newly opened
func (*Node) OpenEmptyDir ¶
OpenEmptyDir will attempt to open a directory that has no children which presumably was not processed originally
func (*Node) OpenFileDefault ¶
OpenFileDefault opens file with default app for that file type (os defined) runs open on Mac, xdg-open on Linux, and start on Windows
func (*Node) OpenFileWith ¶
OpenFileWith opens file with given command. does not wait for command to finish in this routine (separate routine Waits)
func (*Node) OpenFilesDefault ¶
func (fn *Node) OpenFilesDefault()
OpenFilesDefault opens selected files with default app for that file type (os defined). runs open on Mac, xdg-open on Linux, and start on Windows
func (*Node) OpenFilesWith ¶
func (fn *Node) OpenFilesWith()
OpenFilesWith opens selected files with user-specified command.
func (*Node) ReadDir ¶
ReadDir reads all the files at given directory into this directory node -- uses config children to preserve extra info already stored about files. The root node represents the directory at the given path. Returns os.Stat error if path cannot be accessed.
func (*Node) RemoveFromExterns ¶
func (fn *Node) RemoveFromExterns()
RemoveFromExterns removes file from list of external files
func (*Node) RenameFile ¶
RenameFile renames file to new name
func (*Node) Repo ¶
Repo returns the version control repository associated with this file, and the node for the directory where the repo is based. Goes up the tree until a repository is found.
func (*Node) RevertVcsSel ¶
func (fn *Node) RevertVcsSel()
RevertVcsSel removes selected files from version control system
func (*Node) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Node.CustomContextMenu]
func (*Node) SetFileIcon ¶
func (fn *Node) SetFileIcon()
func (*Node) SetNodePath ¶
SetNodePath sets the path for given node and updates it based on associated file
func (*Node) SetOpenDepth ¶
SetOpenDepth sets the [Node.OpenDepth]
func (*Node) SetPriorityEvents ¶
SetPriorityEvents sets the [Node.PriorityEvents]
func (*Node) SetRootView ¶
SetRootView sets the [Node.RootView]
func (*Node) SetSelectedNodes ¶
func (t *Node) SetSelectedNodes(v []giv.TreeViewer) *Node
SetSelectedNodes sets the [Node.SelectedNodes]
func (*Node) SetTooltip ¶
SetTooltip sets the [Node.Tooltip]
func (*Node) SetWidgetSize ¶
SetWidgetSize sets the [Node.WidgetSize]
func (*Node) ShowFileInfo ¶
func (fn *Node) ShowFileInfo()
Shows file information about selected file(s)
func (*Node) SortBy ¶
SortBy determines how to sort the files in the directory -- default is alpha by name, optionally can be sorted by modification time.
func (*Node) SortBys ¶
SortBys determines how to sort the selected files in the directory. Default is alpha by name, optionally can be sorted by modification time.
func (*Node) SortConfigByModTime ¶
func (fn *Node) SortConfigByModTime(confg ki.Config)
SortConfigByModTime sorts given config list by mod time
func (*Node) UpdateAllVcs ¶
func (fn *Node) UpdateAllVcs()
UpdateAllVcs does an update on any repositories below this one in file tree
func (*Node) UpdateBranchIcons ¶
func (fn *Node) UpdateBranchIcons()
func (*Node) UpdateDir ¶
func (fn *Node) UpdateDir()
UpdateDir updates the directory and all the nodes under it
func (*Node) UpdateNode ¶
UpdateNode updates information in node based on its associated file in FPath. This is intended to be called ad-hoc for individual nodes that might need updating -- use ReadDir for mass updates as it is more efficient.
func (*Node) UpdateRepoFiles ¶
func (fn *Node) UpdateRepoFiles()
type NodeEmbedder ¶
type NodeEmbedder interface {
AsNode() *Node
}
NodeEmbedder is an interface that all types that embed Node satisfy
type NodeFlags ¶
type NodeFlags giv.TreeViewFlags //enums:bitflag -trim-prefix Node
NodeFlags define bitflags for Node state -- these extend TreeViewFlags and storage is an int64
const ( // NodeOpen means file is open. For directories, this means that // sub-files should be / have been loaded. For files, means that they // have been opened e.g., for editing. NodeOpen NodeFlags = NodeFlags(giv.TreeViewFlagsN) + iota // NodeSymLink indicates that file is a symbolic link. // File info is all for the target of the symlink. NodeSymLink )
const NodeFlagsN NodeFlags = 13
NodeFlagsN is the highest valid value for type NodeFlags, plus one.
func NodeFlagsValues ¶
func NodeFlagsValues() []NodeFlags
NodeFlagsValues returns all possible values for the type NodeFlags.
func (NodeFlags) BitIndexString ¶
BitIndexString returns the string representation of this NodeFlags value if it is a bit index value (typically an enum constant), and not an actual bit flag value.
func (NodeFlags) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*NodeFlags) SetFlag ¶
SetFlag sets the value of the given flags in these flags to the given value.
func (*NodeFlags) SetString ¶
SetString sets the NodeFlags value from its string representation, and returns an error if the string is invalid.
func (*NodeFlags) SetStringOr ¶
SetStringOr sets the NodeFlags value from its string representation while preserving any bit flags already set, and returns an error if the string is invalid.
func (*NodeFlags) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type NodeNameCount ¶
NodeNameCount is used to report counts of different string-based things in the file tree
type Tree ¶
type Tree struct { Node // external files outside the root path of the tree -- abs paths are stored -- these are shown in the first sub-node if present -- use AddExtFile to add and update ExtFiles []string // records state of directories within the tree (encoded using paths relative to root), // e.g., open (have been opened by the user) -- can persist this to restore prior view of a tree Dirs DirFlagMap // if true, then all directories are placed at the top of the tree view // otherwise everything is mixed DirsOnTop bool // type of node to create -- defaults to giv.Node but can use custom node types NodeType *gti.Type `view:"-" json:"-" xml:"-"` // if true, we are in midst of an OpenAll call -- nodes should open all dirs InOpenAll bool // change notify for all dirs Watcher *fsnotify.Watcher `view:"-"` // channel to close watcher watcher DoneWatcher chan bool `view:"-"` // map of paths that have been added to watcher -- only active if bool = true WatchedPaths map[string]bool `view:"-"` // last path updated by watcher LastWatchUpdt string `view:"-"` // timestamp of last update LastWatchTime time.Time `view:"-"` // Update mutex UpdtMu sync.Mutex `view:"-"` }
Tree is the root of a tree representing files in a given directory (and subdirectories thereof), and has some overall management state for how to view things. The Tree can be viewed by a TreeView to provide a GUI interface into it.
func NewTree ¶
NewTree adds a new Tree with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Tree) AddExtFile ¶
AddExtFile adds an external file outside of root of file tree and triggers an update, returning the Node for it, or error if filepath.Abs fails.
func (*Tree) ConfigWatcher ¶
ConfigWatcher configures a new watcher for tree
func (*Tree) CopyFieldsFrom ¶
func (*Tree) DirSortByModTime ¶
DirSortByModTime returns true if dir is sorted by mod time
func (*Tree) DirSortByName ¶
DirSortByName returns true if dir is sorted by name
func (*Tree) ExtNodeByPath ¶
ExtNodeByPath returns Node for given file path, and true, if it exists in the external files list. Otherwise returns nil, false.
func (*Tree) HasExtFile ¶
HasExtFile returns true and index if given abs path exists on ExtFiles list. false and -1 if not.
func (*Tree) IsDirOpen ¶
IsDirOpen returns true if given directory path is open (i.e., has been opened in the view)
func (*Tree) OpenPath ¶
OpenPath opens a filetree at given directory path -- reads all the files at given path into this tree -- uses config children to preserve extra info already stored about files. Only paths listed in Dirs will be opened.
func (*Tree) RemoveExtFile ¶
RemoveExtFile removes external file from maintained list, returns true if removed
func (*Tree) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Tree.CustomContextMenu]
func (*Tree) SetDirClosed ¶
SetDirClosed sets the given directory path to be closed
func (*Tree) SetDirOpen ¶
SetDirOpen sets the given directory path to be open
func (*Tree) SetDirSortBy ¶
SetDirSortBy sets the given directory path sort by option
func (*Tree) SetDirs ¶
func (t *Tree) SetDirs(v DirFlagMap) *Tree
SetDirs sets the [Tree.Dirs]: records state of directories within the tree (encoded using paths relative to root), e.g., open (have been opened by the user) -- can persist this to restore prior view of a tree
func (*Tree) SetDirsOnTop ¶
SetDirsOnTop sets the [Tree.DirsOnTop]: if true, then all directories are placed at the top of the tree view otherwise everything is mixed
func (*Tree) SetDoneWatcher ¶
SetDoneWatcher sets the [Tree.DoneWatcher]: channel to close watcher watcher
func (*Tree) SetExtFiles ¶
SetExtFiles sets the [Tree.ExtFiles]: external files outside the root path of the tree -- abs paths are stored -- these are shown in the first sub-node if present -- use AddExtFile to add and update
func (*Tree) SetInOpenAll ¶
SetInOpenAll sets the [Tree.InOpenAll]: if true, we are in midst of an OpenAll call -- nodes should open all dirs
func (*Tree) SetLastWatchTime ¶
SetLastWatchTime sets the [Tree.LastWatchTime]: timestamp of last update
func (*Tree) SetLastWatchUpdt ¶
SetLastWatchUpdt sets the [Tree.LastWatchUpdt]: last path updated by watcher
func (*Tree) SetNodeType ¶
SetNodeType sets the [Tree.NodeType]: type of node to create -- defaults to giv.Node but can use custom node types
func (*Tree) SetOpenDepth ¶
SetOpenDepth sets the [Tree.OpenDepth]
func (*Tree) SetPriorityEvents ¶
SetPriorityEvents sets the [Tree.PriorityEvents]
func (*Tree) SetRootView ¶
SetRootView sets the [Tree.RootView]
func (*Tree) SetSelectedNodes ¶
func (t *Tree) SetSelectedNodes(v []giv.TreeViewer) *Tree
SetSelectedNodes sets the [Tree.SelectedNodes]
func (*Tree) SetTooltip ¶
SetTooltip sets the [Tree.Tooltip]
func (*Tree) SetWatchedPaths ¶
SetWatchedPaths sets the [Tree.WatchedPaths]: map of paths that have been added to watcher -- only active if bool = true
func (*Tree) SetWatcher ¶
SetWatcher sets the [Tree.Watcher]: change notify for all dirs
func (*Tree) SetWidgetSize ¶
SetWidgetSize sets the [Tree.WidgetSize]
func (*Tree) UnWatchPath ¶
UnWatchPath removes given path from those watched
func (*Tree) UpdateAll ¶
func (ft *Tree) UpdateAll()
UpdateAll does a full update of the tree -- calls ReadDir on current path
func (*Tree) UpdateExtFiles ¶
UpdateExtFiles returns a type-and-name list for configuring nodes for ExtFiles
func (*Tree) UpdateNewFile ¶
UpdateNewFile should be called with path to a new file that has just been created -- will update view to show that file, and if that file doesn't exist, it updates the directory containing that file
func (*Tree) WatchWatcher ¶
func (ft *Tree) WatchWatcher()
WatchWatcher monitors the watcher channel for update events. It must be called once some paths have been added to watcher -- safe to call multiple times.
type VCSLogView ¶
type VCSLogView struct { gi.Layout // current log Log vci.Log // file that this is a log of -- if blank then it is entire repository File string // date expression for how long ago to include log entries from Since string // version control system repository Repo vci.Repo `json:"-" xml:"-" copy:"-"` // revision A -- defaults to HEAD RevA string `set:"-"` // revision B -- blank means current working copy RevB string `set:"-"` // double-click will set the A revision -- else B SetA bool }
VCSLogView is a view of the VCS log data
func NewVCSLogView ¶
func NewVCSLogView(par ki.Ki, name ...string) *VCSLogView
NewVCSLogView adds a new VCSLogView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*VCSLogView) ConfigRepo ¶
func (lv *VCSLogView) ConfigRepo(repo vci.Repo, lg vci.Log, file, since string)
ConfigRepo configures to given repo, log and file (file could be empty)
func (*VCSLogView) KiType ¶
func (t *VCSLogView) KiType() *gti.Type
KiType returns the *gti.Type of VCSLogView
func (*VCSLogView) OnInit ¶
func (lv *VCSLogView) OnInit()
func (*VCSLogView) SetClass ¶
func (t *VCSLogView) SetClass(v string) *VCSLogView
SetClass sets the [VCSLogView.Class]
func (*VCSLogView) SetCustomContextMenu ¶
func (t *VCSLogView) SetCustomContextMenu(v func(m *gi.Scene)) *VCSLogView
SetCustomContextMenu sets the [VCSLogView.CustomContextMenu]
func (*VCSLogView) SetFile ¶
func (t *VCSLogView) SetFile(v string) *VCSLogView
SetFile sets the [VCSLogView.File]: file that this is a log of -- if blank then it is entire repository
func (*VCSLogView) SetLog ¶
func (t *VCSLogView) SetLog(v vci.Log) *VCSLogView
SetLog sets the [VCSLogView.Log]: current log
func (*VCSLogView) SetPriorityEvents ¶
func (t *VCSLogView) SetPriorityEvents(v []events.Types) *VCSLogView
SetPriorityEvents sets the [VCSLogView.PriorityEvents]
func (*VCSLogView) SetRepo ¶
func (t *VCSLogView) SetRepo(v vci.Repo) *VCSLogView
SetRepo sets the [VCSLogView.Repo]: version control system repository
func (*VCSLogView) SetRevA ¶
func (lv *VCSLogView) SetRevA(rev string)
SetRevA sets the revision to use for buffer A
func (*VCSLogView) SetRevB ¶
func (lv *VCSLogView) SetRevB(rev string)
SetRevB sets the revision to use for buffer B
func (*VCSLogView) SetSetA ¶
func (t *VCSLogView) SetSetA(v bool) *VCSLogView
SetSetA sets the [VCSLogView.SetA]: double-click will set the A revision -- else B
func (*VCSLogView) SetSince ¶
func (t *VCSLogView) SetSince(v string) *VCSLogView
SetSince sets the [VCSLogView.Since]: date expression for how long ago to include log entries from
func (*VCSLogView) SetStackTop ¶
func (t *VCSLogView) SetStackTop(v int) *VCSLogView
SetStackTop sets the [VCSLogView.StackTop]
func (*VCSLogView) SetTooltip ¶
func (t *VCSLogView) SetTooltip(v string) *VCSLogView
SetTooltip sets the [VCSLogView.Tooltip]
func (*VCSLogView) TableView ¶
func (lv *VCSLogView) TableView() *giv.TableView
TableView returns the tableview
func (*VCSLogView) ToggleRev ¶
func (lv *VCSLogView) ToggleRev()
ToggleRev switches the active revision to set
func (*VCSLogView) Toolbar ¶
func (lv *VCSLogView) Toolbar() *gi.Toolbar
Toolbar returns the toolbar
type VersCtrlName ¶
type VersCtrlName string
VersCtrlName is the name of a version control system
func VersCtrlNameProper ¶
func VersCtrlNameProper(vc string) VersCtrlName
func (VersCtrlName) String ¶
func (vn VersCtrlName) String() string
func (VersCtrlName) Value ¶
func (kn VersCtrlName) Value() giv.Value
Value registers VersCtrlValue as the viewer of VersCtrlName
type VersCtrlValue ¶
VersCtrlValue presents an action for displaying an VersCtrlName and selecting from StringPopup
func (*VersCtrlValue) ConfigWidget ¶
func (vv *VersCtrlValue) ConfigWidget(w gi.Widget)
func (*VersCtrlValue) HasDialog ¶
func (vv *VersCtrlValue) HasDialog() bool
func (*VersCtrlValue) OpenDialog ¶
func (vv *VersCtrlValue) OpenDialog(ctx gi.Widget, fun func())
func (*VersCtrlValue) UpdateWidget ¶
func (vv *VersCtrlValue) UpdateWidget()
func (*VersCtrlValue) WidgetType ¶
func (vv *VersCtrlValue) WidgetType() *gti.Type