Skip to content

Refactor export preprocessing

What does the merge request do?

This MR changes the paragdigm of preparing a file for export: instead of the user having to decide (and remember, and possibly undo) how to prepare a file for exporting, it is left to the individual export extension, and provides a method to simplify building the corresponding Action string.

Fixes #211 (closed)

Fixes #256 (closed)

Fixes #49 (closed)

Implementation notes

The MR consists of the following changes:

  • the synfig_prepare extension is removed; its preparation method was moved into OutputExtension.
  • This new functionality is then used in synfig_export; no unit test needed to be changed.
  • It is also used in the HPGL export to close #211 (closed) for good; to not break existing unit tests more than necessary, it is checked beforehand if there are elements that warrant an inkscape() call. I've checked with an online HPGL viewer that the output of the unit test is visually correct and contains the text elements.
  • The prepare_file_save_as extension was broken (still used verbs) and was IMO the wrong approach; the extensions themselves know better which objects they support and which not. It has been removed.
  • I fully expect the OutputExtension.preprocess() method to change over time; this is a very barebones implementation that seems to work for the use cases considered (new XAML export (wip), synfig, hpgl).

TODO: Figure out what's going on with the unit test of plotter.py. Can't test this on Windows.

Summary for release notes

The HPGL export extension (and the plotter extension which is based on it) now also export text elements.

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by Jonathan Neuhauser

Merge request reports