AYABPNGDumper Module

Dump knitting patterns to PNG files compatible with the AYAB software.

class knittingpattern.convert.AYABPNGDumper.AYABPNGDumper(function_that_returns_a_knitting_pattern_set)[source]

Bases: knittingpattern.Dumper.file.ContentDumper

This class converts knitting patterns into PNG files.

__init__(function_that_returns_a_knitting_pattern_set)[source]

Initialize the Dumper with a function_that_returns_a_knitting_pattern_set.

Parameters:function_that_returns_a_knitting_pattern_set – a function that takes no arguments but returns a knittinpattern.KnittingPatternSet.KnittingPatternSet

When a dump is requested, the function_that_returns_a_knitting_pattern_set is called and the knitting pattern set is converted and saved to the specified location.

temporary_path(extension='.png')[source]

Saves the dump in a temporary file and returns its path.

Warning

The user of this method is responsible for deleting this file to save space on the hard drive. If you only need a file object for a short period of time you can use the method temporary_file().

Parameters:extension (str) – the ending ot the file name e.g. ".png"
Returns:a path to the temporary file
Return type:str