summaryrefslogtreecommitdiff
path: root/bin/gen-zip-inx
blob: 4094878604b846eb6300e3f83fc68117ea3fa77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python

import sys, os
from os.path import dirname
import pyembroidery
from jinja2 import Environment, FileSystemLoader, select_autoescape


def build_environment():
    template_dir = os.path.join(dirname(dirname(os.path.realpath(__file__))), "templates")

    return Environment(
        loader = FileSystemLoader(template_dir),
        autoescape = True
    )


def pyembroidery_output_formats():
    for format in pyembroidery.supported_formats():
        if 'writer' in format and format['category'] == 'embroidery':
            yield format['extension'], format['description']


def main():
    env = build_environment()
    template = env.get_template('embroider_zip_output.inx')

    inx = template.render(formats=pyembroidery_output_formats())

    with open("inx/inkstitch_output_ZIP.inx", 'w') as inx_file:
        inx_file.write(inx)


if __name__ == "__main__":
    sys.exit(main())