View Issue Details

IDProjectCategoryView StatusLast Update
0014348ScribusScripterpublic2021-03-03 11:18
Reporterjlpoole Assigned To 
PrioritylowSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Version1.5.3.svn 
Summary0014348: setPageType - Enhancement Request
DescriptionThe pageType property for a master page cannot be set in Scripter. The pageType value appears to be inherited and cannot be altered using Scripter. There is a getPageType() method, but no corresponding setPageType() method.
Steps To ReproduceWhen creating Master Page via Scripter, there is no ability to set the PageType, i.e. "0","1", or "2". What happens is if you create a master page through scripting and then apply the master page, you risk getting the Preflight Verifier warning:

   "Applied master page has a different page destination (left, middle, right side)".

I create several master pages in my script, and it may be that there is some iterator in the code that automatically assigns the values of "0,1,2" depending on what order the master page is created and the type of document -- this is conjecture on my part. Perhaps a work-around is to create fill-in master page objects so the one you actually use is created in the appropriate sequence thereby inheriting the desired value of 0, 1, or 2.

Although this warning does not affect the export, it would be better to not trigger the error at all by creating the master page object with all the properties that may be user defined.

For a blank double-sided document, I create two additional master page with this snippet:

    scribus.createMasterPage("Front")
    scribus.createMasterPage("Back")
    
    scribus.editMasterPage("Front")
    scribus.setActiveLayer("foldlines")
    scribus.createLine(0,912,1800,912,"FoldlineFront")
    scribus.setActiveLayer("cutlines")
    scribus.createLine(213,0,213,2736,"LeftCut")
    scribus.createLine(1587,0,1587,2736,"RightCut")
    scribus.setLineStyle(scribus.LINE_DASH,"LeftCut")
    scribus.setLineStyle(scribus.LINE_DASH,"RightCut")
    scribus.closeMasterPage()
    
    scribus.editMasterPage("Back")
    scribus.setActiveLayer("foldlines")
    scribus.createLine(0,1818,1800,1818,"FoldlineBack")
    scribus.closeMasterPage()

Thus, two custom master pages are added to the default two master pages making a combined total of four master pages. Here's what
values they are assigned:

_________________________________________________________
Order as | |
appears | |
in Master | |
Page Window | Page Name | value of getPageType(...)
------------|-------------|------------------------------
1 | Back | 0
2 | Front | 2
3 | NormalLeft | 0
4 | NormalRight| 2
__________________________________________________________


Thus the master page "Front" has a value of "2" using the getPageType() command. I want it to have a value of "0".

Note: I'm working off of my custom build of SVN1.5.0 built May 2015.

See also Bug 0002631 "Missing method to get the page direction"

Please provide a method "setPageType(...)" in Scripter.
TagsPreflightChecker, scripter
PatchNo

Activities

Kunda

2016-11-03 13:16

updater   ~0042304

Thanks jlpoole. Would you perhaps consider proposing a patch ?

Kunda

2016-11-07 01:01

updater   ~0042342

cc @gpittman

gpittman

2016-11-07 01:23

developer   ~0042343

I'm not sure you can do something with Scripter that you can't do outside of it.
What you seem to want is a document where the first two pages are left pages, after which they alternate.

Put another way, I don't know of anyway to have part of a document be single pages, and the rest facing pages.

gpittman

2016-11-07 01:48

developer   ~0042344

I guess I'm still trying to get the gist of this.
Now that I relook at it, I get the sense that there must be some alternation in the process. I would think that the answer ultimately might come from adding parameters to the createMasterPage() command that correlate with the ability outside of Scripter to assign it a Left or Right type.

In the meantime, what would happen if you created some dummy Master Page in between Front and Back that you never used? Like this:

    scribus.createMasterPage("Front")
    scribus.createMasterPage("Dummy")
    scribus.createMasterPage("Back")

Does that fix the issue?

jlpoole

2016-11-07 02:05

reporter   ~0042345

Hi Gregory.

