Muster Notificator Python API (9.0.13+)

The Muster Dispatcher Python API is available under the MNotificatorAPI module starting from Muster 9.0.13. It can be imported into Python by simply typing:

import MNotificatorAPI

Be aware that , even you can import the MNotificatorAPImodule inside any Python script, if will work only inside the Muster builtin Python interpreter and just on the scripts of template functions that are directly invoked by the Notificator applet. You can still import it widely inside any template, but an attempt to call a function of the Notificator from a wrong context, will return an error

A selective way to import modules only when launched from the correct context requires using the builtin muster.runningContext() function call like in the following example:

if (muster.runningContext() == "console"):
    import MConsoleAPI
elif (muster.runningContext() == "dispatcher"):
    import MDispatcherAPI
elif (muster.runningContext() == "renderclient"):
    import MInstanceAPI
elif (muster.runningContext() == "notificator"):
    import MNotificatorAPI

Any function exported by the MNotificatorAPIPython module returns always a MUSTERERR object as first. Each time you invoke a function, you must always check against the MUSTERERR object to check if the function has been invoked successfully.

In addition, the function may return a tuple instead of a single object with additional objects. Refer to each function specific documentation for a list of the returned objects:

import MNotificatorAPI

The family of the MNotificatorAPIfunctions can be invoked from within the following contexts:

  • A custom command from the Dispatcher versus the notificator, into a template onCustomMessage
Function nameExpected parametersAdditional returned objectsMeaning
getMainDialog()NonePointer to QT main dialog windowReturns a string containing a memory pointer to the QT QDialog object that may be used to parent your Pyside widgets
dispatcherSendCustomMessage()template ID, messageNoneSends a custom message to the Dispatcher global template and to an optional template ID (9.0.13+)
  • muster/9.0/notificatorapi.txt
  • Last modified: 2019/04/23 12:30
  • by admin