eval.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Sublime-Eval 作者: ViktorQvarfordt 项目源码 文件源码
def terminate(self):
        self.terminated_user = True
        if self.proc:
            p = self.proc
            self.proc = None
            p.kill()
            p.communicate()




## This is here for future reference.
# class EvalLatexMathematicaReplace(sublime_plugin.TextCommand):
#     def run(self, edit):
#         for sel in self.view.sel():
#             if sel.begin() == sel.end():
#                 region = self.view.line(sel)
#             else:
#                 region = sel
#             code = self.view.substr(region)
#             try:
#                 p = subprocess.Popen(
#                     'math -run \'Print[TeXForm[ToExpression["%s", TeXForm]]]; Exit[]\'' % code.replace('\\', '\\\\'),
#                     shell=True,
#                     stdout=subprocess.PIPE,
#                     stderr=subprocess.STDOUT,
#                     bufsize=1,
#                     universal_newlines=True)
#                 p.wait()
#                 output = p.stdout.read()
#                 # Hack to compensate for not being able to use -noprompt, since -noprompt causes ToExpression to hang.
#                 output = '\n'.join(output.split('\n')[2:])
#             except Exception as e:
#                 output = 'ERROR: %s' % str(e)
#             if output:
#                 self.view.replace(edit, region, output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号