def convert_page(k): png = "cam/page-%03d.png" % k if not os.path.isfile(png): png = "cam/page-%02d.png" % k if not os.path.isfile(png): print "done?" raise SystemExit bmp = "cam/page-%03d.bmp" % k bmh = "cam/page-%03d.bmh" % k print "remapping %s..." % png im = flipud(imread(png)) if im.max() <= 1: im *= 255 imr = remap_rgb(im,M) #print imr save_img(imr[1:481,0:720],M,bmp) system_or_exit("ruby ../src/convertrle.rb %s" % bmp) system_or_exit("rm %s" % bmp) system_or_exit("rm %s" % png) system_or_exit("mv %s.rle %s" % (bmp, bmh))
txt += l m = re.match("^\*\*(.*)\*\*\ *$", l) if m: item = m.groups()[0] txt += r""" .. raw:: latex \addcontentsline{toc}{subsubsection}{%s} """ % item.replace("**", "").replace("_", r"\_") f = open(file, "w") f.write(txt) f.close() system_or_exit( "montage ../data/cropmks/CineSco2.bmp ../data/cropmks/CrssMtr2.bmp ../data/cropmks/Passport.bmp ../data/cropmks/PhiPhoto.bmp -tile 4x1 -geometry 300x200+5+5 Cropmarks550D.png" ) f = open("FEATURES.txt").readlines() m = open("MANUAL.txt").readlines() c = open("CONFIG.txt").readlines() o = open("userguide.rst", "w") print >> o, """Magic Lantern v2.3 -- User's Guide ==================================================== """ include(o, "FEATURES.txt") include(o, "MANUAL.txt", 1) include(o, "MENUSTART.txt") include(o, "MN-AUDIO.txt")
\newpage """ txt += l if m: item = m.groups()[0] txt += r""" .. raw:: latex \addcontentsline{toc}{subsubsection}{%s} """ % item.replace("**","").replace("_", r"\_") f = open(file,"w") f.write(txt) f.close() system_or_exit(r"sed -i -e s/.*{{.*}}.*//g userguide.rst") system_or_exit("pandoc -f rst -t latex -o credits.tex CREDITS.txt") fixwikilinks("userguide.rst") #~ labelhack("userguide.rst") #~ add_menu_items_to_contents("userguide.rst") #system_or_exit("pandoc -f rst -t latex -o userguide-body.tex userguide.rst") system_or_exit(r"sed -i -e 's/^#.*$//g' userguide.rst") system_or_exit("%s userguide.rst --output-encoding=utf8 --template=ug-template-cam.tex --table-style booktabs > UserGuide-cam.tex" % (rst2latex,)) system_or_exit("sed -i \"/\\\\label{[^}]*}%$/d\" UserGuide-cam.tex") #~ system_or_exit(r"sed -i -e 's/\\{\\{.*\\}\\}//g' UserGuide-cam.tex") sub("UserGuide-cam.tex", r"\\subsubsection", r"\\newpage\\subsubsection") sub("UserGuide-cam.tex", r"\\subsection", r"\\newpage\\subsection") system_or_exit(r"sed -i -e 's/width=10cm/width=7cm/g' UserGuide-cam.tex") # hack for liveview screen
txt = "" for l in open(file).readlines(): txt += l m = re.match("^\*\*(.*)\*\*\ *$", l) if m: item = m.groups()[0] txt += r""" .. raw:: latex \addcontentsline{toc}{subsubsection}{%s} """ % item.replace("**","").replace("_", r"\_") f = open(file,"w") f.write(txt) f.close() system_or_exit("montage ../data/cropmks/CineSco2.bmp ../data/cropmks/CrssMtr2.bmp ../data/cropmks/Passport.bmp ../data/cropmks/PhiPhoto.bmp -tile 4x1 -geometry 300x200+5+5 Cropmarks550D.png") f = open("FEATURES.txt").readlines(); m = open("MANUAL.txt").readlines(); c = open("CONFIG.txt").readlines(); o = open("userguide.rst", "w") print >> o, """Magic Lantern v2.3 -- User's Guide ==================================================== """ include(o, "FEATURES.txt"); include(o, "MANUAL.txt", 1); include(o, "MENUSTART.txt"); include(o, "MN-AUDIO.txt"); include(o, "MN-EXPO.txt");