Login
Back to bricks list
Introduction Version

MessageDispatcher

Class to dispatch messages to observers. It has a built in buffer to merge messages and dispatch them in a single call to the observers.

:return: description :rtype: type

Attributes

interval_time_dispatched_buffer: floatinterval_time_merging_message: floatmessage_level: MessageLevel

Functions

__INIT__

Initialize self. See help(type(self)) for accurate signature.

Parameters:
NameTypeDefault valueDescription
interval_time_merging_messagefloat 0.1
interval_time_dispatched_bufferint 1
log_levelMessageLevel INFO
ATTACH

Attach the listener method and return an id to detach it later

Parameters:
NameTypeDefault valueDescription
observerMessageObserver
ATTACH_PROGRESS_BAR

Attach a progress bar to update task messages when a message is sent. return an id to detach it later

Parameters:
NameTypeDefault valueDescription
progress_barProgressBar
Return type:
ProgressBarMessageObserver
DETACH
Parameters:
NameTypeDefault valueDescription
observerMessageObserver
FORCE_DISPATCH_WAITING_MESSAGES
HAS_OBSERVERS
NOTIFY_DEBUG_MESSAGE

Trigger a debug in each subscriber.

Parameters:
NameTypeDefault valueDescription
messagestr
NOTIFY_ERROR_MESSAGE

Trigger a error in each subscriber.

Parameters:
NameTypeDefault valueDescription
messagestr
NOTIFY_INFO_MESSAGE

Trigger an info in each subscriber.

Parameters:
NameTypeDefault valueDescription
messagestr
NOTIFY_MESSAGE

Trigger a message in each subscriber.

Parameters:
NameTypeDefault valueDescription
messageDispatchedMessage
NOTIFY_PROGRESS_VALUE

Trigger an update in each subscriber.

Parameters:
NameTypeDefault valueDescription
progressfloat
messagestr
NOTIFY_SUCCESS_MESSAGE

Trigger a success in each subscriber.

Parameters:
NameTypeDefault valueDescription
messagestr
NOTIFY_WARNING_MESSAGE

Trigger a warning in each subscriber.

Parameters:
NameTypeDefault valueDescription
messagestr