DataModel
digraph inheritance5bd44060ab {
bgcolor=transparent;
rankdir=UD;
ratio=compress;
size="8.0, 12.0";
"DataModel" [URL="#taurus.qt.qtcore.communication.DataModel",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="An object containing one piece of data which is intended to be shared. The"];
"QObject" -> "DataModel" [arrowsize=0.5,style="setlinewidth(0.5)"];
"QObject" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QObject(parent: Optional[QObject] = None)"];
"wrapper" -> "QObject" [arrowsize=0.5,style="setlinewidth(0.5)"];
"simplewrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded];
"wrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded];
"simplewrapper" -> "wrapper" [arrowsize=0.5,style="setlinewidth(0.5)"];
}
- class DataModel(parent, dataUID, defaultData=None)[source]
An object containing one piece of data which is intended to be shared. The data will be identified by its UID (a unique identifier known to objects that intend to access the data)
In general, you are not supposed to instantiate objects of this class directly. Instead, you should interact via the
SharedDataManager
, which usesSharedDataManager.__getDataModel()
to ensure that the DataModels are singletons.Import from
taurus.qt.qtcore.communication
as:from taurus.qt.qtcore.communication import DataModel
- connectReader(slot, readOnConnect=True)[source]
Registers the given slot method to receive notifications whenever the data is changed.
- Parameters:
slot (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 (bool) – if True (default) the slot will be called immediately with the current value of the data if the data has been already initialized
See also
- connectWriter(writer, signalname)[source]
Registers the given writer object as a writer of the data. The writer is then expected to emit a QtCore.SIGNAL(signalname) with the new data as the first parameter.
- Parameters:
writer (QObject) – object that will change the data
signalname (str) – the signal name that will notify changes of the data
See also
- dataChanged
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- disconnectReader(slot)[source]
unregister a reader
- Parameters:
slot (callable) – the slot to which this was connected
See also
SharedDataManager.disconnectReader()
, .:meth:getData
- disconnectWriter(writer, signalname)[source]
unregister a writer from this data model
- Parameters:
writer (QObject) – object to unregister
signalname (str) – the signal that was registered
See also
- isDataSet()[source]
Whether the data has been set at least once or if it is uninitialized
- Returns:
True if the data has been set. False it is uninitialized
- Return type:
bool
- readerCount()[source]
returns the number of currently registered readers of this model
- Returns:
- Return type:
int