MCPcopy Create free account
hub / github.com/PageBot/PageBot / saveDrawing

Method saveDrawing

Lib/pagebot/contexts/svgcontext/svgcontext.py:130–147  ·  view source on GitHub ↗

Select other than standard DrawBot export builders here. Save the current image as path, rendering depending on the extension of the path file. In case the path starts with "_export", then create it directories. >>> context = SvgContext() >>> context.newPage(

(self, path, multiPage=None)

Source from the content-addressed store, hash-verified

128 # Save / export.
129
130 def saveDrawing(self, path, multiPage=None):
131 """Select other than standard DrawBot export builders here. Save the
132 current image as path, rendering depending on the extension of the path
133 file. In case the path starts with "_export", then create it
134 directories.
135
136 >>> context = SvgContext()
137 >>> context.newPage(1000, 1000)
138 >>> context.saveImage('_export/MyFile.svg')
139
140 """
141 # Only save to SVG for now. Maybe use Flat context to save PDF / bitmap?
142 parts = path.split('.')
143 ext = parts[-1]
144 assert ext.lower() == 'svg'
145 self._drawing.save()
146 self.checkExportPath(path)
147 shutil.move(self._filePath, path)
148
149 saveImage = saveDrawing # Compatible API with DrawBot
150

Callers 2

buildMethod · 0.45
buildMethod · 0.45

Calls 2

checkExportPathMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected