Implement image embedding in Harness.svg()
This commit is contained in:
parent
d669b38392
commit
a18550e79e
@ -18,7 +18,7 @@ from wireviz.wv_bom import manufacturer_info_field, component_table_entry, \
|
|||||||
from wireviz.wv_html import generate_html_output
|
from wireviz.wv_html import generate_html_output
|
||||||
from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, flatten2d, \
|
from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, flatten2d, \
|
||||||
open_file_read, open_file_write
|
open_file_read, open_file_write
|
||||||
from wireviz.svgembed import embed_svg_images_file
|
from wireviz.svgembed import embed_svg_images, embed_svg_images_file
|
||||||
|
|
||||||
|
|
||||||
class Harness:
|
class Harness:
|
||||||
@ -343,12 +343,8 @@ class Harness:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def svg(self):
|
def svg(self):
|
||||||
from io import BytesIO
|
|
||||||
graph = self.create_graph()
|
graph = self.create_graph()
|
||||||
data = BytesIO()
|
return embed_svg_images(graph.pipe(format='svg').decode('utf-8'), Path.cwd())
|
||||||
data.write(graph.pipe(format='svg')) # TODO: use embed_svg_images()
|
|
||||||
data.seek(0)
|
|
||||||
return data.read()
|
|
||||||
|
|
||||||
def output(self, filename: (str, Path), view: bool = False, cleanup: bool = True, fmt: tuple = ('pdf', )) -> None:
|
def output(self, filename: (str, Path), view: bool = False, cleanup: bool = True, fmt: tuple = ('pdf', )) -> None:
|
||||||
# graphical output
|
# graphical output
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user