Module ExampleModule :: Class ExampleDataProviderTwoWay
[hide private]

Class ExampleDataProviderTwoWay

source code


An example dataprovider demonstrating how to partition funtionality in such a way

Instance Methods [hide private]
 
__init__(self)
Constructor should call the base constructor and initialize all variables that are restored from configuration
source code
 
_data_exists(self, LUID)
Returns: True if data at the LUID exists
source code
 
_get_data(self, LUID)
Returns: A ExampleDataType with the specified LUID
source code
 
_put_data(self, data)
Returns: Rid
source code
 
_replace_data(self, LUID, data)
Some dataproviders assign a new LUID when data is replaced.
source code
 
configure(self, window)
Uses the conduit.DataProvider.DataProviderSimpleConfigurator class to show a simple configuration dialog which is just a gtk.Enry where the user can enter one or more GNOME wiki pages names, seperated by commas
source code
 
refresh(self)
The refresh method should do whatever is needed to ensure that a subseqent call to get_all returns the correct result.
source code
 
get_all(self)
Returns the LUIDs of all items to synchronize.
source code
conduit.DataType.DataType
get(self, LUID)
Returns the data identified by the supplied LUID.
source code
 
put(self, data, overwrite, LUID)
Returns: The Rid of the page at location LUID
source code
 
delete(self, LUID)
Not all dataproviders support delete
source code
dict(string)
get_configuration(self)
Returns a dict of key:value pairs.
source code
 
set_configuration(self, config)
If you override this function then you are responsible for checking the sanity of values in the config dict, including setting any instance variables to sane defaults
source code
 
is_configured(self, isSource, isTwoWay)
Returns: True if this instance has been correctly configured, and data can be retrieved/stored into it
source code
string
get_UID(self)
Returns: A string uniquely representing this dataprovider.
source code

Inherited from conduit.dataproviders.DataProvider.DataSource: add, get_changes, get_num_items

Inherited from conduit.dataproviders.DataProvider.DataProviderBase: emit, emit_change_detected, finish, get_configuration_xml, get_input_conversion_args, get_input_type, get_name, get_output_conversion_args, get_output_type, get_status, initialize, is_busy, set_configuration_xml, set_status, uninitialize

Class Variables [hide private]
  _name_ = "Example Dataprovider"
  _description_ = "Demonstrates a Twoway Dataprovider"
  _category_ = DataProviderCategory.DataProviderCategory("Miscel...
  _module_type_ = "twoway"
  _in_type_ = "exampledata"
  _out_type_ = "exampledata"
  _icon_ = "applications-internet"
  DEFAULT_FOO_VALUE = 42

Inherited from conduit.dataproviders.DataProvider.DataProviderBase: __gsignals__, _configurable_

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Constructor should call the base constructor and initialize all variables that are restored from configuration
Overrides: conduit.dataproviders.DataProvider.TwoWay.__init__

_data_exists(self, LUID)

source code 
Returns:
True if data at the LUID exists

_get_data(self, LUID)

source code 
Returns:
A ExampleDataType with the specified LUID

_put_data(self, data)

source code 
Returns:
Rid

_replace_data(self, LUID, data)

source code 
Some dataproviders assign a new LUID when data is replaced. This is the purpose of having replace in a different function to _put

configure(self, window)

source code 
Uses the conduit.DataProvider.DataProviderSimpleConfigurator class to show a simple configuration dialog which is just a gtk.Enry where the user can enter one or more GNOME wiki pages names, seperated by commas
Parameters:
  • window (gtk.Window) - The parent window (used for modal dialogs)
Overrides: conduit.dataproviders.DataProvider.DataProviderBase.configure

refresh(self)

source code 

The refresh method should do whatever is needed to ensure that a subseqent call to get_all returns the correct result.

The refresh method is always called before the sync step. DataSources should always call the base classes refresh() method.
Overrides: conduit.dataproviders.DataProvider.DataProviderBase.refresh

get_all(self)

source code 
Returns the LUIDs of all items to synchronize. DataSources should always call the base classes get_all() method
Returns:
A list of string LUIDs
Overrides: conduit.dataproviders.DataProvider.DataSource.get_all

get(self, LUID)

source code 
Returns the data identified by the supplied LUID.
Parameters:
  • LUID (str) - A LUID which uniquely represents data to return
Returns: conduit.DataType.DataType
An item of data
Overrides: conduit.dataproviders.DataProvider.DataSource.get

put(self, data, overwrite, LUID)

source code 

Stores data. The derived class is responsible for checking if putData conflicts.

In the case of a two-way datasource, the derived type should consider the overwrite parameter, which if True, should allow the dp to replace a datatype instance if one is found at the existing location

Derived classes should call this function to ensure the dataprovider status is updated.
Returns:
The Rid of the page at location LUID
Overrides: conduit.dataproviders.DataProvider.DataSink.put

delete(self, LUID)

source code 
Not all dataproviders support delete
Overrides: conduit.dataproviders.DataProvider.DataSink.delete

get_configuration(self)

source code 

Returns a dict of key:value pairs. Key is the name of an internal variable, and value is its current value to save.

It is important the the key is the actual name (minus the self.) of the internal variable that should be restored when the user saves their settings.
Returns: dict(string)
Dictionary of strings containing application settings
Overrides: conduit.dataproviders.DataProvider.DataProviderBase.get_configuration

set_configuration(self, config)

source code 
If you override this function then you are responsible for checking the sanity of values in the config dict, including setting any instance variables to sane defaults
Overrides: conduit.dataproviders.DataProvider.DataProviderBase.set_configuration

is_configured(self, isSource, isTwoWay)

source code 
Checks if the dp has been configured or not (and if it needs to be)
Returns:
True if this instance has been correctly configured, and data can be retrieved/stored into it
Overrides: conduit.dataproviders.DataProvider.DataProviderBase.is_configured

get_UID(self)

source code 

Returns a UID that represents this dataproviders (locally) unique state and configuration. For example the LUID for a gmail dp may be your username and password.

Derived types MUST overwride this function
Returns: string
A string uniquely representing this dataprovider.
Overrides: conduit.dataproviders.DataProvider.DataProviderBase.get_UID

Class Variable Details [hide private]

_category_

Value:
DataProviderCategory.DataProviderCategory("Miscellaneous", "applicatio\
ns-accessories")