Exemple #1
0
 def export(self,name,format=None,pen=None,args=''):
     'Export to different formats'
     from rsf.vpconvert import convert
     if not format:
         if len(name) > 3:
             format = name[-3:].lower()
         else:
             format = 'vpl'
     convert(self.name,name,format,pen,self.penopts+args,verb=False)
Exemple #2
0
 def export(self,name,format=None,pen=None,args=''):
     'Export to different formats'
     from rsf.vpconvert import convert
     if not format:
         if len(name) > 3:
             format = name[-3:].lower()
         else:
             format = 'vpl'
     convert(self.name,name,format,pen,self.penopts+args,verb=False)
Exemple #3
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 rsf.vpconvert as 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
Exemple #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)
Exemple #5
0
    def convert(self,event):
        '''Convert a VPL file'''
        if not os.path.isfile(self.vpl):
            self.showerror("Can't find input file" + self.vpl)
            return

        new = '.'.join([os.path.splitext(self.vpl)[0],self.format.lower()])
        opts = ' '.join(map(lambda x: '='.join([x, self.pars[x]]), 
                            self.pars.keys())) + ' ' + self.opts
    
        fail = vpconvert.convert(self.vpl,new,self.format,None,opts,False)
    
        run = "%s to %s using \"%s\"" % (self.vpl,new,opts)
        if fail:
            self.showerror("Could not convert " + run)
        else:
            self.showinfo("Converted " + run)
Exemple #6
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(
        ['='.join([x, str(pars[x].get())])
         for x in list(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)
Exemple #7
0
    def convert(self, event):
        '''Convert a VPL file'''
        if not os.path.isfile(self.vpl):
            self.showerror("Can't find input file" + self.vpl)
            return

        new = '.'.join([os.path.splitext(self.vpl)[0], self.format.lower()])
        opts = ' '.join(
            ['='.join([x, self.pars[x]])
             for x in list(self.pars.keys())]) + ' ' + self.opts

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

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