Exemplo n.º 1
0
 def __LoadScript(self, filename):
     scriptLoader = ScriptLoader(filename)
     Info.Verbose("Local script `{}` loading...".format(filename))
     if not scriptLoader.Load():
         Info.Verbose(
             "Local script `{}` loading completed!".format(filename))
     return scriptLoader.GetScript()
Exemplo n.º 2
0
    def __Parse(self):
        profile = self.__LoadProfile(self.__args.profile)
        if self.__args.display:
            print(profile)

        terminalSettings = profile.GetTerminalSettings()
        plotSettings = profile.GetPlotSettings()
        script = self.__LoadScript(self.__args.filename)

        scriptGlue = ScriptGlue(terminalSettings, plotSettings, script,
                                self.__args)
        Info.Verbose("Glueing...")
        glued = scriptGlue.GetGlue()
        Info.Verbose("Glueing completed!")
        self.__SaveScript(glued)
Exemplo n.º 3
0
    def __init__(self, args):

        self.outputfile = NameResolver.GetTmpfilePdf()
        filename = NameResolver.GetLocalScript(args.filename)
        self.filename = NameResolver.ReplaceWithPdf(filename)

        self.__CMD = 'cp {outfile} {localfile}'
        self.__CMD = self.__CMD.format(outfile=self.outputfile,
                                       localfile=self.filename)

        Info.Verbose("Pdfcopier initialization")
Exemplo n.º 4
0
    def __init__(self):
        self.latexCompiler = Settings.latexCompiler
        self.latexFlags = Settings.latexFlags
        self.outputFlag = '--output-dir '
        self.outputFlag += NameResolver.GetOutput()
        self.filename = NameResolver.GetTmpfileTex()
        self.__CMD = ' '.join([
            self.latexCompiler,
            self.latexFlags,
            self.outputFlag,
            self.filename])

        Info.Verbose("Latex Runner initialization")
Exemplo n.º 5
0
    def Run(self):

        Info.Info()
        args = self.__args

        # generating script -> .plt
        ScriptParser(args)
        Info.Verbose("Exiting Script Parser")

        # .plt -> .tex
        gnuplotRunner = GnuplotRunner()
        if gnuplotRunner.Run():
            Exiter.Exit("gnuplot does not exit successfully!")
        Info.Verbose("Exiting Gnuplot Runner")

        if not args.ignore:
            # .tex post-processing
            if args.postprocess:
                texPostProcessor = TexPostProcessor()
                if texPostProcessor.PostProcess(args.postprocess):
                    Exiter.Exit(
                        "TeX Post-Processor does not exit successfully!")
                Info.Verbose("Exiting Tex Post-Processor")

            # .tex -> .pdf
            latexRunner = LatexRunner()
            if latexRunner.Run():
                Exiter.Exit("LaTeX does not exit successfully!")
            Info.Verbose("Exiting LaTeX Runner")

            # .pdf -> local path
            pdfcopier = Pdfcopier(args)
            if pdfcopier.Copy():
                Exiter.Exit("copying does not finished successfully!")
            Info.Verbose("Exiting Pdfcopier")

        Exiter.Clean()
        return 0
Exemplo n.º 6
0
    def Load(self,args):
        try:
            settings = importlib.import_module('profiles.'+self.__profileName, package=None)
            Info.Verbose("Profile `{profile}` loaded".format(profile=self.__profileName))
        except ImportError:
            profileList = self.GetProfileList()
            Exiter.Exit("Profile `{profile}` not found! Check for the typos! \nProfiles avaliable:\n * {list}".format(profile=self.__profileName,list=profileList))
        
        terminalSettings = settings.terminalSettings
        plotSettings = settings.plotSettings
        if args.terminal:
            terminalSettings['terminal'] = args.terminal

        if args.append:
            terminalSettings['header'] += ReplaceSlash(args.append)

        if args.replace:
            terminalSettings['header'] = ReplaceSlash(args.replace)

        profile = Profile(terminalSettings, plotSettings)
        return profile
Exemplo n.º 7
0
    def PostProcess(self, append):
        try:
            Info.Verbose("TeX loading...")
            self.__Load()
            Info.Verbose("TeX loading completed!")

            Info.Verbose("TeX post-processing...")
            beginDoc = '\\begin{document}\n'
            if beginDoc in self.__tex:
                indexBegin = self.__tex.index(beginDoc)
                self.__tex.insert(indexBegin + 1, '\n'.join(append) + '\n')
                self.__tex = ''.join(self.__tex)
            Info.Verbose("TeX post-processing completed!")

            Info.Verbose("TeX saving...")
            self.__Save()
            Info.Verbose("TeX saving completed!")

            return 0
        except:
            return 1
Exemplo n.º 8
0
 def __SaveScript(self, glued):
     scriptSaver = ScriptSaver()
     Info.Verbose("Parsed script saving...")
     if not scriptSaver.Save(glued):
         Info.Verbose("Parsed script saving completed")
Exemplo n.º 9
0
 def __init__(self, args):
     self.__args = args
     Info.Verbose("Script Parser initialization")
     self.__Parse()
Exemplo n.º 10
0
 def __init__(self):
     self.gnuplotCMD = 'gnuplot'
     self.filename = NameResolver.GetTmpfilePlt()
     self.__CMD = ' '.join([self.gnuplotCMD, self.filename])
     Info.Verbose("Gnuplot Runner initialization")
Exemplo n.º 11
0
 def __init__(self):
     self.__filename = NameResolver.GetTmpfileTex()
     self.__tex = ''
     Info.Verbose("TeX Post-processor initialization")