ezmsg.qt.publisher#
EzPublisher - Send messages to ezmsg topics from Qt widgets.
Classes
- class EzPublisher(topic=None, parent=None, *, session=None, queue_policy='unbounded', max_pending=None)[source]#
Bases:
QObjectPublish messages to an ezmsg topic.
EzPublisher provides a Qt-native interface for publishing to ezmsg topics. Messages are queued and sent asynchronously, allowing non-blocking operation from the Qt main thread.
Example
- class MyWidget(QtWidgets.QWidget):
- def __init__(self):
super().__init__() self.settings_pub = EzPublisher(
VelocityTopic.INPUT_SETTINGS, parent=self, session=session
) self.slider.valueChanged.connect(self.send_settings)
- def send_settings(self, value):
self.settings_pub.emit(VelocitySettings(gain=value))
- Parameters:
- switch_started#
Qt signal:
switch_started(PyObject)
- topic_changed#
Qt signal:
topic_changed(PyObject)
- topic_cleared#
Qt signal:
topic_cleared()
- switch_failed#
Qt signal:
switch_failed(PyObject,QString)
- __init__(topic=None, parent=None, *, session=None, queue_policy='unbounded', max_pending=None)[source]#
Create a publisher for an ezmsg topic.
- Parameters:
topic (
Enum|str|None) – The initial topic to publish to, or None to start unpublished.parent (
QObject|None) – Optional parent QObject for lifecycle management.session (EzSession | None)
queue_policy (Literal['unbounded', 'block', 'drop_oldest', 'drop_latest', 'coalesce_latest'])
max_pending (int | None)
- emit(message)[source]#
Send a message to the topic.
The message is queued and sent asynchronously by the background thread.
- staticMetaObject = PySide6.QtCore.QMetaObject("EzPublisher" inherits "QObject": Methods: #4 type=Signal, signature=switch_started(PyObject), parameters=PyObject #5 type=Signal, signature=topic_changed(PyObject), parameters=PyObject #6 type=Signal, signature=topic_cleared() #7 type=Signal, signature=switch_failed(PyObject,QString), parameters=PyObject, QString )#