Wrapper system for the QApplication creation process to handle all proper
    pre-application setup.  This method will verify that there is no application
    running, creating one if necessary.  If no application is created, a None
    value is returned - signaling that there is already an app running.  If you
    need to specify your own QApplication subclass, you can do so through the 
    applicationType parameter.
    
    :note       This method should always be used with the exec_ method to 
                handle the post setup process.
    
    :param      applicationName | <str>
                applicationType | <subclass of QApplication> || None
                style    | <str> || <QStyle> | style to use for the new app
                splash   | <str> | filepath to use for a splash screen
                splashType   | <subclass of QSplashScreen> || None
                splashTextColor   | <str> || <QColor>
                splashTextAlign   | <Qt.Alignment>
    
    :usage      |import projexui
                |
                |def main(argv):
                |   # initialize the application
                |   data = projexui.setup()
                |   
                |   # do some initialization code
                |   window = MyWindow()
                |   window.show()
                |   
                |   # execute the application
                |   projexui.exec_(window, data)
    
    :return     { <str> key: <variant> value, .. }

def setup(applicationName,
          applicationType=None,
          style='plastique',
          splash='',
          splashType=None,
          splashTextColor='white',
          splashTextAlign=None,
          theme=''):
    """
    Wrapper system for the QApplication creation process to handle all proper
    pre-application setup.  This method will verify that there is no application
    running, creating one if necessary.  If no application is created, a None
    value is returned - signaling that there is already an app running.  If you
    need to specify your own QApplication subclass, you can do so through the 
    applicationType parameter.
    
    :note       This method should always be used with the exec_ method to 
                handle the post setup process.
    
    :param      applicationName | <str>
                applicationType | <subclass of QApplication> || None
                style    | <str> || <QStyle> | style to use for the new app
                splash   | <str> | filepath to use for a splash screen
                splashType   | <subclass of QSplashScreen> || None
                splashTextColor   | <str> || <QColor>
                splashTextAlign   | <Qt.Alignment>
    
    :usage      |import projexui
                |
                |def main(argv):
                |   # initialize the application
                |   data = projexui.setup()
                |   
                |   # do some initialization code
                |   window = MyWindow()
                |   window.show()
                |   
                |   # execute the application
                |   projexui.exec_(window, data)
    
    :return     { <str> key: <variant> value, .. }
    """
    import_qt(globals())
    
    output = {}
    
    # check to see if there is a qapplication running
    if not QtGui.QApplication.instance():
        # make sure we have a valid QApplication type
        if applicationType is None:
            applicationType = QtGui.QApplication
        
        app = applicationType([applicationName])
        app.setApplicationName(applicationName)
        app.setQuitOnLastWindowClosed(True)
        
        stylize(app, style=style, theme=theme)
        
        # utilized with the projexui.config.xschemeconfig
        app.setProperty('useScheme', wrapVariant(True))
        output['app'] = app
    
    # create a new splash screen if desired
    if splash:
        if not splashType:
            splashType = XLoggerSplashScreen
        
        pixmap = QtGui.QPixmap(splash)
        screen = splashType(pixmap)
        
        if splashTextAlign is None:
            splashTextAlign = QtCore.Qt.AlignLeft | QtCore.Qt.AlignBottom
        
        screen.setTextColor(QtGui.QColor(splashTextColor))
        screen.setTextAlignment(splashTextAlign)
        screen.show()
        
        QtGui.QApplication.instance().processEvents()
        
        output['splash'] = screen
    
    return output