Exemplo n.º 1
0
    def main(self, tk):
        '''
        Executes bot code and handles bot polling/lifecycle
        '''
        my_persistence = PicklePersistence(filename='persistence')
        updater = Updater(tk, persistence=my_persistence, use_context=True)
        # for security purposes, everytime main will be called, the token
        # attribute will be erased from object memory
        del tk

        dp = updater.dispatcher
        jobQueue = updater.job_queue

        # commands
        start = Start(self, dp)
        start.registerToDispatcher()

        help = Help(self, dp)
        help.registerToDispatcher()

        info = Info(self, dp)
        info.registerToDispatcher()

        self.enableLogging()

        # start the bot
        updater.start_polling()
        updater.idle()
Exemplo n.º 2
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