traits_futures.qt.message_router module

Message routing for the Qt toolkit.

class traits_futures.qt.message_router.MessageReceiver[source]

Bases: traits.has_traits.HasStrictTraits

Main-thread object that receives messages from a MessageSender.

message = Event(Any())

Event fired when a message is received from the paired sender.

class traits_futures.qt.message_router.MessageRouter[source]

Bases: traits.has_traits.HasStrictTraits

Router for messages, sent by means of Qt signals and slots.

Requires the event loop to be running in order for messages to arrive.

close_pipe(sender, receiver)[source]

Close an unused pipe.


Prepare router for routing.


Undo any connections made by the connect call.


Create a (sender, receiver) pair for sending messages.


  • sender (MessageSender) – Object to be passed to the background task to send messages.

  • receiver (MessageReceiver) – Object to be kept in the foreground which reacts to messages.

receiver_done = Event(Instance(MessageReceiver))

Event fired when a receiver is dropped from the routing table.

class traits_futures.qt.message_router.MessageSender(connection_id, signallee, message_queue)[source]

Bases: object

Object allowing the worker to send messages.

This class will be instantiated in the main thread, but passed to the worker thread to allow the worker to communicate back to the main thread.

Only the worker thread should use the send method, and only inside a “with sender:” block.


Send a message to the router.