camelot :: view :: proxy :: collection_proxy :: CollectionProxy :: Class CollectionProxy |
[frames] | no frames]

# Class CollectionProxy

The CollectionProxy contains a limited copy of the data in the actual collection, usable for fast visualisation in a QTableView

the CollectionProxy has some class attributes that can be overwritten when subclassing it :

- header_icon : the icon to be used in the vertical header

Instance Methods
__init__(*args, **kwargs) @param admin: the admin interface for the items in the collection |
append(*args, **kwargs) |
columnCount(self, index=None) |
copy_row(*args, **kwargs) Copy the entity associated with this row to the end of the collection :param row: the row number |
data(*args, **kwargs) |
flags(self, index) |
getColumns(self) @return: the columns as set by the setColumns method |
getData(*args, **kwargs) Generator for all the data queried by this proxy |
getItemDelegate(self) a DelegateManager will be available once the item_delegate_changed signal has been emitted |
getRowCount(*args, **kwargs) |
get_admin(self) Get the admin object associated with this model |
get_collection_getter(self) |
get_validator(self) |
handleEntityCreate(self, sender, entity) Handles the entity signal, indicating that the model is out of date |
handleEntityDelete(self, sender, entity) Handles the entity signal, indicating that the model is out of date |
handleEntityUpdate(self, sender, entity) Handles the entity signal, indicating that the model is out of date |
handleRowUpdate(self, row) Handles the update of a row when this row might be out of date |
hasUnflushedRows(self) The model has rows that have not been flushed to the database yet, because the row is invalid |
headerData(*args, **kwargs) In case the columns have not been set yet, don't even try to get information out of them |
insertEntityInstance(*args, **kwargs) Insert object o into this collection :param o: the object to be added to the collection :return: the row at which the object was inserted |
insertRow(*args, **kwargs) |
map_to_source(self, sorted_row_number) Converts a sorted row number to a row number of the source collection |
refresh(*args, **kwargs) |
remove(*args, **kwargs) |
removeEntityInstance(*args, **kwargs) Remove the entity instance o from this collection @param o: the object to be removed from this collection @param delete: delete the object after removing it from the collection |
removeRow(*args, **kwargs) Remove the entity associated with this row from this collection @param delete: delete the entity as well |
revertRow(*args, **kwargs) |
rowCount(self, index=None) |
setColumns(*args, **kwargs) Callback method to set the columns |
setData(self, index, value, role=2) Value should be a function taking no arguments that returns the data to be set |
setRowCount(self, rows) Callback method to set the number of rows @param rows the new number of rows |
set_collection_getter(self, collection_getter) |
sort(*args, **kwargs) reimplementation of the QAbstractItemModel its sort function |
updateUnflushedRows(*args, **kwargs) Verify all rows to see if some of them should be added to the unflushed rows |
Inherited from `PyQt4.QtCore.QAbstractTableModel`: `dropMimeData`, `hasChildren`, `index`, `parent` Inherited from `PyQt4.QtCore.QAbstractItemModel`: `beginInsertColumns`, `beginInsertRows`, `beginMoveColumns`, `beginMoveRows`, `beginRemoveColumns`, `beginRemoveRows`, `beginResetModel`, `buddy`, `canFetchMore`, `changePersistentIndex`, `changePersistentIndexList`, `columnsAboutToBeInserted`, `columnsAboutToBeMoved`, `columnsAboutToBeRemoved`, `columnsInserted`, `columnsMoved`, `columnsRemoved`, `createIndex`, `dataChanged`, `decodeData`, `encodeData`, `endInsertColumns`, `endInsertRows`, `endMoveColumns`, `endMoveRows`, `endRemoveColumns`, `endRemoveRows`, `endResetModel`, `fetchMore`, `hasIndex`, `headerDataChanged`, `insertColumn`, `insertColumns`, `insertRows`, `itemData`, `layoutAboutToBeChanged`, `layoutChanged`, `match`, `mimeData`, `mimeTypes`, `modelAboutToBeReset`, `modelReset`, `persistentIndexList`, `removeColumn`, `removeColumns`, `removeRows`, `reset`, `revert`, `roleNames`, `rowsAboutToBeInserted`, `rowsAboutToBeMoved`, `rowsAboutToBeRemoved`, `rowsInserted`, `rowsMoved`, `rowsRemoved`, `setHeaderData`, `setItemData`, `setRoleNames`, `setSupportedDragActions`, `sibling`, `span`, `submit`, `supportedDragActions`, `supportedDropActions` Inherited from `PyQt4.QtCore.QObject`: `blockSignals`, `childEvent`, `children`, `connect`, `connectNotify`, `customEvent`, `deleteLater`, `destroyed`, `disconnect`, `disconnectNotify`, `dumpObjectInfo`, `dumpObjectTree`, `dynamicPropertyNames`, `emit`, `event`, `eventFilter`, `findChild`, `findChildren`, `inherits`, `installEventFilter`, `isWidgetType`, `killTimer`, `metaObject`, `moveToThread`, `objectName`, `property`, `pyqtConfigure`, `receivers`, `removeEventFilter`, `sender`, `setObjectName`, `setParent`, `setProperty`, `signalsBlocked`, `startTimer`, `thread`, `timerEvent`, `tr`, `trUtf8` Inherited from `sip.simplewrapper`: `__delattr__`, `__getattribute__`, `__new__`, `__setattr__` Inherited from `object`: `__format__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| header_icon = `Icon('tango/16x16/places/folder.png')`
| item_delegate_changed_signal = ``'``2itemDelegateChanged``'``
| rows_removed_signal = ``'``2rowsRemoved(QModelIndex,int,int)``'``
Inherited from `PyQt4.QtCore.QObject`: `staticMetaObject`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(*args, **kwargs) (Constructor) |
@param admin: the admin interface for the items in the collection @param collection_getter: a function that takes no arguments and returns the collection that will be visualized. This function will be called inside the model thread, to prevent delays when this function causes the database to be hit. If the collection is a list, it should not contain any duplicate elements. @param columns_getter: a function that takes no arguments and returns the columns that will be cached in the proxy. This function will be called inside the model thread. Overrides: object.__init__

### columnCount(self, index=None) |
Overrides: PyQt4.QtCore.QAbstractItemModel.columnCount

### data(*args, **kwargs) |
Overrides: PyQt4.QtCore.QAbstractItemModel.data

### flags(self, index) |
Overrides: PyQt4.QtCore.QAbstractItemModel.flags

### getItemDelegate(self) |
a DelegateManager will be available once the item_delegate_changed signal has been emitted Returns: a DelegateManager for this model, or None if no DelegateManager yet available

### headerData(*args, **kwargs) |
In case the columns have not been set yet, don't even try to get information out of them Overrides: PyQt4.QtCore.QAbstractItemModel.headerData

### insertRow(*args, **kwargs) |
Overrides: PyQt4.QtCore.QAbstractItemModel.insertRow

### removeRow(*args, **kwargs) |
Remove the entity associated with this row from this collection @param delete: delete the entity as well Overrides: PyQt4.QtCore.QAbstractItemModel.removeRow

### rowCount(self, index=None) |
Overrides: PyQt4.QtCore.QAbstractItemModel.rowCount

### setColumns(*args, **kwargs) |
Callback method to set the columns @param columns a list with fields to be displayed of the form [('field_name', field_attributes), ...] as returned by the getColumns method of the ElixirAdmin class

### setData(self, index, value, role=2) |
Value should be a function taking no arguments that returns the data to be set This function will then be called in the model_thread Overrides: PyQt4.QtCore.QAbstractItemModel.setData

### sort(*args, **kwargs) |
reimplementation of the QAbstractItemModel its sort function Overrides: PyQt4.QtCore.QAbstractItemModel.sort