not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / cursors / src / wincursor.py
blobddb5e52861a4836e58a4915396ea023fbcd98a39
1 import sys
2 import os
4 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"]
6 if len(sys.argv) < 4:
7 print "too few arguments for wincursor"
8 sys.exit(1)
10 pngdir = sys.argv[1]
11 conf = sys.argv[2]
12 outdir = sys.argv[3]
13 dummy = sys.argv[4]
15 f = open(dummy, "w")
16 f.close()
18 if not configs.count(conf[conf.rfind("/")+1:]):
19 sys.exit(0)
20 else:
21 conffile = conf[conf.rfind("/")+1:]
23 f = open(conf)
24 r = f.read()
25 f.close()
27 ls = r.split("\n")
28 imglist = []
30 for l in ls:
31 if l and not l.startswith("#"):
32 v = l.split(" ")
33 if len(v) == 4:
34 imglist += [(v[3], v[1], v[2])]
35 elif len(v) == 5:
36 imglist += [(v[3], v[1], v[2], v[4])]
38 if len(imglist) > 1:
39 pngls = [os.path.join(pngdir, i[0]) for i in imglist]
40 pngstr = ""
41 for p in pngls:
42 pngstr += " %s" % p
44 img = imglist[0]
45 jiffie = int((float(img[3]) / 1000) * 60)
47 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()
48 elif len(imglist) == 1:
49 img = imglist[0]
50 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()