Esempio n. 1
0
def start(open_file_path=None, reset_settings=False):
    ###### Setup directories ######
    app = QtGui.QApplication(sys.argv)
    app.setApplicationName(PROGRAM_NAME)
    app.setOrganizationName(ORGANIZATION_NAME)

    # Make working directory for python and R and sets up r_tmp (where R does
    # its calculations. Also clears r_tmp
    ## N.B. This MUST come after setting the app name and stuff in order for the
    # paths and subsequent calls to get_base_path() to work correctly
    setup_directories()

    if reset_settings:
        ome_globals.reset_settings()

    splash_pixmap = QPixmap(":/splash/splash.png")
    splash = QSplashScreen(splash_pixmap)
    # splash = QSplashScreen( QPixmap(300, 200) )
    splash.show()
    # app.processEvents()

    # time.sleep(1)

    splash_starttime = time.time()
    load_R_libraries(app, splash)

    # Show splash screen for at least SPLASH_DISPLAY_TIME seconds
    time_elapsed = time.time() - splash_starttime
    print ("It took %s seconds to load the R libraries" % str(time_elapsed))
    if time_elapsed < SPLASH_DISPLAY_TIME:  # seconds
        print ("Going to sleep for %f seconds" % float(SPLASH_DISPLAY_TIME - time_elapsed))
        QThread.sleep(int(SPLASH_DISPLAY_TIME - time_elapsed))
        print ("woke up")

    # create and show the main window
    form = main_form.MainForm()
    form.show()
    # form.raise_()
    if open_file_path:
        form.open(open_file_path)

    # Close the splash screen
    splash.finish(form)

    sys.exit(app.exec_())
Esempio n. 2
0
def start():
    app = QtGui.QApplication(sys.argv)
    
    splash_pixmap = QPixmap(":/misc/splash.png")
    splash = QSplashScreen(splash_pixmap)
    splash.show()
    splash_starttime = time.time()
    
    load_R_libraries(app, splash)
    
    # Show splash screen for at least SPLASH_DISPLAY_TIME seconds
    time_elapsed  = time.time() - splash_starttime
    print("It took %s seconds to load the R libraries" % str(time_elapsed))
    if time_elapsed < SPLASH_DISPLAY_TIME: # seconds
        print("Going to sleep for %f seconds" % float(SPLASH_DISPLAY_TIME-time_elapsed))
        QThread.sleep(int(SPLASH_DISPLAY_TIME-time_elapsed))

    meta = meta_form.MetaForm()
    splash.finish(meta)
    meta.show()
    meta.start()
    sys.exit(app.exec_())