# Path: argos/info.py
# DEBUGGING = ('-d' in sys.argv or '--debug' in sys.argv)
# TESTING = True # add some test menu options
# PROFILING = False# and DEBUGGING
# VERSION = '0.4.1'
# REPO_NAME = "argos"
# SCRIPT_NAME = "argos"
# PACKAGE_NAME = "argos"
# PROJECT_NAME = "Argos"
# SHORT_DESCRIPTION = "Argos HDF5/NetCDF/scientific data viewer."
# PROJECT_URL = "https://github.com/titusjan/argos"
# AUTHOR = "Pepijn Kenter"
# EMAIL = "titusjan@gmail.com"
# ORGANIZATION_NAME = "titusjan"
# ORGANIZATION_DOMAIN = "titusjan.nl"
# EXIT_CODE_SUCCESS = 0
# EXIT_CODE_ERROR = 1
# EXIT_CODE_COMMAND_ARGS = 2
# EXIT_CODE_RESTART = 66 # Indicates the program is being 'restarted'
# KEY_PROGRAM = '_program'
# KEY_VERSION = '_version'
# def program_directory():
# def resource_directory():
# def icons_directory():
# 
# Path: argos/qt/bindings.py
# API_PYSIDE2 = 'pyside2'
# API_PYQT5 = 'pyqt5'
# ALL_API = [API_PYQT5, API_PYSIDE2]
# QT_API_NAME = os.environ.get('QT_API')
#     QT_API_NAME = None
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2


import logging
import os
import sys
import traceback
from argos import info
from argos.qt.bindings import QtCore, QtWidgets
    else:
        # Constructing a QApplication in case this hasn't been done yet.
        if not QtWidgets.qApp:
            _app = QtWidgets.QApplication()

        msgBox = ResizeDetailsMessageBox()
        msgBox.setText("Bug: uncaught {}".format(exc_type.__name__))
        msgBox.setInformativeText(str(exc_value))
        lst = traceback.format_exception(exc_type, exc_value, exc_traceback)
        msgBox.setDetailedText("".join(lst))
        msgBox.setIcon(QtWidgets.QMessageBox.Warning)
        msgBox.exec_()
        logger.info("Quitting application with exit code 1")
        sys.exit(1)



######################
# QSettings routines #
######################


def getWidgetGeom(widget):
    """ Gets the QWindow or QWidget geometry as a QByteArray.

        Since Qt does not provide this directly we hack this by saving it to the QSettings
        in a temporary location and then reading it from the QSettings.

        :param widget: A QWidget that has a saveGeometry() methods
    """

# Path: argos/info.py
# DEBUGGING = ('-d' in sys.argv or '--debug' in sys.argv)
# TESTING = True # add some test menu options
# PROFILING = False# and DEBUGGING
# VERSION = '0.4.1'
# REPO_NAME = "argos"
# SCRIPT_NAME = "argos"
# PACKAGE_NAME = "argos"
# PROJECT_NAME = "Argos"
# SHORT_DESCRIPTION = "Argos HDF5/NetCDF/scientific data viewer."
# PROJECT_URL = "https://github.com/titusjan/argos"
# AUTHOR = "Pepijn Kenter"
# EMAIL = "titusjan@gmail.com"
# ORGANIZATION_NAME = "titusjan"
# ORGANIZATION_DOMAIN = "titusjan.nl"
# EXIT_CODE_SUCCESS = 0
# EXIT_CODE_ERROR = 1
# EXIT_CODE_COMMAND_ARGS = 2
# EXIT_CODE_RESTART = 66 # Indicates the program is being 'restarted'
# KEY_PROGRAM = '_program'
# KEY_VERSION = '_version'
# def program_directory():
# def resource_directory():
# def icons_directory():
# 
# Path: argos/qt/bindings.py
# API_PYSIDE2 = 'pyside2'
# API_PYQT5 = 'pyqt5'
# ALL_API = [API_PYQT5, API_PYSIDE2]
# QT_API_NAME = os.environ.get('QT_API')
#     QT_API_NAME = None
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2
#         QT_API_NAME = API_PYQT5
#         QT_API_NAME = API_PYSIDE2


# Path: argos/qt/misc.py
import logging
import os
import sys
import traceback
from argos import info
from argos.qt.bindings import QtCore, QtWidgets

    else:
        # Constructing a QApplication in case this hasn't been done yet.
        if not QtWidgets.qApp:
            _app = QtWidgets.QApplication()

        msgBox = ResizeDetailsMessageBox()
        msgBox.setText("Bug: uncaught {}".format(exc_type.__name__))
        msgBox.setInformativeText(str(exc_value))
        lst = traceback.format_exception(exc_type, exc_value, exc_traceback)
        msgBox.setDetailedText("".join(lst))
        msgBox.setIcon(QtWidgets.QMessageBox.Warning)
        msgBox.exec_()
        logger.info("Quitting application with exit code 1")
        sys.exit(1)



######################
# QSettings routines #
######################


def getWidgetGeom(widget):
    """ Gets the QWindow or QWidget geometry as a QByteArray.

        Since Qt does not provide this directly we hack this by saving it to the QSettings
        in a temporary location and then reading it from the QSettings.

        :param widget: A QWidget that has a saveGeometry() methods
    """

    settings = QtCore.QSettings()