NaviNIBS.Navigator.GUI.CollectionModels package¶
- class NaviNIBS.Navigator.GUI.CollectionModels.CollectionTableModelBase(*, session)[source]¶
Bases:
Generic
[K
,C
,CI
]- Parameters:
_session
- sigSelectionChanged: Signal¶
- class NaviNIBS.Navigator.GUI.CollectionModels.CollectionTableModel(columns=NOTHING, attrColumns=NOTHING, derivedColumns=NOTHING, boolColumns=NOTHING, decoratedColumns=NOTHING, editableColumns=NOTHING, columnLabels=NOTHING, editableColumnValidators=NOTHING, derivedColumnSetters=NOTHING, isSelectedAttr=None, hasPlaceholderNewRow=False, placeholderNewRowDefaults=NOTHING, addNewRowFromEditedPlaceholder=None, *, session)[source]¶
Bases:
CollectionTableModelBase
[K
,C
,CI
],QAbstractTableModel
- Parameters:
_session
_columns
_attrColumns
_derivedColumns – Mapping from column key to function which generates derived value for given key/index
_boolColumns – Columns (attr or derived) that should be represented by a checkbox
_decoratedColumns – Columns (attr or derived) that include an icon. Values of referenced columns should be (QIcon, text) tuples. Usually, it will be necessary to set up a derived column for proper formatting.
_editableColumns
_columnLabels – Mapping from column key to nice label; if a key is not included, will be used directly as a label
_editableColumnValidators – Mapping from column key to validator function which returns True if passed (prevVal, newVal) is valid
_derivedColumnSetters – “ Mapping from (editable, derived) column key to a setter function which, given a key/index and a newly-edited string value, applies changes to the underlying collection. E.g. may be used for converting string text field to float for a numeric attribute.
_isSelectedAttr – Key of attr in collection indicating selection status; if None, selection state will not be synced to model; partially reliant on connected CollectionTableWidget to implement
_hasPlaceholderNewRow – Whether to include a row at end of table as a placeholder for adding a new entry
_placeholderNewRowDefaults – When including a row at end of table as a placeholder for adding a new entry, what defaults should be shown. This is a mapping from columnKey -> default value. If a column is not present in mapping, its default will be empty or false.
_addNewRowFromEditedPlaceholder – When user tries editing the placeholder row, a new row should be added to the collection. Specify how to create a new collection entry by providing a function that accepts as arguments any edited kwargs (e.g. a new key), creates an instance of a collection item, and adds this to the model, and returns the corresponding key. Only used if hasPlaceholderNewRow is True. If not specified, columns in the placeholder row will not be editable even if they are editable in other rows. For example, using typical GenericCollection and GenericCollectionItem subclasses:: def addNewRow(**kwargs) -> str: item = CollectionItem(**kwargs) collection.addItem(item) return item.key addNewRowFromEditedPlaceholder=addNewRow
- property collection¶
- property collectionIsDict¶
- property columns¶
Note: result may be modified in place within modifyingColumns() context
- property attrColumns¶
Note: result may be modified in place within modifyingColumns() context
- property derivedColumns¶
Note: result may be modified in place within modifyingColumns() context
- setWhichItemsSelected(selectedKeys)[source]¶
To be called by CollectionTableWidget to update model tracking of selection state. Does not directly change actual view selection state.
- staticMetaObject = PySide6.QtCore.QMetaObject("CollectionTableModel" inherits "QAbstractTableModel": )¶
- class NaviNIBS.Navigator.GUI.CollectionModels.FilteredCollectionModel(*, session)[source]¶
Bases:
CollectionTableModelBase
[K
,C
,CI
],QSortFilterProxyModel
Base class for models that filter a collection model, e.g. Targets subset
- Parameters:
_session
- staticMetaObject = PySide6.QtCore.QMetaObject("FilteredCollectionModel" inherits "QSortFilterProxyModel": )¶
Submodules¶
- NaviNIBS.Navigator.GUI.CollectionModels.DigitizedLocationsTableModel module
- NaviNIBS.Navigator.GUI.CollectionModels.FiducialsTableModels module
- NaviNIBS.Navigator.GUI.CollectionModels.HeadPointsTableModel module
- NaviNIBS.Navigator.GUI.CollectionModels.HotkeysTableModel module
- NaviNIBS.Navigator.GUI.CollectionModels.SamplesTableModel module
- NaviNIBS.Navigator.GUI.CollectionModels.TargetsTableModel module
- NaviNIBS.Navigator.GUI.CollectionModels.ToolsTableModel module