Exemplo n.º 1
0
Arquivo: tex.py Projeto: 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
Exemplo 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
Exemplo n.º 3
0
Arquivo: tex.py Projeto: 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
Exemplo 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)