Canons of page construction

Previous topic - Next topic

richard-cdbox

This Scribus script draws classical and modern page-construction canons directly into a Scribus document and automatically computes correct margins for left and right master pages. All constructions are drawn on a dedicated outlined layer on the appropriate pages (facing or single), and margins are applied with proper inside/outside mirroring.

You can find all the necessary files here: https://github.com/richard-cdbox/canons_of_page_construction

I hope this helps some of you.

a.l.e

#1
Nice to see such a script.

... but from the README attached to your script, I would say that it does something that Scribus already has built-in.

preset-margins.png

https://gitlab.com/scribus/scribus/-/blob/master/scribus/ui/marginpresetlayout.cpp#L11
https://gitlab.com/scribus/scribus/-/blob/master/scribus/ui/marginpresetlayout.h

Not all the layouts you're proposing are there, but I'm confident that if you propose a patch implementing them, it will be accepted.
And if you need help converting your work into C++, just ask in here.
At first sight, even if it is C++, it looks almost as readable as Python code : - )

But, maybe, I did not understand correctly the goal of your script...

P.S.: We might need a nice small icon to the layouts drop down... to make it a bit more visible...

richard-cdbox

Yes, I know that these presets are available in Scribus, but it seemed to me that for someone who does not have enough knowledge in this area, some of the names are meaningless. But that's just my opinion. I also have three presets included in my script. When I was writing it, it seemed to me that the script would not be complete if they were not there, even though they are in the presets.
 
Let's take it step by step.

Gutenberg:
In my script, it's called Page ratio canon. My name makes it clearer how the page layout is constructed. Gutenberg probably tried to approach the Golden ratio with his Bible, but he ended up closer to the page ratio.

Nine Parts
Based on the name, I knew what canon it was supposed to be, but only because I'm familiar with this field. However, I don't think an uninitiated person would have any idea what it is. That it is an Interpretation of Rosarivo on Van de Graaf's canon, where a 9 x 9 grid is used for the construction, which is easier than calculating the intersections in Van de Graaf's canon.

Golden Mean
I have no idea if this preset was supposed to have anything to do with the golden ratio, because it doesn't.

I also wanted people who use my script to know or learn about this topic. That's why I put a short description of each canon in the README and created construction layers.

I also wanted to avoid this (See the attached image).


I hope my explanation helps you understand why I made the script.

bastiaanw

Quote from: richard-cdbox on November 19, 2025, 01:29:23 PMThis Scribus script draws classical and modern page-construction canons directly into a Scribus document and automatically computes correct margins for left and right master pages. All constructions are drawn on a dedicated outlined layer on the appropriate pages (facing or single), and margins are applied with proper inside/outside mirroring.

You can find all the necessary files here: https://github.com/richard-cdbox/canons_of_page_construction

I hope this helps some of you.

I get an error opening your script.

richard-cdbox

You probably saved the copied code to a file as UTF-8 with BOM. Try saving it as UTF-8 only.

bastiaanw

Quote from: richard-cdbox on November 19, 2025, 07:49:31 PMYou probably saved the copied code to a file as UTF-8 with BOM. Try saving it as UTF-8 only.

Thanks, it works now. I studied your script a bit, and I was not aware I could use Tkinter for Scribus scripting. Nice!

I will rebuild my own Translation scripts with Tkinter and will keep it working for systems with Tkinter support like: try: import tkinter → if ImportError, fall back to the old valueDialog flow.

Thank you!

a.l.e

Hello

After you comments I gave your script a try.

Not sure it worked as intended: after having created a the dialog simple does not close for me (but the control goes back to Scribus and I can click on the lines that have been created in the new document).

If i have a look at the page properties, I see the margin being set, but on the page they are not (inserting a shape that expands to the margins creates an item that is of the size of the page, not of the defined margins): but it might be an error in the scripter API.

Now, since I'm not a graphic designer (but, in this case, more similar to the clueless user your seem to be targeting), I wonder how I can use the diagonal lines you have drawn on the page.

Are they a clue on where I should place specific layout elements?

If it's the case, I see a value on seeing them drawn on a background layer (and I would even add an explanation somewhere, on how they should be used), otherwise I'd prefer having them drawn in a preview, in the dialog itself.

The descriptions you have in the README is also really worth being read!

What do you think to add such a dialog, that would open from the Scribus "New Document" dialog and would fill the existing fields  in the that dialog?

scribus-canons.png

richard-cdbox

Okay, let's explain it using Van de Graaf's canon as an example.

1. The script was tested on Scribus v1.6.4 and v1.7.0 (this information is in the README). I don't know which version of Scribus you are using, so I don't know why the dialog box did not close after running the script.

2. At the beginning of the README file, it says:
NOTE: Before using the script, please read section Important note about Scribus API limitation.
Please read it and do what it says.

3. Then, if you look at pages 2-3 of the document, you will see this (pic1).

4. The red lines on the Van de Graaf construction layer (they are not actually red, but the script sets this layer to Outline mode (pic2)) show how this canon is constructed. The blue lines (boxes) (I don't know if they are blue in your case, because the color for Margins can be changed in Preferences) represent text blocks.

5. The construction layer is just to give you an idea of how to get to the margins of the page or the text blocks. You can turn it off, delete it, or do whatever you want.

6. Although the API allows me to open the Scribus dialog window for a new document, the script dialog window would not be able to control it.

a.l.e

Hi Richard,

I guess we have some issues communicating : - )

I like what you did.
I think that it might be worth to add it to the Scribus main code.
And I could help, getting the feature into the New Document dialog.

As I tried to explain, I've never used the built in feature of Scribus (despite knowing well that it exists), mostly because I have no idea what are the characteristics of each "Preset" / "Canon".
And I don't know either, how to shape the content, so that it uses the specific characteristics of a preset.

The descriptions you have in your README are very useful, but they are not directly accessible for the typical Scribus user.
Also, a user will first need to discover and install your script, before being able to use it.
And the descriptions still miss some information on when to use a specific canon and how to use it.

But it's a huge improvement towards the current state.

If you think that it is a good idea to get the feature into Scribus, please have a look at the mockup I've posted, and see if it make sense to build upon it.
You seem to have the skills to build it in Python/Tk (but if you need help, I know a few things about them, too) and it would then be easy for me to convert your code to C++ / Qt.

richard-cdbox

Hi
Sorry if I misunderstood you. Now it's clearer. I agree with you regarding implementation in Scribus. However, I am currently working on another script for Scribus and would like to finish it first. I hope to do so within two weeks. Then I can start working on this.