#!python
# -*- coding: utf-8 -*-
##########################################################################
# CAPSUL - Copyright (C) CEA, 2013
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########################################################################

# System import
import sys

# Soma import 
from soma.qt_gui import qt_backend
# TODO: add option to set backend before importing QtCore
#qt_backend.set_qt_backend("PyQt4")
#qt_backend.init_matplotlib_backend()
from soma.qt_gui.qt_backend import QtCore


# Create the application
try:
    from capsul.qt_apps.pipeline_viewer_app import PipelineViewerApp
    app = PipelineViewerApp()

# Print an error message if an error occurred
except Exception:
    raise

# Start the qt interaction loop
else:
    QtCore.QObject.connect(app, QtCore.SIGNAL('lastWindowClosed()'), 
                           app, QtCore.SLOT('quit()'))
    sys.exit(app.exec_())
