Package camelot :: Package camelot :: Package view :: Package proxy :: Module collection_proxy :: Class CollectionProxy
[hide private]
[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

Instance Methods [hide private]
 
__init__(self, admin, collection_getter, columns_getter, max_number_of_rows=10, edits=None, flush_changes=True) 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(self) source code
 
revertRow(self, row) source code
 
refresh(self) source code
 
setCollectionGetter(self, collection_getter) 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, primary_keys)
Handles the entity signal, indicating that the model is out of date
source code
 
handleEntityCreate(self, entity, primary_keys)
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) source code
 
getColumns(self) source code
 
setColumns(self, columns)
Callback method to set the columns
source code
 
rowCount(self, index=None) source code
 
columnCount(self, index=None) source code
 
headerData(self, section, orientation, role)
In case the columns have not been set yet, don't even try to get information out of them
source code
 
data(self, index, role) source code
 
setData(self, index, value, role=Qt.EditRole)
Value should be a function taking no arguments that returns the data to be set
source code
 
flags(self, index) source code
 
_extend_cache(self, offset, limit)
Extend the cache around row
source code
 
_get_object(self, row)
Get the object corresponding to row
source code
 
_cache_extended(self, offset, limit) source code
 
_get_row_data(self, row, role)
Get the data which is to be visualized at a certain row of the table, if needed, post a refill request the cache to get the object and its neighbours in the cache, meanwhile, return an empty object
source code
 
remove(self, o) source code
 
append(self, o) source code
 
removeEntityInstance(self, o) source code
 
removeRow(self, row) source code
 
insertEntityInstance(self, row, o) source code
 
insertRow(self, row, entity_instance_getter) source code
 
__del__(self) source code
Method Details [hide private]

__init__(self, admin, collection_getter, columns_getter, max_number_of_rows=10, edits=None, flush_changes=True)
(Constructor)

source code 
Parameters:
  • admin - the admin interface for the items in the collection
  • 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.
  • 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

getRowCount(self)

source code 
Decorators:
  • @model_function

revertRow(self, row)

source code 
Decorators:
  • @gui_function

setColumns(self, columns)

source code 

Callback method to set the columns

@param columns a list with fields to be displayed

headerData(self, section, orientation, role)

source code 

In case the columns have not been set yet, don't even try to get information out of them

Decorators:
  • @gui_function

data(self, index, role)

source code 
Decorators:
  • @gui_function

setData(self, index, value, role=Qt.EditRole)

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

_extend_cache(self, offset, limit)

source code 

Extend the cache around row

Decorators:
  • @model_function

_get_object(self, row)

source code 

Get the object corresponding to row

Decorators:
  • @model_function

_get_row_data(self, row, role)

source code 

Get the data which is to be visualized at a certain row of the table, if needed, post a refill request the cache to get the object and its neighbours in the cache, meanwhile, return an empty object

Parameters:
  • role - Qt.EditRole or Qt.DisplayRole

remove(self, o)

source code 
Decorators:
  • @model_function

append(self, o)

source code 
Decorators:
  • @model_function

removeEntityInstance(self, o)

source code 
Decorators:
  • @model_function

removeRow(self, row)

source code 
Decorators:
  • @gui_function

insertEntityInstance(self, row, o)

source code 
Decorators:
  • @model_function

insertRow(self, row, entity_instance_getter)

source code 
Decorators:
  • @gui_function