9from abc
import ABC, abstractmethod
10from threading
import Lock
11from io
import StringIO
13from .handlerchain_message_class
import Message
77 copyof_MessageHandlers =
None
81 for window
in copyof_MessageHandlers:
82 if window.ProcessMessage(message):
98 if window.ID == handler.ID:
117 if window.ID == handler.ID:
133 copyof_MessageHandlers =
None
137 for window
in copyof_MessageHandlers:
138 output.write(
" {0}\n".format(window.ToString()))
139 return output.getvalue()
str ToString(self)
Convert this HandlerChain to a string, protected by a multi-threading lock.
_messageHandlersLock
Lock object used to lock access to the message handlers list for multi-threaded support.
def SendMessage(self, Message message)
Send a message to each of the handlers in the list, protected by a multi-threading lock.
None AddHandler(self, IMessageHandler window)
Add an instance of the IMessageHandler interface to end of the list of handlers, protected by a multi...
_messageHandlers
The list of message handlers.
None __init__(self)
Constructor.
None RemoveHandler(self, IMessageHandler window)
Remove an instance of the IMessageHandler interface from the list, protected by a multi-threading loc...
Represents a handler in a chain of handlers.
bool ProcessMessage(self, Message message)
Called with a message on each window.
str ToString(self)
Convert the handler to a string.
int ID(self)
Property getter for the ID of the window: value = o.ID.