Esempio n. 1
0
File: tex.py Progetto: yunzhishi/src
def pstexpen(target=None, source=None, env=None):
    "Convert vplot to EPS"
    global colorfigs, geomanuscript, plotoption

    vpl = str(source[0])
    eps = str(target[0])
    ploption = plotoption.get(eps, "")

    if vpl[-len(pssuffix) :] == pssuffix:
        try:
            vplfile = open(vpl, "r")
            epsfile = open(eps, "w")
            epsfile.write(vplfile.read())
            vplfile.close()
            epsfile.close()
        except:
            sys.stderr.write("EPS write failed\n")
            return 1
    else:
        try:
            import vpconvert

            options = "color=n fat=1 fatmult=1.5 invras=y"
            name = os.path.splitext(os.path.basename(eps))[0]
            if "ALL" in colorfigs or name in colorfigs:
                options += " color=y"
            if geomanuscript:
                options += " serifs=n"
            elif slides:
                options += " fat=2 txscale=1.25"
            if ploption:
                options += ploption
            vpconvert.convert(vpl, eps, "eps", None, options)
        except:
            sys.stderr.write("vpconvert failed\n")
            return 1
    return 0
Esempio n. 2
0
def pstexpen(target=None, source=None, env=None):
    "Convert vplot to EPS"
    global colorfigs, geomanuscript, plotoption

    vpl = str(source[0])
    eps = str(target[0])
    ploption = plotoption.get(eps, '')

    if vpl[-len(pssuffix):] == pssuffix:
        try:
            vplfile = open(vpl, 'r')
            epsfile = open(eps, 'w')
            epsfile.write(vplfile.read())
            vplfile.close()
            epsfile.close()
        except:
            sys.stderr.write('EPS write failed\n')
            return 1
    else:
        try:
            import vpconvert
            options = 'color=n fat=1 fatmult=1.5 invras=y'
            name = os.path.splitext(os.path.basename(eps))[0]
            if 'ALL' in colorfigs or name in colorfigs:
                options += ' color=y'
            if geomanuscript:
                options += ' serifs=n'
            elif slides:
                options += ' fat=2 txscale=1.25'
            if ploption:
                options += ploption
            vpconvert.convert(vpl, eps, 'eps', None, options)
        except:
            sys.stderr.write('vpconvert failed\n')
            return 1
    return 0
Esempio n. 3
0
File: tex.py Progetto: cako/src
def pstexpen(target=None,source=None,env=None):
    "Convert vplot to EPS"
    global colorfigs, geomanuscript, plotoption

    vpl = str(source[0])
    eps = str(target[0])
    ploption = plotoption.get(eps,'')

    if vpl[-len(pssuffix):]==pssuffix:
        try:
            vplfile = open(vpl,'r')
            epsfile = open(eps,'w')
            epsfile.write(vplfile.read())
            vplfile.close()
            epsfile.close()
        except:
            sys.stderr.write('EPS write failed\n')
            return 1
    else:
        try:
            import vpconvert
            options = 'color=n fat=1 fatmult=1.5 invras=y'
            name = os.path.splitext(os.path.basename(eps))[0]
            if 'ALL' in colorfigs or name in colorfigs:
                options += ' color=y'
            if geomanuscript:
                options += ' serifs=n'
            elif slides:
                options += ' fat=2 txscale=1.25'
            if ploption:
                options += ploption
            vpconvert.convert(vpl,eps,'eps',None,options)
        except:
            sys.stderr.write('vpconvert failed\n')
            return 1
    return 0
Esempio n. 4
0
def convert(vpl, format, opts, pars):
    '''Convert a VPL file'''
    if not os.path.isfile(vpl):
        showerror("ERROR", "Can't find " + vpl)
        return

    new = '.'.join([os.path.splitext(vpl)[0], format.lower()])
    opts = ' '.join(
        map(lambda x: '='.join([x, str(pars[x].get())]),
            pars.keys())) + ' ' + opts

    fail = vpconvert.convert(vpl, new, format, None, opts, False)

    run = "%s to %s using \"%s\"" % (vpl, new, opts)
    if fail:
        showerror("Could not convert", run)
    else:
        showinfo("Converted", run)