3 from optparse
import OptionParser
8 def for_every_file(top1
, top2
, my_function
):
9 '''recursively descend the directory tree rooted at top,
10 calling the my_function function for each regular file'''
12 for f1
in os
.listdir(top1
):
13 for f2
in os
.listdir(top2
):
14 pathname
= os
.path
.join(top2
, f2
)
15 mode
= os
.stat(pathname
)[ST_MODE
]
17 # It's a directory, recurse into it
18 for_every_file(f1
, f2
, my_function
)
20 # It's a file, call the my_function function
23 # Unknown file type, print a message
24 print 'Skipping %s' % pathname
27 if __name__
== "__main__":
30 gui
.add_option("-s", "--steps", action
="store", type="int", dest
="steps")
31 gui
.add_option("-b", "--button", action
="store", dest
="button")
32 (options
, paths
) = gui
.parse_args()
34 for dirpath0
, dirnames0
, filenames0
in os
.walk(paths
[0]):
35 for myfont0
in filenames0
:
36 for dirpath1
, dirnames1
, filenames1
in os
.walk(paths
[1]):
37 for myfont1
in filenames1
:
39 myfont0_times_myfont1
= lib
.InterpolateFonts(os
.path
.join(dirpath0
, myfont0
), os
.path
.join(dirpath1
, myfont1
), options
.button
, options
.steps
)
40 myfont0_times_myfont1
.font_info()
41 myfont0_times_myfont1
.interpolate()
43 # myfont1_times_myfont0 = lib.InterpolateFonts(os.path.join(dirpath1, myfont1), os.path.join(dirpath0, myfont0), options.button, options.steps)
44 # myfont1_times_myfont0.font_info()
45 # myfont1_times_myfont0.interpolate()