My design is to have the first page be its own -- a title page, then page 2 has an odd page design, page 3 has an even page design, and then thereafter ODD pages have their master and EVEN theirs. This is for piano ensemble music where the Secondo's part is on the left side and the Primo's part is on the right side. So you have a title page, then an introductory page for each Secondo and Primo, and thereafter master pages for Secondo and Primo.

Yes, the work-around is to create pages in such an order that the automatic assignment is anticipated and the master pages I do not want ignored.

gpittman

2016-11-07 02:12

developer   ~0042346

Last edited: 2016-11-07 02:14

Here is what I get out of this:
I made a short script that just did the above, then saved the document. From what I can tell in the SLA file, all Master Pages created in Scripter are denoted as Right - the parameter Left is "0" for all, and there is no way to edit this even outside of scripter. (You could edit this in the SLA file if you're picky about it)

Is there a problem to just ignore the warning when you create the PDF? There are many other situations where we do that on a routine basis. It's just a "heads up" kind of thing, not a prevention of PDF export.

As I said above, the ultimate answer would be to add a parameter to createMasterPage(), since that would correspond to the only time you can do this outside of Scripter.

jlpoole

2016-11-07 02:23

reporter   ~0042347

Yes, I am aware that the warning is just that. Hence, this is an enhancement request. I've found if one has warnings that are continuous, they become ignored and no longer serve the purpose of being a warning. Moreover, the automatic assignment of Master Pages ought to be something that can be user-controlled. When I feel I have some time (after doing the Perl scripting for Windows building), I'll look into it.

I am pleased to say that Scribus, with a complex database and Perl script paradigm I've built, will allow me to impose and regular edition into predefined 4-up, 6-up, 8-up pages (25" x 38" pages) for 4,8,12, & 16 page signatures optimizing the signatures so that less than 16 pages are bound on each side by larger ones. There's a story here, but it's not quite ready to tell.

gpittman

2016-11-07 02:34

developer   ~0042348

Some further looking into this...

getPageType() has to do with the regular page, not the Master Page.
I'm not sure what your solution is, but I think you may be getting hung up on the warning.
Why is the Back Page your first page? Shouldn't it be at the end? In that case you can add an empty page to make its page type whatever you want.

RobSay

2021-03-03 11:18

reporter   ~0048898

Adding / clarifying the ask here rather than creating a new ticket.

Scripter does not currently support the creation of master pages for use with documents configured with facing pages and using mirrored margins.
More specifically - there is a need to set the 'type' on master pages (left, centre, right) in order to have the document correctly apply mirrored margins (inside, outside)

Given an open scribus document with a 'facing pages' configuration:
1. Set the margins for the document: setMargins(inside, outside, top, bottom)
2. create a master page in scripter (createMasterPage("someName"))
 -- the page is created as a *right page* (=2)
3. Need to be able to set the page type whilst the master page is being edited: setPageType(..)
4. close the master page being edited: closeMasterPage()
5. add a new page with the master page: newPage(-1, "someName")
6. Get the page type: getPageType() .. always = 2 (right)

Currently the only way round this is to manually edit the master page and edit the page type. Not being able to set the page type means that any scripts that use page margins for alignment (getPageMargins() tuple) are problematic. This applies both to adding page furniture to the master page (e.g. aligning a page number to outside bottom corner) and adding objects aligned to margins on the document pages.

Issue History

Date Modified Username Field Change
2016-11-02 13:14 jlpoole New Issue
2016-11-02 13:14 jlpoole Tag Attached: PreflightChecker
2016-11-03 13:16 Kunda Note Added: 0042304
2016-11-07 01:01 Kunda Note Added: 0042342
2016-11-07 01:23 gpittman Note Added: 0042343
2016-11-07 01:48 gpittman Note Added: 0042344
2016-11-07 02:05 jlpoole Note Added: 0042345
2016-11-07 02:12 gpittman Note Added: 0042346
2016-11-07 02:14 gpittman Note Edited: 0042346
2016-11-07 02:23 jlpoole Note Added: 0042347
2016-11-07 02:34 gpittman Note Added: 0042348
2021-03-03 10:38 RobSay Tag Attached: scripter
2021-03-03 11:18 RobSay Note Added: 0048898