# Path: wimpiggy/log.py
# class Logger(object):
#     def __init__(self, base=None):
#         if base is None:
#             base = sys._getframe(1).f_globals["__name__"]
#         self._base = base
# 
#     def getLogger(self, type=None):
#         name = self._base
#         if type:
#             name += ". " + type
#         return logging.getLogger(name)
# 
#     def log(self, level, msg, *args, **kwargs):
#         if kwargs.get("exc_info") is True:
#             kwargs["exc_info"] = sys.exc_info()
#         type = None
#         if "type" in kwargs:
#             type = kwargs["type"]
#             del kwargs["type"]
#         self.getLogger(type).log(level, msg, *args, **kwargs)
# 
#     def _method_maker(level):
#         return (lambda self, msg, *args, **kwargs:
#                 self.log(level, msg, *args, **kwargs))
# 
#     debug = _method_maker(logging.DEBUG)
#     __call__ = debug
#     info = _method_maker(logging.INFO)
#     warn = _method_maker(logging.WARNING)
#     error = _method_maker(logging.ERROR)


import sys
import gtk.gdk
from wimpiggy.log import Logger

    def call_unsynced(self, fun, *args, **kwargs):
        return self._call(True, fun, args, kwargs)

    def call_synced(self, fun, *args, **kwargs):
        return self._call(False, fun, args, kwargs)

    call = call_unsynced

    def swallow_unsynced(self, fun, *args, **kwargs):
        try:
            self.call_unsynced(fun, *args, **kwargs)
        except XError, e:
            log("Ignoring X error: %s", e)
            pass
        return None

    def swallow_synced(self, fun, *args, **kwargs):
        try:
            self.call_synced(fun, *args, **kwargs)
        except XError, e:
            log("Ignoring X error: %s", e)
            pass
        return None

    swallow = swallow_unsynced

    def assert_out(self):
        assert self.depth == 0


# Path: wimpiggy/log.py
# class Logger(object):
#     def __init__(self, base=None):
#         if base is None:
#             base = sys._getframe(1).f_globals["__name__"]
#         self._base = base
# 
#     def getLogger(self, type=None):
#         name = self._base
#         if type:
#             name += ". " + type
#         return logging.getLogger(name)
# 
#     def log(self, level, msg, *args, **kwargs):
#         if kwargs.get("exc_info") is True:
#             kwargs["exc_info"] = sys.exc_info()
#         type = None
#         if "type" in kwargs:
#             type = kwargs["type"]
#             del kwargs["type"]
#         self.getLogger(type).log(level, msg, *args, **kwargs)
# 
#     def _method_maker(level):
#         return (lambda self, msg, *args, **kwargs:
#                 self.log(level, msg, *args, **kwargs))
# 
#     debug = _method_maker(logging.DEBUG)
#     __call__ = debug
#     info = _method_maker(logging.INFO)
#     warn = _method_maker(logging.WARNING)
#     error = _method_maker(logging.ERROR)


# Path: wimpiggy/error.py
import sys
import gtk.gdk
from wimpiggy.log import Logger


    def call_unsynced(self, fun, *args, **kwargs):
        return self._call(True, fun, args, kwargs)

    def call_synced(self, fun, *args, **kwargs):
        return self._call(False, fun, args, kwargs)

    call = call_unsynced

    def swallow_unsynced(self, fun, *args, **kwargs):
        try:
            self.call_unsynced(fun, *args, **kwargs)
        except XError, e:
            log("Ignoring X error: %s", e)
            pass
        return None

    def swallow_synced(self, fun, *args, **kwargs):
        try:
            self.call_synced(fun, *args, **kwargs)
        except XError, e:
            log("Ignoring X error: %s", e)
            pass
        return None

    swallow = swallow_unsynced

    def assert_out(self):
        assert self.depth == 0


trap = _ErrorManager()