taurus taurus

Previous topic

DataModel

Next topic

taurus.qt.qtcore.configuration

This Page

SharedDataManager

Inheritance diagram of SharedDataManager

class SharedDataManager(parent)

Bases: PyQt4.QtCore.QObject

A Factory of DataModel objects. The __getDataModel() method ensures that the created DataModels are singletons. DataModels are not kept alive unless there at least some Reader or Writer registered to it (or another object referencing them)

activeDataUIDs()

Returns a list of currently shared data. Note that this list only reflects the situation at the moment of calling this method: a given DataModel may die at any moment if there are no references to it.

Return type::class:~`list` <:class:~`str`>
Returns:UIDs of currently shared data.
connectReader(dataUID, slot, readOnConnect=True)

Registers the given slot method to receive notifications whenever the data identified by dataUID is changed.

Note that it returns the DataModel.getData() method for the given data UID, which can be used for reading the data at any moment.

Parameters:
  • dataUID (:class:~`str`) – the unique identifier of the data
  • slot (:class:~`callable`) – a method that will be called when the data changes this slot will be the receiver of a signal which has the data as its first argument.
  • readOnConnect (:class:~`bool`) – if True (default) the slot will be called immediately with the current value of the data if the data has been already initialized
Return type:

:class:~`callable`

Returns:

a callable that can be used for reading the data

See also

connectWriter(), __getDataModel()

connectWriter(dataUID, writer, signalname)

Registers the given writer object as a changer of the shared data identified by dataUID. The writer is then expected to emit a QtCore.SIGNAL(signalname) with the new data as the first parameter

Note that it returns the DataModel.setData() method for the given data UID, which can be used for changing the data at any moment.

Parameters:
  • dataUID (:class:~`str`) – the unique identifier of the data
  • writer (:class:~`QObject`) – object that will change the data
  • signalname (:class:~`str`) – the signal name that will notify changes of the data
Return type:

:class:~`callable`

Returns:

a callable that can be used for setting the data. When using it, one parameter has to be passed containing the new data

See also

connectWriter(), __getDataModel()

debugReader(data)

A slot which you can connect as a reader for debugging. It will print info to the stdout

disconnectReader(dataUID, slot)

Unregister the given method as data receiver

Parameters:
  • dataUID (:class:~`str`) – the unique identifier of the data
  • slot (:class:~`str`) – the slot that was registered
disconnectWriter(dataUID, writer, signalname)

Unregister the given object as writer of the shared data

Parameters:
  • dataUID (:class:~`str`) – the unique identifier of the data
  • writer (:class:~`QObject`) – object to unregister
  • signalname (:class:~`str`) – the signal that was registered
info()