View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011230 | Scribus | Scripter | public | 2012-12-03 23:20 | 2013-01-10 21:10 |
Reporter | mheieis | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | all | OS | all | OS Version | all |
Product Version | 1.5.0svn | ||||
Summary | 0011230: activeDocument.activePage.type returning values | ||||
Description | The code documents the following: in api_page.cpp beginning line 340 /** * Scripter.activeDocument.activePage.type * Returns 0 if LeftPage, 1 if Middle Page, 2 for Right Page */ int PageAPI::type() However, when invoking Scripter.activeDocument.activePage.type in the console, the logic appears to be reversed, where 0 is the rightPage and 2 is the leftPage. So not sure if this is a doc or logic issue. | ||||
Tags | No tags attached. | ||||
Patch | |||||
|
Hi Jain, I've been testing the update. My assumption is that pages[] would access each page as if using activePage but without having to set the activePage. What happens is that, even though each page element references a different location, the return objects are always the last page of the document. Have I understood its use correctly? Thanks. ------------ Using the following in the script console on a 5 page test doc with dummy items on each page: <code snippet> ad = Scripter.activeDocument pages = ad.pages print "****** using pages[]" for page in pages : items = page.items print " Page", page.number, "has", len(items), "item(s)" print "****** using setActivePage()" number = ad.pageCount for i in range(0,number): ad.setActivePage(i+1) ap = ad.activePage items = ap.items print " Page", ap.number, "has", len(items), "item(s)" </code snippet> I get the following result: ****** using pages[] Page 5 has 5 item(s) Page 5 has 5 item(s) Page 5 has 5 item(s) Page 5 has 5 item(s) Page 5 has 5 item(s) ****** using setActivePage() Page 1 has 1 item(s) Page 2 has 2 item(s) Page 3 has 3 item(s) Page 4 has 4 item(s) Page 5 has 5 item(s) On 2012-12-05 04:49, Jain Basil Aliyas wrote: > Hello Mark, ale, > > I've added an attribute in document api which will return a list of pages > in a document. You may try out *Scripter.activeDocument.pages* for getting > this. > > Regarding the number attribute in page api, I've fixed it as follows: > > *page = Scripter.activeDocument.activePage* > *page.number* #this will give the page number. > > The setNumber method was actually meant to set the page as active. As you > mentioned, it makes more sense to place it in document api. Hence, I've > moved it there: > > *Scripter.activeDocument.setActivePage(2)* > > Thanks & Regards, > |