Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional blockdiag output file format in diagrammer #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions plugins/diagrammer/diagrammer/diagramrender.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ def initialize(cls):
from blockdiag.imagedraw.png import setup
setup(None)

def renderToFile(self, content, imagePath):
def renderToFile(self, content, imagePath, fileType="png"):
"""
content - текст, описывающий диаграмму
imagePath - полный путь до создаваемого файла
fileType - filetype of the output file, either png or pdf
"""
from blockdiag.parser import parse_string
from blockdiag.drawer import DiagramDraw
Expand All @@ -112,7 +113,7 @@ def renderToFile(self, content, imagePath):
tree = parse_string(text)
diagram = ScreenNodeBuilder.build(tree)

draw = DiagramDraw("png", diagram, imagePath,
draw = DiagramDraw(fileType, diagram, imagePath,
fontmap=fontmap, antialias=True)
draw.draw()
draw.save()