File indexing completed on 2024-05-12 05:34:51

0001 import sys
0002 import os
0003 
0004 configs = ["left_ptr.in", "help.in", "progress.in", "wait.in", "cross.in", "text.in", "pencil.in", "circle.in", "size_ver.in", "size_hor.in", "size_fdiag.in", "size_bdiag.in", "fleur.in", "up_arrow.in", "pointer.in"]
0005 
0006 if len(sys.argv) < 4:
0007     print "too few arguments for wincursor"
0008     sys.exit(1)
0009 
0010 pngdir = sys.argv[1]
0011 conf = sys.argv[2]
0012 outdir = sys.argv[3]
0013 dummy = sys.argv[4]
0014 
0015 f = open(dummy, "w")
0016 f.close()
0017 
0018 if not configs.count(conf[conf.rfind("/")+1:]):
0019     sys.exit(0)
0020 else:
0021     conffile = conf[conf.rfind("/")+1:]
0022 
0023 f = open(conf)
0024 r = f.read()
0025 f.close()
0026 
0027 ls = r.split("\n")
0028 imglist = []
0029 
0030 for l in ls:
0031     if l and not l.startswith("#"):
0032         v = l.split(" ")
0033         if len(v) == 4:
0034             imglist += [(v[3], v[1], v[2])]
0035         elif len(v) == 5:
0036             imglist += [(v[3], v[1], v[2], v[4])]
0037 
0038 if len(imglist) > 1:
0039     pngls = [os.path.join(pngdir, i[0]) for i in imglist]
0040     pngstr = ""
0041     for p in pngls:
0042         pngstr += " %s" % p
0043     
0044     img = imglist[0]
0045     jiffie = int((float(img[3]) / 1000) * 60)
0046             
0047     print os.popen4("png2ico %s --hotspotx %s --hotspoty %s --framerate %s %s" % (os.path.join(outdir, conffile.replace(".in", ".ani")), img[1], img[2], jiffie, pngstr))[1].read()
0048 elif len(imglist) == 1:
0049     img = imglist[0]
0050     print os.popen4("png2ico %s --hotspotx %s --hotspoty %s %s" % (os.path.join(outdir, conffile.replace(".in", ".cur")), img[1], img[2], os.path.join(pngdir, img[0])))[1].read()