A Python add-in or script can issue Showcase messages using either the ScriptRunnerBase.sendMessageSync() function or the MessageSender.sendMessage() function.
sendMessageSync(self, messageId, messageData, userConditions=None, userTimeout=None)
sendMessage(self, messageId, messageData, requestUndo = true)
- messageId - Name of the message. For example, if you want to update the status bar, this argument would be "STATUSBAR_SET_TEXT".
- messageData - List of arguments for the message. Each message has a different number and type of arguments. These must be matched exactly.
Even when a message has a single argument, you must specify a list containing a single element. In the status bar update example,
the argument would be ("Some text to go to status bar",).
- userConditions - Optional argument. If specified, no further messages will be sent using the sendMessageSync() method until the conditions specified are satisfied. If not specified, a condition registry is searched for an entry corresponding
to the message being sent and will be used instead. A simple condition is a name of the message which must be received before
the message sending can proceed. For example, specifying ENVIRONMENT_RENAMED will ensure that no further messages are sent until an ENVIRONMENT_RENAMED message is processed. A more complex condition may allow any of a number of messages to trigger this and is specified using
Python lambda notation. For example, specifying lambda messages, message: SELECTION_CHANGED in messages or SELECTION_UNCHANGED in messages will stop the message sending until either SELECTION_CHANGED or SELECTION_UNCHANGED message is seen.
- userTimeout - Optional argument. Works in tandem with userConditions. If specified, it overrides the default from the condition registry.
It signifies the number of seconds to wait for the user condition to be satisfied. If a message unlocking the processing is
not seen within the timeout period the processing will proceed. Specifying a negative number will have you wait indefinitely.