README
¶
etview
Docs: GoDoc
etview
provides GUI Views of etable.Table
and etensor.Tensor
structures using the GoGi View framework, as GoGi Widgets.
Add this to import
to get these views to be registered with the GoGi ValueView system:
_ "github.com/emer/etable/etview" // include to get gui views
-
TableView
provides a row-and-column tabular GUI interface, similar to a spreadsheet, for viewing and editing Table data. Any higher-dimensional tensor columns are shown as TensorGrid elements that can be clicked to open a TensorView editor with actual numeric values in a similar spreadsheet-like GUI. -
TensorView
provides a spreadsheet-like GUI for viewing and editing tensor data. -
TensorGrid
provides a 2D colored grid display of tensor data, collapsing any higher dimensions down to 2D. Different giv.ColorMaps can be used to translate values into colors.
Documentation
¶
Overview ¶
Package etview provides GUI Views of etable Table and Tensor structures using the GoGi View framework: https://github.com/goki/gi
* TableView provides a row-and-column tabular GUI interface, similar to a spreadsheet, for viewing and editing Table data. Any higher-dimensional tensor columns are shown as TensorGrid elements that can be clicked to open a TensorView editor with actual numeric values in a similar spreadsheet- like GUI.
* TensorView provides a spreadsheet-like GUI for viewing and editing tensor data.
* TensorGrid provides a 2D colored grid display of tensor data, collapsing any higher dimensions down to 2D. Different giv.ColorMaps can be used to translate values into colors.
Index ¶
- Constants
- Variables
- func SimMatGridDialog(avp *gi.Viewport2D, smat *simat.SimMat, opts giv.DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func TableViewDialog(avp *gi.Viewport2D, et *etable.Table, opts giv.DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func TensorGridDialog(avp *gi.Viewport2D, tsr etensor.Tensor, opts giv.DlgOpts, recv ki.Ki, ...) *gi.Dialog
- func TensorViewDialog(avp *gi.Viewport2D, tsr etensor.Tensor, opts giv.DlgOpts, recv ki.Ki, ...) *gi.Dialog
- type SimMatGrid
- func (tg *SimMatGrid) ConnectEvents2D()
- func (tg *SimMatGrid) Defaults()
- func (tg *SimMatGrid) MouseEvent()
- func (tg *SimMatGrid) Render2D()
- func (tg *SimMatGrid) RenderSimMat()
- func (tg *SimMatGrid) SetSimMat(smat *simat.SimMat)
- func (tg *SimMatGrid) Size2D(iter int)
- func (tg *SimMatGrid) Size2DLabel(lbs []string, col bool) (minBlank, ngps int, sz mat32.Vec2)
- func (tg *SimMatGrid) Style2D()
- type SimMatValueView
- type TableValueView
- type TableView
- func (tv *TableView) ColTensorDisp(col int) *TensorDisp
- func (tv *TableView) Config()
- func (tv *TableView) ConfigSliceGrid()
- func (tv *TableView) ConfigToolbar()
- func (tv *TableView) CopySelToMime() mimedata.Mimes
- func (tv *TableView) FromMimeData(md mimedata.Mimes) [][]string
- func (tv *TableView) GridLayout() *gi.Layout
- func (tv *TableView) IsConfiged() bool
- func (tv *TableView) ItemCtxtMenu(idx int)
- func (tv *TableView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tv *TableView) LayoutHeader()
- func (tv *TableView) LayoutSliceGrid() bool
- func (tv *TableView) MimeDataType() string
- func (tv *TableView) NeedsDoubleReRender() bool
- func (tv *TableView) PasteAssign(md mimedata.Mimes, idx int)
- func (tv *TableView) PasteAtIdx(md mimedata.Mimes, idx int)
- func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
- func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase
- func (tv *TableView) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (tv *TableView) ScrollBar() *gi.ScrollBar
- func (tv *TableView) SelectRowWidgets(row int, sel bool)
- func (tv *TableView) SetColTensorDisp(col int) *TensorDisp
- func (tv *TableView) SetSortFieldName(nm string)
- func (tv *TableView) SetTable(et *etable.Table, tmpSave giv.ValueView)
- func (tv *TableView) SetTableView(ix *etable.IdxView, tmpSave giv.ValueView)
- func (tv *TableView) SliceDeleteAt(idx int, doUpdt bool)
- func (tv *TableView) SliceFrame() *gi.Frame
- func (tv *TableView) SliceGrid() *gi.Frame
- func (tv *TableView) SliceHeader() *gi.ToolBar
- func (tv *TableView) SliceNewAt(idx int)
- func (tv *TableView) SortFieldName() string
- func (tv *TableView) SortIfNeeded()
- func (tv *TableView) SortSliceAction(fldIdx int)
- func (tv *TableView) Style2D()
- func (tv *TableView) StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv giv.ValueView)
- func (tv *TableView) TableConfig()
- func (tv *TableView) TensorDispAction(fldIdx int)
- func (tv *TableView) ToolBar() *gi.ToolBar
- func (tv *TableView) TsrDispToDots()
- func (tv *TableView) UpdateSliceGrid()
- func (tv *TableView) UpdateTable()
- func (tv *TableView) UpdtSliceSize() int
- type TensorDisp
- type TensorGrid
- func (tg *TensorGrid) Color(val float64) (norm float64, clr gist.Color)
- func (tg *TensorGrid) ConnectEvents2D()
- func (tg *TensorGrid) Defaults()
- func (tg *TensorGrid) EnsureColorMap()
- func (tg *TensorGrid) MouseEvent()
- func (tg *TensorGrid) OpenTensorView()
- func (tg *TensorGrid) Render2D()
- func (tg *TensorGrid) RenderTensor()
- func (tg *TensorGrid) SetTensor(tsr etensor.Tensor)
- func (tg *TensorGrid) Size2D(iter int)
- func (tg *TensorGrid) Style2D()
- func (tg *TensorGrid) UpdateRange()
- type TensorGridValueView
- type TensorLayout
- type TensorValueView
- type TensorView
- func (tv *TensorView) Config()
- func (tv *TensorView) ConfigSliceGrid()
- func (tv *TensorView) ConfigToolbar()
- func (tv *TensorView) CopySelToMime() mimedata.Mimes
- func (tv *TensorView) GridLayout() *gi.Layout
- func (tv *TensorView) IsConfiged() bool
- func (tv *TensorView) ItemCtxtMenu(idx int)
- func (tv *TensorView) Layout2D(parBBox image.Rectangle, iter int) bool
- func (tv *TensorView) LayoutHeader()
- func (tv *TensorView) LayoutSliceGrid() bool
- func (tv *TensorView) PasteAssign(md mimedata.Mimes, idx int)
- func (tv *TensorView) PasteAtIdx(md mimedata.Mimes, idx int)
- func (tv *TensorView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
- func (tv *TensorView) RowGrabFocus(row int) *gi.WidgetBase
- func (tv *TensorView) RowWidgetNs() (nWidgPerRow, idxOff int)
- func (tv *TensorView) ScrollBar() *gi.ScrollBar
- func (tv *TensorView) SelectRowWidgets(row int, sel bool)
- func (tv *TensorView) SetTensor(tsr etensor.Tensor, tmpSave giv.ValueView)
- func (tv *TensorView) SliceDeleteAt(idx int, doupdt bool)
- func (tv *TensorView) SliceFrame() *gi.Frame
- func (tv *TensorView) SliceGrid() *gi.Frame
- func (tv *TensorView) SliceHeader() *gi.ToolBar
- func (tv *TensorView) SliceNewAt(idx int)
- func (tv *TensorView) StyleRow(svnp reflect.Value, widg gi.Node2D, idx, fidx int, vv giv.ValueView)
- func (tv *TensorView) ToolBar() *gi.ToolBar
- func (tv *TensorView) UpdateSliceGrid()
- func (tv *TensorView) UpdtSliceSize() int
Constants ¶
const LabelSpace = float32(8)
Variables ¶
var KiT_SimMatGrid = kit.Types.AddType(&SimMatGrid{}, nil)
var KiT_SimMatValueView = kit.Types.AddType(&SimMatValueView{}, nil)
var KiT_TableValueView = kit.Types.AddType(&TableValueView{}, nil)
var KiT_TableView = kit.Types.AddType(&TableView{}, TableViewProps)
var KiT_TensorDisp = kit.Types.AddType(&TensorDisp{}, TensorDispProps)
var KiT_TensorGrid = kit.Types.AddType(&TensorGrid{}, nil)
var KiT_TensorGridValueView = kit.Types.AddType(&TensorGridValueView{}, nil)
var KiT_TensorValueView = kit.Types.AddType(&TensorValueView{}, nil)
var KiT_TensorView = kit.Types.AddType(&TensorView{}, TensorViewProps)
var TableViewProps = ki.Props{ "EnumType:Flag": gi.KiT_NodeFlags, "background-color": &gi.Prefs.Colors.Background, "color": &gi.Prefs.Colors.Font, "max-width": -1, "max-height": -1, }
Functions ¶
func SimMatGridDialog ¶ added in v1.0.0
func SimMatGridDialog(avp *gi.Viewport2D, smat *simat.SimMat, opts giv.DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
SimMatGridDialog is for viewing a etensor.Tensor using a SimMatGrid -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore) gopy:interface=handle
func TableViewDialog ¶
func TableViewDialog(avp *gi.Viewport2D, et *etable.Table, opts giv.DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TableViewDialog is for editing an etable.Table using a TableView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore) gopy:interface=handle
func TensorGridDialog ¶ added in v1.0.0
func TensorGridDialog(avp *gi.Viewport2D, tsr etensor.Tensor, opts giv.DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TensorGridDialog is for viewing a etensor.Tensor using a TensorGrid -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore) gopy:interface=handle
func TensorViewDialog ¶
func TensorViewDialog(avp *gi.Viewport2D, tsr etensor.Tensor, opts giv.DlgOpts, recv ki.Ki, dlgFunc ki.RecvFunc) *gi.Dialog
TensorViewDialog is for editing an etensor.Tensor using a TensorView -- optionally connects to given signal receiving object and function for dialog signals (nil to ignore) gopy:interface=handle
Types ¶
type SimMatGrid ¶ added in v1.0.0
type SimMatGrid struct { TensorGrid // the similarity / distance matrix SimMat *simat.SimMat `desc:"the similarity / distance matrix"` // contains filtered or unexported fields }
SimMatGrid is a widget that displays a similarity / distance matrix with tensor values as a grid of colored squares, and labels for rows, cols
func AddNewSimMatGrid ¶ added in v1.0.0
AddNewSimMatGrid adds a new tensor grid to given parent node, with given name.
func (*SimMatGrid) ConnectEvents2D ¶ added in v1.0.0
func (tg *SimMatGrid) ConnectEvents2D()
func (*SimMatGrid) Defaults ¶ added in v1.0.0
func (tg *SimMatGrid) Defaults()
Defaults sets defaults for values that are at nonsensical initial values
func (*SimMatGrid) MouseEvent ¶ added in v1.0.0
func (tg *SimMatGrid) MouseEvent()
MouseEvent handles button MouseEvent
func (*SimMatGrid) Render2D ¶ added in v1.0.0
func (tg *SimMatGrid) Render2D()
func (*SimMatGrid) RenderSimMat ¶ added in v1.0.0
func (tg *SimMatGrid) RenderSimMat()
func (*SimMatGrid) SetSimMat ¶ added in v1.0.0
func (tg *SimMatGrid) SetSimMat(smat *simat.SimMat)
SetSimMat sets the similarity matrix and triggers a display update
func (*SimMatGrid) Size2D ¶ added in v1.0.0
func (tg *SimMatGrid) Size2D(iter int)
func (*SimMatGrid) Size2DLabel ¶ added in v1.0.0
func (*SimMatGrid) Style2D ¶ added in v1.0.0
func (tg *SimMatGrid) Style2D()
type SimMatValueView ¶ added in v1.0.0
type SimMatValueView struct {
giv.ValueViewBase
}
SimMatValueView presents a button that pulls up the SimMatGridView viewer for an etable.Table
func (*SimMatValueView) Activate ¶ added in v1.0.0
func (vv *SimMatValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*SimMatValueView) ConfigWidget ¶ added in v1.0.0
func (vv *SimMatValueView) ConfigWidget(widg gi.Node2D)
func (*SimMatValueView) HasAction ¶ added in v1.0.0
func (vv *SimMatValueView) HasAction() bool
func (*SimMatValueView) UpdateWidget ¶ added in v1.0.0
func (vv *SimMatValueView) UpdateWidget()
func (*SimMatValueView) WidgetType ¶ added in v1.0.0
func (vv *SimMatValueView) WidgetType() reflect.Type
type TableValueView ¶
type TableValueView struct {
giv.ValueViewBase
}
TableValueView presents a button that pulls up the TableView viewer for an etable.Table
func (*TableValueView) Activate ¶
func (vv *TableValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*TableValueView) ConfigWidget ¶
func (vv *TableValueView) ConfigWidget(widg gi.Node2D)
func (*TableValueView) HasAction ¶
func (vv *TableValueView) HasAction() bool
func (*TableValueView) UpdateWidget ¶
func (vv *TableValueView) UpdateWidget()
func (*TableValueView) WidgetType ¶
func (vv *TableValueView) WidgetType() reflect.Type
type TableView ¶
type TableView struct { giv.SliceViewBase // the idx view of the table that we're a view of Table *etable.IdxView `desc:"the idx view of the table that we're a view of"` // overall display options for tensor display TsrDisp TensorDisp `desc:"overall display options for tensor display"` // per column tensor display ColTsrDisp map[int]*TensorDisp `desc:"per column tensor display"` // number of columns in table (as of last update) NCols int `inactive:"+" desc:"number of columns in table (as of last update)"` // current sort index SortIdx int `desc:"current sort index"` // whether current sort order is descending SortDesc bool `desc:"whether current sort order is descending"` }
etview.TableView provides a GUI interface for etable.Table's
func AddNewTableView ¶
AddNewTableView adds a new tableview to given parent node, with given name.
func (*TableView) ColTensorDisp ¶
func (tv *TableView) ColTensorDisp(col int) *TensorDisp
ColTensorDisp returns tensor display parameters for this column either the overall defaults or the per-column if set
func (*TableView) ConfigSliceGrid ¶
func (tv *TableView) ConfigSliceGrid()
ConfigSliceGrid configures the SliceGrid for the current slice this is only called by global Config and updates are guarded by that
func (*TableView) ConfigToolbar ¶
func (tv *TableView) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*TableView) CopySelToMime ¶
CopySelToMime copies selected rows to mime data
func (*TableView) FromMimeData ¶ added in v1.0.0
FromMimeData returns records from csv of mime data
func (*TableView) GridLayout ¶
GridLayout returns the SliceGrid grid-layout widget, with grid and scrollbar
func (*TableView) IsConfiged ¶
IsConfiged returns true if the widget is fully configured
func (*TableView) ItemCtxtMenu ¶
func (*TableView) LayoutHeader ¶
func (tv *TableView) LayoutHeader()
LayoutHeader updates the header layout based on field widths
func (*TableView) LayoutSliceGrid ¶
LayoutSliceGrid does the proper layout of slice grid depending on allocated size returns true if UpdateSliceGrid should be called after this
func (*TableView) MimeDataType ¶ added in v1.0.0
func (*TableView) NeedsDoubleReRender ¶ added in v1.1.23
func (*TableView) PasteAssign ¶
PasteAssign assigns mime data (only the first one!) to this idx
func (*TableView) PasteAtIdx ¶
PasteAtIdx inserts object(s) from mime data at (before) given slice index adds to end of table
func (*TableView) RowFirstVisWidget ¶
func (tv *TableView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
RowFirstVisWidget returns the first visible widget for given row (could be index or not) -- false if out of range
func (*TableView) RowGrabFocus ¶
func (tv *TableView) RowGrabFocus(row int) *gi.WidgetBase
RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!
func (*TableView) RowWidgetNs ¶
RowWidgetNs returns number of widgets per row and offset for index label
func (*TableView) SelectRowWidgets ¶
SelectRowWidgets sets the selection state of given row of widgets
func (*TableView) SetColTensorDisp ¶
func (tv *TableView) SetColTensorDisp(col int) *TensorDisp
SetColTensorDisp sets per-column tensor display params and returns them if already set, just returns them
func (*TableView) SetSortFieldName ¶
SetSortField sets sorting to happen on given field and direction -- see SortFieldName for details
func (*TableView) SetTable ¶
SetTable sets the source table that we are viewing, using a sequential IdxView and then configures the display
func (*TableView) SetTableView ¶ added in v1.0.0
SetTableView sets the source IdxView of a table (using a copy so original is not modified) and then configures the display
func (*TableView) SliceDeleteAt ¶
SliceDeleteAt deletes element at given index from slice -- doUpdt means call UpdateSliceGrid to update display
func (*TableView) SliceFrame ¶
SliceFrame returns the outer frame widget, which contains all the header, fields and values
func (*TableView) SliceGrid ¶
SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values, within SliceFrame
func (*TableView) SliceHeader ¶
SliceHeader returns the Toolbar header for slice grid
func (*TableView) SliceNewAt ¶
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*TableView) SortFieldName ¶
SortFieldName returns the name of the field being sorted, along with :up or :down depending on descending
func (*TableView) SortIfNeeded ¶ added in v1.0.31
func (tv *TableView) SortIfNeeded()
SortIfNeeded sort table if sorting set
func (*TableView) SortSliceAction ¶
SortSliceAction sorts the slice for given field index -- toggles ascending vs. descending if already sorting on this dimension
func (*TableView) TableConfig ¶ added in v1.0.0
func (tv *TableView) TableConfig()
TableConfig does all the configuration for a new Table view
func (*TableView) TensorDispAction ¶
TensorDispAction allows user to select tensor display options for column pass -1 for global params for the entire table
func (*TableView) TsrDispToDots ¶ added in v1.0.0
func (tv *TableView) TsrDispToDots()
func (*TableView) UpdateSliceGrid ¶
func (tv *TableView) UpdateSliceGrid()
UpdateSliceGrid updates grid display -- robust to any time calling
func (*TableView) UpdateTable ¶ added in v1.0.9
func (tv *TableView) UpdateTable()
UpdateTable updates view of Table -- regenerates indexes and calls Update
func (*TableView) UpdtSliceSize ¶
type TensorDisp ¶
type TensorDisp struct { TensorLayout // [view: inline] range to plot Range minmax.Range64 `view:"inline" desc:"range to plot"` // [view: inline] if not using fixed range, this is the actual range of data MinMax minmax.F64 `view:"inline" desc:"if not using fixed range, this is the actual range of data"` // the name of the color map to use in translating values to colors ColorMap giv.ColorMapName `desc:"the name of the color map to use in translating values to colors"` // background color Background gist.Color `desc:"background color"` // [def: 0.9,1] [min: 0.1] [max: 1] [step: 0.1] what proportion of grid square should be filled by color block -- 1 = all, .5 = half, etc GridFill float32 `` /* 137-byte string literal not displayed */ // [def: 0.1,0.3] [min: 0] [max: 1] [step: 0.02] amount of extra space to add at dimension boundaries, as a proportion of total grid size DimExtra float32 `` /* 137-byte string literal not displayed */ // extra space to add at bottom of grid -- needed when included in TableView for example BotRtSpace units.Value `desc:"extra space to add at bottom of grid -- needed when included in TableView for example"` // minimum size for grid squares -- they will never be smaller than this GridMinSize units.Value `desc:"minimum size for grid squares -- they will never be smaller than this"` // maximum size for grid squares -- they will never be larger than this GridMaxSize units.Value `desc:"maximum size for grid squares -- they will never be larger than this"` // total preferred display size along largest dimension -- grid squares will be sized to fit within this size, subject to harder GridMin / Max size constraints TotPrefSize units.Value `` /* 163-byte string literal not displayed */ // font size in standard point units for labels (e.g., SimMat) FontSize float32 `desc:"font size in standard point units for labels (e.g., SimMat)"` // [view: -] our gridview, for update method GridView *TensorGrid `copy:"-" json:"-" xml:"-" view:"-" desc:"our gridview, for update method"` }
TensorDisp are options for displaying tensors
func (*TensorDisp) Defaults ¶
func (td *TensorDisp) Defaults()
Defaults sets defaults for values that are at nonsensical initial values
func (*TensorDisp) FmMeta ¶ added in v1.0.0
func (td *TensorDisp) FmMeta(tsr etensor.Tensor)
FmMeta sets display options from Tensor meta-data
func (*TensorDisp) ToDots ¶
func (td *TensorDisp) ToDots(uc *units.Context)
func (*TensorDisp) Update ¶ added in v1.0.0
func (td *TensorDisp) Update()
Update satisfies the gi.Updater interface and will trigger display update on edits
type TensorGrid ¶
type TensorGrid struct { gi.WidgetBase // the tensor that we view Tensor etensor.Tensor `desc:"the tensor that we view"` // display options Disp TensorDisp `desc:"display options"` // the actual colormap ColorMap *colormap.Map `desc:"the actual colormap"` }
TensorGrid is a widget that displays tensor values as a grid of colored squares.
func AddNewTensorGrid ¶
AddNewTensorGrid adds a new tensor grid to given parent node, with given name.
func (*TensorGrid) ConnectEvents2D ¶
func (tg *TensorGrid) ConnectEvents2D()
func (*TensorGrid) Defaults ¶
func (tg *TensorGrid) Defaults()
Defaults sets defaults for values that are at nonsensical initial values
func (*TensorGrid) EnsureColorMap ¶
func (tg *TensorGrid) EnsureColorMap()
EnsureColorMap makes sure there is a valid color map that matches specified name
func (*TensorGrid) MouseEvent ¶
func (tg *TensorGrid) MouseEvent()
MouseEvent handles button MouseEvent
func (*TensorGrid) OpenTensorView ¶
func (tg *TensorGrid) OpenTensorView()
OpenTensorView pulls up a TensorView of our tensor
func (*TensorGrid) Render2D ¶
func (tg *TensorGrid) Render2D()
func (*TensorGrid) RenderTensor ¶
func (tg *TensorGrid) RenderTensor()
func (*TensorGrid) SetTensor ¶
func (tg *TensorGrid) SetTensor(tsr etensor.Tensor)
SetTensor sets the tensor and triggers a display update
func (*TensorGrid) Size2D ¶
func (tg *TensorGrid) Size2D(iter int)
func (*TensorGrid) Style2D ¶
func (tg *TensorGrid) Style2D()
func (*TensorGrid) UpdateRange ¶
func (tg *TensorGrid) UpdateRange()
type TensorGridValueView ¶
type TensorGridValueView struct {
giv.ValueViewBase
}
TensorGridValueView manages a TensorGrid view of an etensor.Tensor
func (*TensorGridValueView) ConfigWidget ¶
func (vv *TensorGridValueView) ConfigWidget(widg gi.Node2D)
func (*TensorGridValueView) HasAction ¶
func (vv *TensorGridValueView) HasAction() bool
func (*TensorGridValueView) UpdateWidget ¶
func (vv *TensorGridValueView) UpdateWidget()
func (*TensorGridValueView) WidgetType ¶
func (vv *TensorGridValueView) WidgetType() reflect.Type
type TensorLayout ¶
type TensorLayout struct { // even-numbered dimensions are displayed as Y*X rectangles -- this determines along which dimension to display any remaining odd dimension: OddRow = true = organize vertically along row dimension, false = organize horizontally across column dimension OddRow bool `` /* 255-byte string literal not displayed */ // if true, then the Y=0 coordinate is displayed from the top-down; otherwise the Y=0 coordinate is displayed from the bottom up, which is typical for emergent network patterns. TopZero bool `` /* 181-byte string literal not displayed */ // display the data as a bitmap image. if a 2D tensor, then it will be a greyscale image. if a 3D tensor with size of either the first or last dim = either 3 or 4, then it is a RGB(A) color image Image bool `` /* 201-byte string literal not displayed */ }
TensorLayout are layout options for displaying tensors
type TensorValueView ¶
type TensorValueView struct {
giv.ValueViewBase
}
TensorValueView presents a button that pulls up the TensorView viewer for an etensor.Tensor
func (*TensorValueView) Activate ¶
func (vv *TensorValueView) Activate(vp *gi.Viewport2D, recv ki.Ki, dlgFunc ki.RecvFunc)
func (*TensorValueView) ConfigWidget ¶
func (vv *TensorValueView) ConfigWidget(widg gi.Node2D)
func (*TensorValueView) HasAction ¶
func (vv *TensorValueView) HasAction() bool
func (*TensorValueView) UpdateWidget ¶
func (vv *TensorValueView) UpdateWidget()
func (*TensorValueView) WidgetType ¶
func (vv *TensorValueView) WidgetType() reflect.Type
type TensorView ¶
type TensorView struct { giv.SliceViewBase // the tensor that we're a view of Tensor etensor.Tensor `desc:"the tensor that we're a view of"` // layout config of the tensor TsrLay TensorLayout `desc:"layout config of the tensor"` // number of columns in table (as of last update) NCols int `inactive:"+" desc:"number of columns in table (as of last update)"` }
etview.TensorView provides a GUI interface for etable.Tensor's using a tabular rows-and-columns interface
func AddNewTensorView ¶
func AddNewTensorView(parent ki.Ki, name string) *TensorView
AddNewTensorView adds a new tableview to given parent node, with given name.
func (*TensorView) ConfigSliceGrid ¶
func (tv *TensorView) ConfigSliceGrid()
ConfigSliceGrid configures the SliceGrid for the current slice this is only called by global Config and updates are guarded by that
func (*TensorView) ConfigToolbar ¶
func (tv *TensorView) ConfigToolbar()
ConfigToolbar configures the toolbar actions
func (*TensorView) CopySelToMime ¶
func (tv *TensorView) CopySelToMime() mimedata.Mimes
CopySelToMime copies selected rows to mime data
func (*TensorView) GridLayout ¶
func (tv *TensorView) GridLayout() *gi.Layout
GridLayout returns the SliceGrid grid-layout widget, with grid and scrollbar
func (*TensorView) IsConfiged ¶
func (tv *TensorView) IsConfiged() bool
IsConfiged returns true if the widget is fully configured
func (*TensorView) ItemCtxtMenu ¶
func (tv *TensorView) ItemCtxtMenu(idx int)
func (*TensorView) Layout2D ¶
func (tv *TensorView) Layout2D(parBBox image.Rectangle, iter int) bool
func (*TensorView) LayoutHeader ¶
func (tv *TensorView) LayoutHeader()
LayoutHeader updates the header layout based on field widths
func (*TensorView) LayoutSliceGrid ¶
func (tv *TensorView) LayoutSliceGrid() bool
LayoutSliceGrid does the proper layout of slice grid depending on allocated size returns true if UpdateSliceGrid should be called after this
func (*TensorView) PasteAssign ¶
func (tv *TensorView) PasteAssign(md mimedata.Mimes, idx int)
PasteAssign assigns mime data (only the first one!) to this idx
func (*TensorView) PasteAtIdx ¶
func (tv *TensorView) PasteAtIdx(md mimedata.Mimes, idx int)
PasteAtIdx inserts object(s) from mime data at (before) given slice index
func (*TensorView) RowFirstVisWidget ¶
func (tv *TensorView) RowFirstVisWidget(row int) (*gi.WidgetBase, bool)
RowFirstVisWidget returns the first visible widget for given row (could be index or not) -- false if out of range
func (*TensorView) RowGrabFocus ¶
func (tv *TensorView) RowGrabFocus(row int) *gi.WidgetBase
RowGrabFocus grabs the focus for the first focusable widget in given row -- returns that element or nil if not successful -- note: grid must have already rendered for focus to be grabbed!
func (*TensorView) RowWidgetNs ¶
func (tv *TensorView) RowWidgetNs() (nWidgPerRow, idxOff int)
RowWidgetNs returns number of widgets per row and offset for index label
func (*TensorView) ScrollBar ¶
func (tv *TensorView) ScrollBar() *gi.ScrollBar
ScrollBar returns the SliceGrid scrollbar
func (*TensorView) SelectRowWidgets ¶
func (tv *TensorView) SelectRowWidgets(row int, sel bool)
SelectRowWidgets sets the selection state of given row of widgets
func (*TensorView) SetTensor ¶
func (tv *TensorView) SetTensor(tsr etensor.Tensor, tmpSave giv.ValueView)
SetTensor sets the source tensor that we are viewing
func (*TensorView) SliceDeleteAt ¶
func (tv *TensorView) SliceDeleteAt(idx int, doupdt bool)
SliceDeleteAt deletes element at given index from slice -- doupdt means call UpdateSliceGrid to update display
func (*TensorView) SliceFrame ¶
func (tv *TensorView) SliceFrame() *gi.Frame
SliceFrame returns the outer frame widget, which contains all the header, fields and values
func (*TensorView) SliceGrid ¶
func (tv *TensorView) SliceGrid() *gi.Frame
SliceGrid returns the SliceGrid grid frame widget, which contains all the fields and values, within SliceFrame
func (*TensorView) SliceHeader ¶
func (tv *TensorView) SliceHeader() *gi.ToolBar
SliceHeader returns the Toolbar header for slice grid
func (*TensorView) SliceNewAt ¶
func (tv *TensorView) SliceNewAt(idx int)
SliceNewAt inserts a new blank element at given index in the slice -- -1 means the end
func (*TensorView) ToolBar ¶
func (tv *TensorView) ToolBar() *gi.ToolBar
ToolBar returns the toolbar widget
func (*TensorView) UpdateSliceGrid ¶
func (tv *TensorView) UpdateSliceGrid()
UpdateSliceGrid updates grid display -- robust to any time calling
func (*TensorView) UpdtSliceSize ¶
func (tv *TensorView) UpdtSliceSize() int