Stefano B wrote:
> Ciao
>   
>> Ho preparato uno script che mi converte SVG in WMF per ogni cartella di
>> OpenGallery (e crea una sottodirectory wmf in modo che Gallery non trovi
>> altre directory sotto da includere). Ma ho due problemi:
>>     
>
> si può vedere?
>   
Cero che si. Eccolo in allegato. (Quando l'ho fatto usavo Mandrake -
richiede sia python che inkscape)
>   
>>     * la conversione svg-wmf riesco a farla solo con skconvert (credo
>>       utility di InkSkape - ho insallato tutti i programmi per SVG e non
>>       ricordo a chi appartiene  l'utility) che non converte
>>       correttamente  quasi il 60% delle clipart.
>>     

#!/usr/bin/python
# code taken from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/300411

import os, sys
import re
import fileinput
import getopt

def main(root, filelist):
    """main(root, filelist) -> None
    
    Override this function, to do whatever you please with the list of files
    passed in filelist. The default behaviour is to call the function rename(),
    which applies a set of rules to sanitize a filename.
    """
    print "got %s: %s" % (root, filelist)
    dir2=root+"/wmf/"
    
    x=root[len(root)-3:len(root)]
    #print "x ["+x+"]\n"
    
    #print "root [",root,"]\n"
    if x <> "wmf":
        command1="mkdir "+dir2
        zutin, zutout = os.popen4(command1)
        zutin.close()
        #print zutout.read()
        zutout.close()
        print command1, "\n"
    
        for x in filelist:
            print "\n____________________________________________________________\n"
            n1=root+"/"+x
            nx=dir2+x
            n2=nx[:len(nx)-3]+"wmf"
            command2="skconvert "+n1+" "+n2+" &"
            print command2, "\n"
            
            zutin, zutout = os.popen4(command2)
            zutin.close()
            print zutout.read()
            zutout.close()



if __name__ == '__main__':
   
    recurse  = True
    filetype = ".svg"
    args="."

    filelist = []
    
    print os.path.basename(args)
    
    for fl in args:
        if os.path.isfile(fl):
            filelist.append(fl)
        if os.path.isdir(fl) and recurse == True:
            for root, dirs, files in os.walk(fl):
                if filetype != 'all':
                    files = [ f for f in files if f.endswith(filetype) ]
                main(root, files)
                
    if filetype != 'all':
        filelist = [ f for f in filelist if f.endswith(filetype) ]
    main(os.getcwd(), filelist)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Rispondere a