-
Notifications
You must be signed in to change notification settings - Fork 52
[Bindings.Sofa.Helper] Add MessageHandler context manager class #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bindings/Sofa/src/SofaPython3/Sofa/Helper/Binding_MessageHandler.cpp
Outdated
Show resolved
Hide resolved
bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp
Outdated
Show resolved
Hide resolved
|
|
||
| m.def("init", []() { | ||
| MessageDispatcher::clearHandlers(); | ||
| MessageDispatcher::addHandler(&MainConsoleMessageHandler::getInstance()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
Ok for me, and tests have passed 👍 |
…-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
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