CalendarWizard

From Scribus Wiki
Revision as of 15:23, 11 December 2016 by Gpittman (talk | contribs)
Jump to navigation Jump to search

CalendarWizard.py has been one of the script included with Scribus for quite some time. It's a complex script that uses tkinter to create a multisetting dialog to set various parameters. Something which is hard-coded into the script is the layout, which makes some calculations based on the page size and its margins, and the proportion allotted to the actual calendar space at the bottom is assigned.

I was disappointed that this careful calculation ends up with a very large image frame which seems to crowd out the business part of the calendar. Manually editing the final calendar is certainly possible, but some work, and a lot of work if you would be trying to edit an entire year, therefore I searched the script to try to find where this space distribution was determined. I was able to find a point to edit the script minimally to produced a redistribution of the spaces.

Look at this section:

    def goldenMean(self, aSize):
        """ Taken from samples/golden-mean.py."""
        return aSize * ((sqrt(5) - 1)/2)

Here a "golden mean" is calculated, and this is used to determine the size of the calendar areas at the top and bottom. ((sqrt(5) - 1)/2) is going to be a bit more than half – 0.618, so presumably this must be close to the proportion allotted to the image.

If we changed this to simply half, and comment out the original line:

    def goldenMean(self, aSize):
        """ Taken from samples/golden-mean.py."""
       return aSize * 1/2
#        return aSize * ((sqrt(5) - 1)/2)

The result

Here is the result of this change, on US Letter pages. The left document uses the original calculation, and the right this simple 50% calculation. This can probably be improved upon according to taste, but now you can see a specific point to make a big impact.

I should add that the images were edited to fill the frame in each case, keeping the same proportions but adjusting scaling and XPos or YPos a bit as needed. If you look carefully, you can also see that these are two different pictures of the same subject.

Calendarwizard results.png