예제 #1
0
            "Usage: id29_create_thumbnail image_directory_path image1 [image2]"
        )
        sys.exit(1)
    EDVerbose.screen("Arguments: %r" % sys.argv)
    strPathToTempDir = tempfile.mkdtemp(prefix="id29_create_thumbnail_")
    os.chdir(strPathToTempDir)
    EDVerbose.setLogFileName(
        os.path.join(strPathToTempDir, "id29_create_thumbnail.log"))
    strImageDirectory = sys.argv[1]
    listImageName = sys.argv[2:]
    # Quick check if the two image names are the same. If they are launch the thumbnail generator only once
    if len(listImageName) == 2:
        if listImageName[0] == listImageName[1]:
            listImageName = [listImageName[0]]
    for strImageName in listImageName:
        xsDataInputPyarchThumbnailGenerator = XSDataInputPyarchThumbnailGenerator(
        )
        xsDataInputPyarchThumbnailGenerator.setWaitForFileTimeOut(
            XSDataTime(1000))
        strImagePath = os.path.join(strImageDirectory, strImageName)
        xsDataInputPyarchThumbnailGenerator.setDiffractionImage(
            XSDataFile(XSDataString(strImagePath)))
        EDVerbose.screen(
            "XML input for EDPluginControlPyarchThumbnailGeneratorv1_0: %s" %
            xsDataInputPyarchThumbnailGenerator.marshal())
        edPluginControlPyarchThumbnailGeneratorv1_0 = EDPluginControlPyarchThumbnailGeneratorv1_0(
        )
        edPluginControlPyarchThumbnailGeneratorv1_0.setDataInput(
            xsDataInputPyarchThumbnailGenerator)
        edPluginControlPyarchThumbnailGeneratorv1_0.execute()
예제 #2
0
    EDVerbose.setVerboseDebugOn()
    # Sleep a random time 0-2s in order to avoid problems if many instances started at the same time
    fSleepTime = random.random()*2.0
    EDVerbose.DEBUG("Sleeping for %.2f s" % fSleepTime)
    time.sleep(fSleepTime)
    # Popolate input data
    EDVerbose.screen("Starting id29_create_thumbnail")
    # If no arguments stop
    if len(sys.argv) <= 2:
        EDVerbose.screen("Usage: id29_create_thumbnail image_directory_path image1 [image2]" )
        sys.exit(1)
    EDVerbose.screen("Arguments: %r" % sys.argv)
    strPathToTempDir = tempfile.mkdtemp(prefix="id29_create_thumbnail_")
    os.chdir(strPathToTempDir)
    EDVerbose.setLogFileName(os.path.join(strPathToTempDir, "id29_create_thumbnail.log"))
    strImageDirectory = sys.argv[1]
    listImageName = sys.argv[2:]
    # Quick check if the two image names are the same. If they are launch the thumbnail generator only once
    if len(listImageName) == 2:
        if listImageName[0] == listImageName[1]:
            listImageName = [ listImageName[0] ]
    for strImageName in listImageName:
        xsDataInputPyarchThumbnailGenerator = XSDataInputPyarchThumbnailGenerator()
        xsDataInputPyarchThumbnailGenerator.setWaitForFileTimeOut(XSDataTime(1000))
        strImagePath = os.path.join(strImageDirectory, strImageName)
        xsDataInputPyarchThumbnailGenerator.setDiffractionImage(XSDataFile(XSDataString(strImagePath)))
        EDVerbose.screen("XML input for EDPluginControlPyarchThumbnailGeneratorv1_0: %s" % xsDataInputPyarchThumbnailGenerator.marshal())
        edPluginControlPyarchThumbnailGeneratorv1_0 = EDPluginControlPyarchThumbnailGeneratorv1_0()
        edPluginControlPyarchThumbnailGeneratorv1_0.setDataInput(xsDataInputPyarchThumbnailGenerator)
        edPluginControlPyarchThumbnailGeneratorv1_0.execute()
예제 #3
0
        EDVerbose.screen("Usage: id29_create_thumbnail image_directory_path image1 [image2]" )
        sys.exit(1)
    EDVerbose.screen("Arguments: %r" % sys.argv)
    # Remove duplicates
    listImageName = list(set(sys.argv[2:]))
    # Strip off prefix
    listPrefix = listImageName[0].split("_")
    strPrefix = "{0}_{1}".format(listPrefix[0], listPrefix[1]) 
    # Check if a temp working directory should be created
    if "CREATE_THUMBNAIL_WORKING_DIR" in os.environ:
        strPathToTempDir = tempfile.mkdtemp(prefix="thumbnail-{0}-".format(strPrefix), 
                                            dir=os.environ["CREATE_THUMBNAIL_WORKING_DIR"])
    else:
        strTmpUser = os.path.join("/tmp", os.environ["USER"])
        if not os.path.exists(strTmpUser):
            os.mkdir(strTmpUser, 0o755)
        strPathToTempDir = tempfile.mkdtemp(prefix="thumbnail-{0}-".format(strPrefix), dir=strTmpUser)
    os.chmod(strPathToTempDir, 0o755)
    os.chdir(strPathToTempDir)
    EDVerbose.setLogFileName(os.path.join(strPathToTempDir, "id29_create_thumbnail.log"))
    strImageDirectory = sys.argv[1]
    for strImageName in listImageName:
        xsDataInputPyarchThumbnailGenerator = XSDataInputPyarchThumbnailGenerator()
        xsDataInputPyarchThumbnailGenerator.setWaitForFileTimeOut(XSDataTime(1000))
        strImagePath = os.path.join(strImageDirectory, strImageName)
        xsDataInputPyarchThumbnailGenerator.setDiffractionImage(XSDataFile(XSDataString(strImagePath)))
        EDVerbose.screen("XML input for EDPluginControlPyarchThumbnailGeneratorv1_0: %s" % xsDataInputPyarchThumbnailGenerator.marshal())
        edPluginControlPyarchThumbnailGeneratorv1_0 = EDPluginControlPyarchThumbnailGeneratorv1_0()
        edPluginControlPyarchThumbnailGeneratorv1_0.setDataInput(xsDataInputPyarchThumbnailGenerator)
        edPluginControlPyarchThumbnailGeneratorv1_0.execute()