Skip to content

Conversation

@marques-bruno
Copy link
Member

@marques-bruno marques-bruno commented Jun 19, 2020

This PR lets you write MessageHandlers in Python.
It also lets you instantiate them in a RAII way by taking advantage of Python3's context managers.

All you have to do is implement the process function in a MessageHandler-inherited python class (see diff in Message.py)
@damienmarchal @jnbrunet


m.def("init", []() {
MessageDispatcher::clearHandlers();
MessageDispatcher::addHandler(&MainConsoleMessageHandler::getInstance());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il n'y a pas de singletont pour ConsoleMessageHandler.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Désolé oublié de référence la PR SOFA associée : sofa-framework/sofa#1434

@jnbrunet
Copy link
Contributor

Ok for me, and tests have passed 👍

@jnbrunet jnbrunet merged commit 8d789ed into master Jul 23, 2020
@marques-bruno marques-bruno deleted the add_MessageHandler branch September 10, 2020 13:41
@guparan guparan added this to the v20.12 milestone Oct 26, 2021
ScheiklP added a commit to ScheiklP/SofaPython3 that referenced this pull request Dec 13, 2021
…-framework#18)

* WIP: Add MessageHandler context manager class

* ADD ConsoleMessageHandler at simu init

* Working MessageHandler with context

* Placing MessageHandlers (Console and PerComponent) in SofaRuntime.init()

* Cleanup

* Update CMakeLists.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants