# Path: objbrowser/qtpy/QtCore.py

# 
# Path: objbrowser/qtpy/QtWidgets.py

# 
# Path: objbrowser/version.py
# DEBUGGING = False
# 
# PROGRAM_NAME = 'objbrowser'


import sys, logging, traceback
from objbrowser.qtpy import QtCore, QtWidgets
from objbrowser.version import DEBUGGING, PROGRAM_NAME
        from IPython.core.getipython import get_ipython
        from IPython import version_info
                from IPython.lib.guisupport import is_event_loop_running_qt4, start_event_loop_qt4
        elif version_info[0] == 5 and version_info[1] <= 1:
            # The is_event_loop_running_qt4 function is broken in IPython 5.0 and 5.1.
            # https://github.com/ipython/ipython/issues/9974
            logger.debug("Event loop integration does not work in IPython 5.0 and 5.1")
        else:
            try:
                if is_event_loop_running_qt4(qApp):
                    logger.info("IPython event loop already running. GUI integration possible.")
                else:
                    # No gui integration
                    logger.info("Starting (non-interactive) IPython event loop")
                    start_event_loop_qt4(qApp) # exit code always 0
                return
            except Exception as ex:
                logger.warning("Unable to start IPython Qt event loop: {}".format(ex))
                logger.warning("Falling back on non-interactive event loop: {}".format(ex))

    logger.info("Starting (non-interactive) event loop")
    return qApp.exec_()


def handleException(exc_type, exc_value, exc_traceback):
    """ Causes the application to quit in case of an unhandled exception (as God intended)
        Shows an error dialog before quitting when not in debugging mode.
    """

    traceback.format_exception(exc_type, exc_value, exc_traceback)
    
    logger.critical("Bug: uncaught {}".format(exc_type.__name__), 
                    exc_info=(exc_type, exc_value, exc_traceback))

# Path: objbrowser/qtpy/QtCore.py

# 
# Path: objbrowser/qtpy/QtWidgets.py

# 
# Path: objbrowser/version.py
# DEBUGGING = False
# 
# PROGRAM_NAME = 'objbrowser'


# Path: objbrowser/app.py
import sys, logging, traceback
from objbrowser.qtpy import QtCore, QtWidgets
from objbrowser.version import DEBUGGING, PROGRAM_NAME
        from IPython.core.getipython import get_ipython
        from IPython import version_info
                from IPython.lib.guisupport import is_event_loop_running_qt4, start_event_loop_qt4

        elif version_info[0] == 5 and version_info[1] <= 1:
            # The is_event_loop_running_qt4 function is broken in IPython 5.0 and 5.1.
            # https://github.com/ipython/ipython/issues/9974
            logger.debug("Event loop integration does not work in IPython 5.0 and 5.1")
        else:
            try:
                if is_event_loop_running_qt4(qApp):
                    logger.info("IPython event loop already running. GUI integration possible.")
                else:
                    # No gui integration
                    logger.info("Starting (non-interactive) IPython event loop")
                    start_event_loop_qt4(qApp) # exit code always 0
                return
            except Exception as ex:
                logger.warning("Unable to start IPython Qt event loop: {}".format(ex))
                logger.warning("Falling back on non-interactive event loop: {}".format(ex))

    logger.info("Starting (non-interactive) event loop")
    return qApp.exec_()


def handleException(exc_type, exc_value, exc_traceback):
    """ Causes the application to quit in case of an unhandled exception (as God intended)
        Shows an error dialog before quitting when not in debugging mode.
    """

    traceback.format_exception(exc_type, exc_value, exc_traceback)
    
    logger.critical("Bug: uncaught {}".format(exc_type.__name__), 
                    exc_info=(exc_type, exc_value, exc_traceback))

    if DEBUGGING: