Gda.DataProxy¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
set to |
||
r/w |
Tells if changes to the sample of rows displayed is done in background in several steps or if it’s done in one step. |
||
r/w/c |
Proxied data model |
||
r/w |
Tells if a row composed of |
||
r/w/c |
Number of rows which the proxy will contain at any time, like a sliding window on the proxied data model |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Gets emitted when proxy's filter has been changed |
|
Gets emitted when proxy has committed a row change to the proxied data model. |
|
Gets emitted whenever a row has been marked to be deleted, or has been unmarked to be deleted |
|
Gets emitted whenever proxy's sample size has been changed. |
|
Gets emitted whenever proxy's sample size has been changed |
|
Gets emitted when proxy is about to commit a row change to the proxied data model. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
object |
r |
Class Details¶
- class Gda.DataProxy(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(model)¶
- Parameters:
model (
Gda.DataModel
) – Data model to be proxied- Returns:
a new
Gda.DataProxy
object- Return type:
Creates a new proxy for model. For bindings use gda_data_proxy_new_with_data_model.
- classmethod new_with_data_model(model)¶
- Parameters:
model (
Gda.DataModel
) – Data model to be proxied- Returns:
a new
Gda.DataProxy
object- Return type:
Creates a new proxy for model. This is the preferred method to create
Gda.DataProxy
objects by bindings.New in version 5.2.0.
- alter_value_attributes(proxy_row, col, alter_flags)¶
- Parameters:
proxy_row (
int
) – A proxy row numbercol (
int
) – a valid column numberalter_flags (
Gda.ValueAttribute
) – flags to alter the attributes
Alters the attributes of the value stored at (proxy_row, col) in self. the alter_flags can only contain the
Gda.ValueAttribute.IS_NULL
,Gda.ValueAttribute.IS_DEFAULT
andGda.ValueAttribute.IS_UNCHANGED
flags (other flags are ignored).
- apply_all_changes()¶
- Raises:
- Returns:
True
if no error occurred- Return type:
Apply all the changes stored in the proxy to the proxied data model. The changes are done row after row, and if an error occurs, then it is possible that not all the changes to all the rows have been applied.
- apply_row_changes(proxy_row)¶
- Parameters:
proxy_row (
int
) – the row number to commit- Raises:
- Returns:
True
if no error occurred.- Return type:
Commits the modified data in the proxy back into the
Gda.DataModel
.
- cancel_all_changes()¶
-
Cancel all the changes stored in the proxy (the self will be reset to its state as it was just after creation). Note that if there are some cached changes (i.e. not applied to the current proxied data model), then these cached changes are not cleared (set the “cache-changes” property to
False
for this).
- cancel_row_changes(proxy_row, col)¶
- Parameters:
Resets data at the corresponding row and column. If proxy_row corresponds to a new row, then that new row is deleted from self.
- delete(proxy_row)¶
- Parameters:
proxy_row (
int
) – A proxy row number
Marks the row proxy_row to be deleted
- get_filter_expr()¶
-
Get the current filter expression used by self.
- get_filtered_n_rows()¶
- Returns:
the number of filtered rows in self, or -1 if no filter has been applied
- Return type:
Get the total number of filtered rows in self if a filter has been applied. As new rows (rows added to the proxy and not yet added to the proxied data model) and rows to remove (rows marked for removal but not yet removed from the proxied data model) are also filtered, the returned number also contains references to new rows and rows to be removed.
- get_n_modified_rows()¶
- Returns:
the number of modified rows
- Return type:
Get the number of rows which have been modified in the proxy (the sum of rows existing in the proxied data model which have been modified, and new rows).
- get_n_new_rows()¶
- Returns:
the number of new rows
- Return type:
Get the number of rows which have been added to self and which are not part of the proxied data model.
- get_proxied_model()¶
- Returns:
the proxied data model
- Return type:
Fetch the
Gda.DataModel
which self does proxy
- get_proxied_model_n_cols()¶
- Returns:
the number of columns, or -1 if an error occurred
- Return type:
Get the number of columns in the proxied data model
- get_proxied_model_n_rows()¶
- Returns:
the number of rows, or -1 if the number of rows is not known
- Return type:
Get the number of rows in the proxied data model
- get_proxied_model_row(proxy_row)¶
- Parameters:
proxy_row (
int
) – A proxy row number- Returns:
the proxied model’s row, or -1 if self row which only exists self
- Return type:
Get the self's proxied model row corresponding to proxy_row
- get_sample_end()¶
- Returns:
the number of the last proxied model’s row.
- Return type:
Get the number of the last row to be available in self (in reference to the proxied data model)
- get_sample_size()¶
- Returns:
the chunk (or sample) size, or 0 if chunking is disabled.
- Return type:
Get the size of each chunk of data displayed at a time.
- get_sample_start()¶
- Returns:
the number of the first proxied model’s row.
- Return type:
Get the number of the first row to be available in self (in reference to the proxied data model)
- get_value_attributes(proxy_row, col)¶
- Parameters:
- Returns:
a
Gda.ValueAttribute
with the value’s attributes at given position- Return type:
Get the attributes of the value stored at (proxy_row, col) in self, which is an ORed value of
Gda.ValueAttribute
flags
- get_values(proxy_row, cols_index)¶
- Parameters:
- Returns:
a new list of values (the list must be freed, not the values), or
None
if an error occurred- Return type:
Retrieve a whole list of values from the self data model. This function calls gda_data_proxy_get_value() for each column index specified in cols_index, and generates a
GLib.SList
on the way.
- has_changed()¶
-
Tells if self contains any modifications not applied to the proxied data model.
- row_has_changed(proxy_row)¶
-
Tells if the row number proxy_row has changed
- row_is_deleted(proxy_row)¶
- Parameters:
proxy_row (
int
) – A proxy row number- Returns:
True
if the row is marked to be deleted- Return type:
Tells if the row number proxy_row is marked to be deleted.
- row_is_inserted(proxy_row)¶
- Parameters:
proxy_row (
int
) – A proxy row number- Returns:
True
if the row is an inserted row- Return type:
Tells if the row number proxy_row is a row which has been inserted in self (and is thus not in the proxied data model).
- set_filter_expr(filter_expr)¶
- Parameters:
filter_expr (
str
orNone
) – an SQL based expression which will filter the contents of self, orNone
to remove any previous filter- Raises:
- Returns:
True
if no error occurred- Return type:
Sets a filter among the rows presented by self. The filter is defined by a filter expression which can be any SQL valid expression using self's columns. For instance if self has the “id” and “name” columns, then a filter can be “length(name) < 5” to filter only the rows where the length of the name is strictly inferior to 5, or “id >= 1000 and id < 2000 order by name limit 50” to filter only the rows where the id is between 1000 and 2000, ordered by name and limited to 50 rows.
Note about column names: real column names can be used (double quoted if necessary), but columns can also be named “_<column number>” with column numbers starting at 1.
Note that any previous filter expression is replaced with the new filter_expr if no error occurs (if an error occurs, then any previous filter is left unchanged).
- set_ordering_column(col)¶
- Parameters:
col (
int
) – the column number to order from- Raises:
- Returns:
True
if no error occurred- Return type:
Orders by the col column
- set_sample_size(sample_size)¶
- Parameters:
sample_size (
int
) – the requested size of a chunk, or 0
Sets the size of each chunk of data to display: the maximum number of rows which can be “displayed” at a time (the maximum number of rows which self pretends to have). The default value is arbitrary 300 as it is big enough to be able to display quite a lot of data, but small enough to avoid too much data displayed at the same time.
Note: the rows which have been added but not yet committed will always be displayed regardless of the current chunk of data, and the modified rows which are not visible when the displayed chunk of data changes are still held as modified rows.
To remove the chunking of the data to display, simply pass sample_size the %0 value.
- set_sample_start(sample_start)¶
- Parameters:
sample_start (
int
) – the number of the first row to be displayed
Sets the number of the first row to be available in self (in reference to the proxied data model)
- undelete(proxy_row)¶
- Parameters:
proxy_row (
int
) – A proxy row number
Remove the “to be deleted” mark at the row proxy_row, if it existed.
- do_filter_changed() virtual¶
- do_sample_changed(sample_start, sample_end) virtual¶
- do_validate_row_changes(row, proxied_row) virtual¶
- Parameters:
- Return type:
Signal Details¶
- Gda.DataProxy.signals.filter_changed(data_proxy)¶
- Signal Name:
filter-changed
- Flags:
- Parameters:
data_proxy (
Gda.DataProxy
) – The object which received the signal
Gets emitted when proxy's filter has been changed
- Gda.DataProxy.signals.row_changes_applied(data_proxy, row, proxied_row)¶
- Signal Name:
row-changes-applied
- Flags:
- Parameters:
data_proxy (
Gda.DataProxy
) – The object which received the signalrow (
int
) – the proxy’s rowproxied_row (
int
) – the proxied data model’s row
Gets emitted when proxy has committed a row change to the proxied data model.
- Gda.DataProxy.signals.row_delete_changed(data_proxy, row, to_be_deleted)¶
- Signal Name:
row-delete-changed
- Flags:
- Parameters:
data_proxy (
Gda.DataProxy
) – The object which received the signalrow (
int
) – the concerned proxy's rowto_be_deleted (
bool
) – tells if the row is marked to be deleted
Gets emitted whenever a row has been marked to be deleted, or has been unmarked to be deleted
- Gda.DataProxy.signals.sample_changed(data_proxy, sample_start, sample_end)¶
- Signal Name:
sample-changed
- Flags:
- Parameters:
data_proxy (
Gda.DataProxy
) – The object which received the signalsample_start (
int
) – the first row of the samplesample_end (
int
) – the last row of the sample
Gets emitted whenever proxy's sample size has been changed. sample_start and sample_end are in reference to the proxied data model.
- Gda.DataProxy.signals.sample_size_changed(data_proxy, sample_size)¶
- Signal Name:
sample-size-changed
- Flags:
- Parameters:
data_proxy (
Gda.DataProxy
) – The object which received the signalsample_size (
int
) – the new sample size
Gets emitted whenever proxy's sample size has been changed
- Gda.DataProxy.signals.validate_row_changes(data_proxy, row, proxied_row)¶
- Signal Name:
validate-row-changes
- Flags:
- Parameters:
data_proxy (
Gda.DataProxy
) – The object which received the signalrow (
int
) – the proxy’s rowproxied_row (
int
) – the proxied data model’s row
- Returns:
a new
GLib.Error
if validation failed, orNone
- Return type:
Gets emitted when proxy is about to commit a row change to the proxied data model. If any callback returns a non
None
value, then the change commit fails with the returnedGLib.Error
Property Details¶
- Gda.DataProxy.props.cache_changes¶
-
Defines how changes kept in the data proxy are handled when the proxied data model is changed (using the “model” property). The default is to silently discard all the changes, but if this property is set to
True
, then the changes are cached.If set to
True
, each cached change will be re-applied to a newly set proxied data model if the change’s number of columns match the proxied data model’s number of columns and based on:the contents of the proxied data model’s modified row for updates and deletes
the inserts are always kept
New in version 5.2.
- Gda.DataProxy.props.defer_sync¶
-
Tells if changes to the sample of rows displayed is done in background in several steps or if it’s done in one step.
- Gda.DataProxy.props.model¶
- Name:
model
- Type:
- Default Value:
- Flags:
Proxied data model