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

# Class CollectionProxy

source code

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 | source code
get_validator(self) | source code
map_to_source(self, sorted_row_number) Converts a sorted row number to a row number of the source collection | source code
updateUnflushedRows(*args, **kwargs) Verify all rows to see if some of them should be added to the unflushed rows | source code
hasUnflushedRows(self) The model has rows that have not been flushed to the database yet, because the row is invalid | source code
getRowCount(*args, **kwargs) | source code
revertRow(*args, **kwargs) | source code
refresh(*args, **kwargs) | source code
set_collection_getter(self, collection_getter) | source code
get_collection_getter(self) | source code
handleRowUpdate(self, row) Handles the update of a row when this row might be out of date | source code
handleEntityUpdate(self, sender, entity) Handles the entity signal, indicating that the model is out of date | source code
handleEntityDelete(self, sender, entity) Handles the entity signal, indicating that the model is out of date | source code
handleEntityCreate(self, sender, entity) Handles the entity signal, indicating that the model is out of date | source code
setRowCount(self, rows) Callback method to set the number of rows @param rows the new number of rows | source code
getItemDelegate(self) a DelegateManager will be available once the item_delegate_changed signal has been emitted | source code
getColumns(self) @return: the columns as set by the setColumns method | source code
setColumns(*args, **kwargs) Callback method to set the columns | source code
rowCount(self, index=None) | source code
columnCount(self, index=None) | source code
headerData(*args, **kwargs) In case the columns have not been set yet, don't even try to get information out of them | source code
sort(*args, **kwargs) reimplementation of the QAbstractItemModel its sort function | source code
data(*args, **kwargs) | source code
setData(self, index, value, role=2) Value should be a function taking no arguments that returns the data to be set | source code
flags(self, index) | source code
remove(*args, **kwargs) | source code
append(*args, **kwargs) | source code
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 | source code
removeRow(*args, **kwargs) Remove the entity associated with this row from this collection @param delete: delete the entity as well | source code
copy_row(*args, **kwargs) Copy the entity associated with this row to the end of the collection :param row: the row number | source code
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 | source code
insertRow(*args, **kwargs) | source code
getData(*args, **kwargs) Generator for all the data queried by this proxy | source code
get_admin(self) Get the admin object associated with this model | source code
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) | source code
@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. Decorators: `@gui_function` Overrides: object.__init__

### updateUnflushedRows(*args, **kwargs) | source code
Verify all rows to see if some of them should be added to the unflushed rows Decorators: `@model_function`

### getRowCount(*args, **kwargs) | source code
Decorators: `@model_function`

### revertRow(*args, **kwargs) | source code
Decorators: `@gui_function`

### refresh(*args, **kwargs) | source code
Decorators: `@gui_function`

### getItemDelegate(self) | source code
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

### setColumns(*args, **kwargs) | source code
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 Decorators: `@gui_function`

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

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

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

### sort(*args, **kwargs) | source code
reimplementation of the QAbstractItemModel its sort function Decorators: `@gui_function` Overrides: PyQt4.QtCore.QAbstractItemModel.sort

### data(*args, **kwargs) | source code
Decorators: `@gui_function` Overrides: PyQt4.QtCore.QAbstractItemModel.data

### setData(self, index, value, role=2) | source code
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

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

### remove(*args, **kwargs) | source code
Decorators: `@model_function`

### append(*args, **kwargs) | source code
Decorators: `@model_function`

### removeEntityInstance(*args, **kwargs) | source code
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 Decorators: `@model_function`

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

### copy_row(*args, **kwargs) | source code
Copy the entity associated with this row to the end of the collection :param row: the row number Decorators: `@gui_function`

### insertEntityInstance(*args, **kwargs) | source code
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 Decorators: `@model_function`

### insertRow(*args, **kwargs) | source code
Decorators: `@gui_function` Overrides: PyQt4.QtCore.QAbstractItemModel.insertRow

### getData(*args, **kwargs) | source code
Generator for all the data queried by this proxy Decorators: `@model_function`