# Path: imgfac/Notification.py
# class Notification(object):
#     """ TODO: Docstring for Notification  """
# 
#     message = prop("_message")
#     sender = prop("_sender")
#     user_info = prop("_user_info")
# 
#     def __init__(self, message, sender, user_info=None):
#         """ TODO: Fill me in
#         
#         @param message TODO
#         @param sender TODO
#         @param user_info TODO
#         """
#         self._message = message
#         self._sender = sender
#         self._user_info = user_info


import logging
from .Singleton import Singleton
from .props import prop
from collections import defaultdict
from threading import RLock
from .Notification import Notification
        self.observers[message].discard(_observer)
        if (len(self.observers[message]) == 0):
            del self.observers[message]
        self.lock.release()

    def post_notification(self, notification):
        """
        TODO: Docstring for post_notification
        
        @param notification TODO
        """
        self.lock.acquire()
        _observers = self.observers['all'].union(self.observers[notification.message])
        for _observer in _observers:
            _sender = _observer[2]
            if ((not _sender) or (_sender == notification.sender)):
                try:
                    getattr(_observer[0], _observer[1])(notification)
                except AttributeError as e:
                    self.log.exception('Caught exception: posting notification to object (%s) with method (%s)' % (_observer[0], _observer[1]))
        self.lock.release()

    def post_notification_with_info(self, message, sender, user_info=None):
        """
        TODO: Docstring for post_notification_with_info
        
        @param message TODO
        @param sender TODO
        @param user_info TODO
        """

# Path: imgfac/Notification.py
# class Notification(object):
#     """ TODO: Docstring for Notification  """
# 
#     message = prop("_message")
#     sender = prop("_sender")
#     user_info = prop("_user_info")
# 
#     def __init__(self, message, sender, user_info=None):
#         """ TODO: Fill me in
#         
#         @param message TODO
#         @param sender TODO
#         @param user_info TODO
#         """
#         self._message = message
#         self._sender = sender
#         self._user_info = user_info


# Path: imgfac/NotificationCenter.py
import logging
from .Singleton import Singleton
from .props import prop
from collections import defaultdict
from threading import RLock
from .Notification import Notification

        self.observers[message].discard(_observer)
        if (len(self.observers[message]) == 0):
            del self.observers[message]
        self.lock.release()

    def post_notification(self, notification):
        """
        TODO: Docstring for post_notification
        
        @param notification TODO
        """
        self.lock.acquire()
        _observers = self.observers['all'].union(self.observers[notification.message])
        for _observer in _observers:
            _sender = _observer[2]
            if ((not _sender) or (_sender == notification.sender)):
                try:
                    getattr(_observer[0], _observer[1])(notification)
                except AttributeError as e:
                    self.log.exception('Caught exception: posting notification to object (%s) with method (%s)' % (_observer[0], _observer[1]))
        self.lock.release()

    def post_notification_with_info(self, message, sender, user_info=None):
        """
        TODO: Docstring for post_notification_with_info
        
        @param message TODO
        @param sender TODO
        @param user_info TODO
        """

        self.post_notification(Notification(message, sender, user_info))