Skip to content

Guides creator: Support multipage documents

What does the merge request do?

Part of #442.

This issue supports multipage documents for the guides creator. A new field has been added, where the user can enter which pages are affected in a syntax that should be familiar to users of Adobe Reader, e.g. "1, 2, 10-12, 15-". By default, all pages are selected.

Since in many cases, the pages will be aligned, by default, only non-duplicated guides are created, so there is only one header guide and not one for each page.

For the presets, new options have been added to apply left and right settings alternatingly.

Implementation notes

The extension has been refactored to use less duplicated code and a more pythonic style. This way, it becomes only barely longer. I have added unit tests to achieve nearly full test coverage before the refactoring and the output is indeed identical. After the addition of "nodup", one unit test needed to be renamed because in a square document, opposite corner guides were identical (so for this unit test, I disabled "nodup").

The functionality to add unique guides has been added to the Namedview class in Inkex.

The settings for top_margin, left_margin, right_margin and bottom_margins are for some reason options with fixed values (1/10, 1/9 ect.). This should probably be changed - and at the same time, changed to left_even, left_odd, right_even, right_odd. But that's breaking and should be postponed after 1.2.

I'm a bit confused as to why test_inkex_inx doesn't pick up the default value difference of horz and vert.

Summary for release notes

The Guides creator extension now supports multipage documents. Guides can be generated on all pages or on selected pages only; it is ensured that no unnecessary guides are created. Presets for left and right margin can be applied alternatingly, just as in a book.

Checklist

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

Merge request reports