summaryrefslogtreecommitdiff
path: root/lib/inx/inputs.py
blob: 667f71c976aca7f81c3009adfe68eb6584a67c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Authors: see git history
#
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later.  See the file LICENSE for details.

import pystitch

from .utils import build_environment, write_inx_file


def pystitch_input_formats():
    for format in pystitch.supported_formats():
        if 'reader' in format and format['category'] in ['embroidery', 'color', 'stitch', 'quilting', 'debug']:
            yield format['extension'], format['description']


def generate_input_inx_files(alter_data):
    env = build_environment()
    template = env.get_template('input.xml')

    for format, description in pystitch_input_formats():
        name = f"input_{format.upper()}"
        write_inx_file(name, template.render(alter_data, format=format, description=description))