def main(argv): ''' This is the entry point into the application ''' #=============================================================================== # # write errors to a log file # try: # sys.stderr = open('Log/error.log', 'w') # sys.stdout = open('Log/output.log', 'w') # except (IOError, OSError), e: # error = unicode(e) # #print "output.log write error " + error # MessageBox(0, "This is an error message related to writing debugging files \ # for the CAPS Scenario Builder Beta version. The error is: " + error, "Debug Error") #=============================================================================== # create Qt application app = QtGui.QApplication(argv, True) # set parameters for using the QSettings class to store persistent values app.setOrganizationName("UMass, Amherst") app.setOrganizationDomain("umass.edu") app.setApplicationName("CAPS Scenario Builder") # add a splash screen on startup mySplashPix = QtGui.QPixmap("./csb_splash.png") mySplashPixScaled = mySplashPix.scaled(648,408,QtCore.Qt.KeepAspectRatio) mySplash = QtGui.QSplashScreen(mySplashPixScaled) mySplash.show() # initialize qgis libraries QgsApplication.setPrefixPath(qgis_prefix, True) QgsApplication.initQgis() # create main window mainwindow = MainWindow(mySplash) mainwindow.show() # Start the app up retval = app.exec_() def closeApp(): ''' Manage app termination ''' print "caps.closeApp() called" app.closeAllWindows app.quit() # We exited the Qt app so time to clean up the Qgis app QgsApplication.exitQgis() #app.exitQgis() sys.exit(retval) # Create connection for app finish QtCore.QObject.connect(app, QtCore.SIGNAL("aboutToQuit()"), closeApp())
def main(argv): # create Qt application app = QtGui.QApplication(argv, True) # add a splash screen on startup mySplashPix = QtGui.QPixmap(QtCore.QString("./CAPS_splash.png")) mySplashPixScaled = mySplashPix.scaled(500,300,QtCore.Qt.KeepAspectRatio) mySplash = QtGui.QSplashScreen(mySplashPixScaled) mySplash.show() # initialize qgis libraries QgsApplication.setPrefixPath(qgis_prefix, True) QgsApplication.initQgis() # create main window mainwindow = MainWindow(mySplash) mainwindow.show() # Start the app up retval = app.exec_() # For some unknown reason, # close app needs to be referenced before the connection below def closeApp(): ''' Manage app termination ''' print "caps.closeApp() called" app.closeAllWindows app.quit() # We exited the Qt app so time to clean up the Qgis app QgsApplication.exitQgis() #app.exitQgis() sys.exit(retval) # Create connection for app finish QtCore.QObject.connect(app, QtCore.SIGNAL("aboutToQuit()"), closeApp())
app.setOrganizationDomain("umass.edu") app.setApplicationName("CAPS Scenario Builder") # add a splash screen on startup mySplashPix = QtGui.QPixmap("./csb_splash.png") mySplashPixScaled = mySplashPix.scaled(648,408,QtCore.Qt.KeepAspectRatio) mySplash = QtGui.QSplashScreen(mySplashPixScaled) mySplash.show() # initialize qgis libraries QgsApplication.setPrefixPath(qgis_prefix, True) QgsApplication.initQgis() # create main window mainwindow = MainWindow(mySplash) mainwindow.show() # Start the app up retval = app.exec_() def closeApp(): ''' Manage app termination ''' print "caps.closeApp() called" app.closeAllWindows app.quit() # We exited the Qt app so time to clean up the Qgis app QgsApplication.exitQgis() #app.exitQgis()