Documentation
¶
Index ¶
- Variables
- func CleanCatTSV(filename string, sorts []string) error
- func FirstComment(sc string) string
- func IsTableFile(fname string) bool
- func NewDiffBrowserDirs(pathA, pathB string)
- func PromptOKCancel(ctx core.Widget, prompt string, fun func())
- func PromptString(ctx core.Widget, str string, prompt string, fun func(s string))
- func PromptStruct(ctx core.Widget, stru any, prompt string, fun func())
- func TrimOrderPrefix(s string) string
- type Browser
- func (br *Browser) FileNodeOpened(fn *filetree.Node)
- func (br *Browser) FileNodeSelected(fn *filetree.Node)
- func (br *Browser) FileTree() *filetree.Tree
- func (br *Browser) FormatTableFromCSV(dt *table.Table, format string) error
- func (br *Browser) GetDataRoot() string
- func (br *Browser) Init()
- func (br *Browser) InitInterp()
- func (br *Browser) MakeToolbar(p *tree.Plan)
- func (br *Browser) NewTabEditor(label, filename string) *texteditor.Editor
- func (br *Browser) NewTabEditorString(label, content string) *texteditor.Editor
- func (br *Browser) NewTabPlot(label string) *plotcore.PlotEditor
- func (br *Browser) NewTabTable(label string, slc any) *core.Table
- func (br *Browser) NewTabTensorTable(label string) *tensorcore.Table
- func (br *Browser) OpenTOML(filename string) (map[string]string, error)
- func (br *Browser) RunScript(snm string)
- func (t *Browser) SetDataRoot(v string) *Browser
- func (t *Browser) SetScriptsDir(v string) *Browser
- func (t *Browser) SetStartDir(v string) *Browser
- func (br *Browser) Splits() *core.Splits
- func (br *Browser) TableWithNewKeyColumns(dt *table.Table, args ...string) *table.Table
- func (br *Browser) Tabs() *core.Tabs
- func (br *Browser) UpdateFiles()
- func (br *Browser) UpdateScripts()
- type FileNode
Constants ¶
This section is empty.
Variables ¶
var MapTypes = map[reflect.Value][]reflect.Type{}
MapTypes variable contains a map of functions which have an interface{} as parameter but do something special if the parameter implements a given interface.
var Symbols = map[string]map[string]reflect.Value{}
Symbols variable stores the map of stdlib symbols per package.
Functions ¶
func CleanCatTSV ¶
CleanCatTSV cleans a TSV file formed by concatenating multiple files together. Removes redundant headers and then sorts by given set of columns
func FirstComment ¶
FirstComment returns the first comment lines from given .cosh file, which is used to set the tooltip for scripts.
func IsTableFile ¶
func NewDiffBrowserDirs ¶
func NewDiffBrowserDirs(pathA, pathB string)
NewDiffBrowserDirs returns a new diff browser for files that differ within the two given directories. Excludes Job and .tsv data files.
func PromptOKCancel ¶
PromptOKCancel prompts the user for whether to do something, calling the given function if the user clicks OK.
func PromptString ¶
PromptString prompts the user for a string value (initial value given), calling the given function if the user clicks OK.
func PromptStruct ¶
PromptStruct prompts the user for the values in given struct (pass a pointer), calling the given function if the user clicks OK.
func TrimOrderPrefix ¶
TrimOrderPrefix trims any optional #- prefix from given string, used for ordering items by name.
Types ¶
type Browser ¶
type Browser struct { core.Frame // DataRoot is the path to the root of the data to browse DataRoot string // StartDir is the starting directory, where the numbers app // was originally started. StartDir string // ScriptsDir is the directory containing scripts for toolbar actions. // It defaults to DataDir/dbscripts ScriptsDir string // Scripts Scripts map[string]string `set:"-"` // ScriptInterp is the interpreter to use for running Browser scripts ScriptInterp *numshell.Interpreter `set:"-"` }
Browser is a data browser, for browsing data typically organized into separate directories, with .cosh Scripts as toolbar actions to perform regular tasks on the data. Scripts are ordered alphabetically and any leading #- prefix is automatically removed from the label, so you can use numbers to specify a custom order.
var TheBrowser *Browser
TheBrowser is the current browser, which is valid immediately after NewBrowserWindow where it is used to get a local variable for subsequent use.
func NewBrowser ¶
NewBrowser returns a new Browser with the given optional parent: Browser is a data browser, for browsing data typically organized into separate directories, with .cosh Scripts as toolbar actions to perform regular tasks on the data. Scripts are ordered alphabetically and any leading #- prefix is automatically removed from the label, so you can use numbers to specify a custom order.
func NewBrowserWindow ¶
NewBrowserWindow opens a new data Browser for given data directory. By default the scripts for this data directory are located in dbscripts relative to the data directory.
func ParentBrowser ¶
ParentBrowser returns the Browser parent of given node
func (*Browser) FileNodeOpened ¶
func (*Browser) FileNodeSelected ¶
func (*Browser) FormatTableFromCSV ¶
FormatTableFromCSV formats the columns of the given table according to the Name, Type values in given format CSV file.
func (*Browser) GetDataRoot ¶
func (*Browser) Init ¶
func (br *Browser) Init()
Init initializes with the data and script directories
func (*Browser) InitInterp ¶
func (br *Browser) InitInterp()
func (*Browser) MakeToolbar ¶
func (*Browser) NewTabEditor ¶
func (br *Browser) NewTabEditor(label, filename string) *texteditor.Editor
NewTabEditor opens an editor tab for given file
func (*Browser) NewTabEditorString ¶
func (br *Browser) NewTabEditorString(label, content string) *texteditor.Editor
NewTabEditorString opens an editor tab to display given string
func (*Browser) NewTabPlot ¶
func (br *Browser) NewTabPlot(label string) *plotcore.PlotEditor
NewTabPlot creates a tab with a SubPlot PlotEditor. Set the table and call br.Update after this.
func (*Browser) NewTabTable ¶
NewTabTable creates a tab with a slice Table. Sets the slice if tab already exists
func (*Browser) NewTabTensorTable ¶
func (br *Browser) NewTabTensorTable(label string) *tensorcore.Table
NewTabTensorTable creates a tab with a tensor table and a tensorcore table. Use tv.Table.Table to get the underlying *table.Table and tv.Table is the table.IndexView onto the table. Use tv.Table.Sequential to update the IndexView to view all of the rows when done updating the Table, and then call br.Update()
func (*Browser) OpenTOML ¶
OpenTOML opens given .toml formatted file with name = value entries, as a map.
func (*Browser) SetDataRoot ¶
SetDataRoot sets the [Browser.DataRoot]: DataRoot is the path to the root of the data to browse
func (*Browser) SetScriptsDir ¶
SetScriptsDir sets the [Browser.ScriptsDir]: ScriptsDir is the directory containing scripts for toolbar actions. It defaults to DataDir/dbscripts
func (*Browser) SetStartDir ¶
SetStartDir sets the [Browser.StartDir]: StartDir is the starting directory, where the numbers app was originally started.
func (*Browser) TableWithNewKeyColumns ¶
TableWithNewKeyColumns returns a copy of the Table with new columns having given values, inserted at the start, used as legend keys etc. args are column name, value pairs.
func (*Browser) UpdateFiles ¶
func (br *Browser) UpdateFiles()
UpdateFiles Updates the file picker with current files in DataRoot,
func (*Browser) UpdateScripts ¶
func (br *Browser) UpdateScripts()
UpdateScripts updates the Scripts and updates the toolbar.
type FileNode ¶
FileNode is Code version of FileNode for FileTree
func NewFileNode ¶
NewFileNode returns a new FileNode with the given optional parent: FileNode is Code version of FileNode for FileTree
func (*FileNode) ContextMenu ¶
func (*FileNode) DiffDirs ¶
func (fn *FileNode) DiffDirs()
DiffDirs displays a browser with differences between two selected directories
func (*FileNode) EditFiles ¶
func (fn *FileNode) EditFiles()
EditFiles calls EditFile on selected files