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: QObject

Publish 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:
  • topic (TopicLike)

  • parent (QtCore.QObject | None)

  • session (EzSession | None)

  • queue_policy (QueuePolicy)

  • max_pending (int | None)

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)

property topic: Enum | str | None#

The topic this publisher is bound to.

property session: EzSession | None#

The session this publisher is attached to, if any.

emit(message)[source]#

Send a message to the topic.

The message is queued and sent asynchronously by the background thread.

Parameters:

message (Any) – The message to publish.

Return type:

None

set_topic(topic)[source]#

Switch to a new topic on a running session.

Return type:

None

Parameters:

topic (Enum | str)

clear_topic()[source]#

Unpublish from the current topic on a running session.

Return type:

None

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 )#