NaviNIBS.Navigator.GUI.CollectionModels package

Bases: Generic[K, C, CI]

Parameters:

_session

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

Note: result may be modified in place within modifyingColumns() context

Note: result may be modified in place within modifyingColumns() context

Note: result may be modified in place within modifyingColumns() context

Return type:

int

Return type:

int

Return type:

~qtpy.QtCore.

Return type:

Any

Return type:

Any

Return type:

bool

Return type:

Optional[~CI]

Return type:

Optional[~K]

Return type:

Optional[int]

To be called by CollectionTableWidget to update model tracking of selection state. Does not directly change actual view selection state.

Return type:

bool

Bases: CollectionTableModelBase[K, C, CI], QSortFilterProxyModel

Base class for models that filter a collection model, e.g. Targets subset

Parameters:

_session

Return type:

bool

Return type:

bool

Return type:

Optional[~CI]

Return type:

Optional[str]

Return type:

Optional[int]

Return type:

bool

Submodules