plantuml.py 文件源码

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

项目:sublime-plantuml 作者: pkucmus 项目源码 文件源码
def run(self, edit, *args):
        sublime.status_message('Processing PlantUML')
        self.view.set_status('plant', 'Processing PlantUML')
        content = self.view.substr(sublime.Region(0, self.view.size()))
        img_file_name = os.path.splitext(self.view.file_name())[0] + '.png'
        with open(img_file_name, 'w') as image_file:
            p = Popen(
                ['docker', 'run', '-i', '--rm', 'plantuml'],
                stdout=image_file, stdin=PIPE, stderr=PIPE
            )
            p.communicate(input=bytes(content, 'utf-8'))[0]

        view = self.find_view(img_file_name)
        if view is None:
            view = self.view
        view.window().open_file(img_file_name)
        view.window().focus_view(self.view)
        view.erase_status('plant')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号