Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Provide slide safe area for titles and contents with specific margins #153

Open
tiktoor opened this issue Jan 10, 2024 · 10 comments

Comments

@tiktoor
Copy link

tiktoor commented Jan 10, 2024

Martin, thank you for your work, it's really awesome.

testing your script i stumbled upon a few things i would prefer if you would want to consider it.

  1. Specify the title Frame with top, left, right, bottom margins (ideally with the conversion of inch, cm, px and pt proovided by python-pptx)
    titleMarginTop: 2cm
    titleMarginLeft: 2in
    titleMarginRight: 20px
    titleMarginBottom: 20pt

  2. Specify the content Frame with top, left, right, bottom margins (as above)
    contentMarginTop: 2cm
    contentMarginLeft: 2in
    contentMarginRight: 20px
    contentMarginBottom: 20pt

  3. ideally Footer left/right as well (NumbersHeight somehow defines the Bottom Margin

  4. this could as well be combined on a slide level
    slideMarginTop: 2cm
    slideMarginLeft: 2in
    slideMarginRight: 20px
    slideMarginBottom: 20pt

What do you think?

@MartinPacker
Copy link
Owner

Thanks for your kind words. This comment of mine is not a "no". Indeed dynamic metadata versions of these - as well as the static - might have value.

This would be quite a lot of reworking the layout logic, of course.

I will comment that right now the expectation is you will have a decent template presentation - that sets the bounds of eg the title object. So, could you achieve what you want with a tweaked template presentation?

Again, this is not a "no"; I'm exploring the area.

@MartinPacker
Copy link
Owner

Also, I think the point about centimetres vs inches is valid.

@tiktoor
Copy link
Author

tiktoor commented Jan 10, 2024

Regarding the template, this was my first try. But perhaps it's just a user error. I was tweaking the original template to use the title elements in the master, but i was irritated that the template design was overwritten by the "adjusting titles" I was able to fix the titles with the metadata, but the content block was "ignored" as well.

This was the reason why i thought, as you do some magic with multiple colums etc. if it would make life easier if i would be able to define a "content area" whare the magic can happen.

And this lead to the same assumption for titles and footnotes.

I hope this clarifies my thoughts. Totally ok if you will not adapt. I was just thinking that this could be helpful for more people than just myself :-)

@MartinPacker
Copy link
Owner

MartinPacker commented Jan 10, 2024

In principle - having located the content shape (for example) - it's not much code to resize it. The wider issue will be updating the layout model.

I also think we need a syntax for "use the default" but that's not difficult.

This is not one I'm going to rush at, in the meantime. So I'd further encourage you to experiment with your own template file. (There is a section towards the end of the user guide that might help weigh this.)

The "units" question is probably more fiddly. And the reason for inches is that font sizes are relative to that (i.e. points). But cm should - one day - be doable.

@tiktoor
Copy link
Author

tiktoor commented Jan 10, 2024

Thank you, will test the template and i made a fork to experiment with the code. If I fine a short patch, i will push it to you. In the meantime thank you for your fast replies.

regarding units, afaik python-pptx ist using this EMU thing as a base and provides an util to convert everything to it.

https://python-pptx.readthedocs.io/en/latest/user/autoshapes.html

My proposal was to use the same util set to process different inputs

`>>> from pptx.util import Inches, Pt

length = Inches(1)
length
914400
length.inches
1.0
length.cm
2.54
length.pt
72.0
length = Pt(72)
length
914400`

@MartinPacker
Copy link
Owner

Thanks. It helps the effort more if you try to use the user guide to tweak your template. If there are shortcomings in the docs we can fix them. By the way mdpre is always run to create the user_guide.md file - so don't try editing it directly.

There is another very active code branch going on right now - so merging your code changes might be difficult.

@MartinPacker
Copy link
Owner

The other code branch got merged just now. But still it's most helpful to check if the documentation is good enough when it come to creating template presentations.

@MartinPacker
Copy link
Owner

And yet another branch got merged. (Not going to provide running commentary.)

@tiktoor
Copy link
Author

tiktoor commented Jan 14, 2024

Still trying to figure out what breaks my layout. Will get back to you with a reproducible test setup. Thank you for your efforts!

@MartinPacker
Copy link
Owner

@tiktoor did you ever figure out what broke your layout?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants