Beispiel #1
0
def main(): 
    import optparse
    import pkg_resources
    import sys

    configurationFile = pkg_resources.resource_filename( __name__, '/conf/default.conf' )

    commandLine = optparse.OptionParser(description='Schottky Shell Executable', version=__version__, usage="%prog [options]")
    commandLine.add_option('--configurationFile', 	'-C', action='append', dest='configurationFiles')
    commandLine.add_option('--debug', 		        '-d', action='count', dest='_debugLevel')
    commandLine.add_option('--formats',	        	'-F', action='store', metavar='%s',dest='outputFormats')
    commandLine.add_option('--knob',	        	'-K', action='append', metavar='%s',dest='knobs')
    commandLine.add_option('--measurement',		'-M', action='append', metavar='%s',dest='measurements')
    commandLine.add_option('--name',			'-N', action='store', metavar='%s',default=PROCESS_NAME)
    commandLine.add_option('--outputFileName',		'-O', action='store', metavar='%s')
    commandLine.add_option('--numberOfSteps',		'-S', action='store', type=int)
    commandLine.add_option('--settlingPause',		'-P', action='store', type=float)
    commandLine.add_option('--intrameasurementPause',	'-Q', action='store', type=float)
    commandLine.add_option('--verbose', 		'-v', action='count', dest='verboseLevel')
    commandLine.add_option('--dryRun',          	'-x', action='store_true', default=False)
    options, arguments = commandLine.parse_args()

    if (options._debugLevel): 
        print >>sys.stderr, options.__dict__
        print >>sys.stderr, arguments

    try :
        qApp = QCoreApplication(sys.argv) 
        process = LPvExperimentProcess()
        QObject.connect(process,SIGNAL("finished(int,int)"),qApp,SLOT("quit()"),Qt.QueuedConnection)
        process.setOptions(options)
        process.start()
        outputFileName = process.getOutputFileName()
        print outputFileName
        sys.exit(qApp.exec_())
    except KeyboardInterrupt as e:
        print ""
        print "... Ctrl-C caught ..."
        print "Goodbye!"