2021-03-12 04:17:19 +00:00
|
|
|
# Authors: see git history
|
|
|
|
#
|
|
|
|
# Copyright (c) 2010 Authors
|
|
|
|
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
|
|
|
|
|
2018-08-20 02:14:10 +00:00
|
|
|
import pyembroidery
|
|
|
|
|
|
|
|
from .utils import build_environment, write_inx_file
|
|
|
|
|
|
|
|
|
|
|
|
def pyembroidery_output_formats():
|
|
|
|
for format in pyembroidery.supported_formats():
|
2021-03-04 17:40:53 +00:00
|
|
|
if 'writer' in format:
|
|
|
|
description = format['description']
|
2022-06-24 15:11:52 +00:00
|
|
|
if format['category'] == "color":
|
|
|
|
description = "%s [COLOR]" % description
|
|
|
|
elif format['category'] == "image":
|
|
|
|
description = "%s [IMAGE]" % description
|
|
|
|
elif format['category'] == "stitch":
|
|
|
|
description = "%s [STITCH]" % description
|
|
|
|
elif format['category'] != "embroidery":
|
2021-03-04 17:40:53 +00:00
|
|
|
description = "%s [DEBUG]" % description
|
|
|
|
yield format['extension'], description, format['mimetype'], format['category']
|
2018-08-20 02:14:10 +00:00
|
|
|
|
|
|
|
|
2024-02-07 20:03:57 +00:00
|
|
|
def generate_output_inx_files(alter_data):
|
2018-08-20 02:14:10 +00:00
|
|
|
env = build_environment()
|
2021-03-04 17:40:53 +00:00
|
|
|
template = env.get_template('output.xml')
|
2018-08-20 02:14:10 +00:00
|
|
|
|
2021-03-04 17:40:53 +00:00
|
|
|
for format, description, mimetype, category in pyembroidery_output_formats():
|
2024-02-07 20:03:57 +00:00
|
|
|
name = f"output_{format.upper()}"
|
|
|
|
write_inx_file(name, template.render(alter_data, format=format, mimetype=mimetype, description=description))
|