Subversion Repositories Scribus

Rev

Rev 24179 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10646 cbradney 1
<html>
2
<head>
3
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4
        <title>Page related Commands</title>
5
</head>
20587 gpittman 6
<style>
7
@import "manual.css";
8
</style>
10646 cbradney 9
<body>
5297 mrdocs 10
<h2>Page related Commands</h2>
11
 
12
<dl>
13
 
20587 gpittman 14
<dt><a name="-applyMasterPage"><strong>applyMasterPage</strong>(...)</a></dt>
23382 jghali 15
<dd><code>applyMasterPage(masterPageName, pageNr)</code>
20587 gpittman 16
<p>Applies the named master page to the indicated page. Some examples of usage are on the wiki.</a>.</p></dd>
17
 
18234 jghali 18
<dt><a name="-closeMasterPage"><strong>closeMasterPage</strong>(...)</a></dt>
19
<dd><code>closeMasterPage()</code>
20
<p>Closes the currently active master page, if any, and returns editing
21
to normal. Begin editing with <a href="#-editMasterPage">editMasterPage()</a>.</p></dd>
22
 
23
<dt><a name="-createMasterPage"><strong>createMasterPage</strong>(...)</a></dt>
24
<dd><code>createMasterPage(pageName)</code>
25
<p>Creates a new master page named pageName. Begin editing with <a href="#-editMasterPage">editMasterPage()</a>.</p></dd>
26
 
5297 mrdocs 27
<dt><a name="-currentPage"><strong>currentPage</strong></a>(...)</dt>
18234 jghali 28
<dd><code>currentPage() -&gt; integer</code>
23382 jghali 29
<p>Returns the number of the current working page. Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is.</p>
30
<p>If you want to enter into a text frame the special character for the current page number, it is decimal 30 or hex 0x1e. For example, either of the following would be equivalent:</p></dd>
31
<dd><p><b>scribus.setText('Page ' + chr(30), textframe)</b></p></dd>
32
<dd><p><b>scribus.setText('Page \x1e', textframe)</b></p></dd>
33
<dd><p>See also <strong>pageCount()</strong></dd>
18234 jghali 34
 
35
<dt><a name="-deleteMasterPage"><strong>deleteMasterPage</strong>(...)</a></dt>
36
<dd><code>deleteMasterPage(pageName)</code>
37
<p>Delete the named master page.</p></dd>
38
 
5297 mrdocs 39
<dt><a name="-deletePage"><strong>deletePage</strong></a>(...)</dt>
18234 jghali 40
<dd><code>deletePage(nr)</code>
5297 mrdocs 41
<p>Deletes the given page. Does nothing if the document contains only one page. Page numbers are counted from 1 upwards, no matter what the displayed first page number is.</p>
42
<p>May raise IndexError if the page number is out of range</p></dd>
43
 
18234 jghali 44
<dt><a name="-editMasterPage"><strong>editMasterPage</strong>(...)</a></dt>
45
<dd><code>editMasterPage(pageName)</code>
46
<p>Enables master page editing and opens the named master page
47
for editing. Finish editing with <a href="#-closeMasterPage">closeMasterPage()</a>.</p></dd>
48
 
5297 mrdocs 49
<dt><a name="-getAllObjects"><strong>getAllObjects</strong></a>(...)</dt>
24159 jghali 50
<dd><code>getAllObjects([type, page, "layer"]) -&gt; list</code>
51
<p>Returns a list containing the names of all objects of specified type and located on specified page and/or layer.</p>
52
<p>This function accepts several optional keyword arguments:
53
<ul>
24179 jghali 54
<li>type (optional): integer corresponding to item type, by default all items will be returned. You can use one of the ITEMTYPE_* constants.</li>
24159 jghali 55
<li>page (optional): index of page on which returned objects are located, by default the current page. The page index starts at 0 and goes to the total number of pages - 1.</li>
56
<li>"layer" (optional): name of layer on which returned objects are located, by default the function returns items located on all layers.</li>
57
</ul></p>
58
<p>May throw ValueError if page index or layer name is invalid.</p></dd>
5297 mrdocs 59
 
60
<dt><a name="-getHGuides"><strong>getHGuides</strong></a>(...)</dt>
18234 jghali 61
<dd><code>getHGuides() -&gt; list</code>
5297 mrdocs 62
<p>Returns a list containing positions of the horizontal guides. Values are in the
63
document's current units - see UNIT_&lt;type&gt; constants.</p></dd>
64
 
23384 jghali 65
<dt><a name="-getMasterPage"><strong>getMasterPage</strong>(...)</a></dt>
66
<dd><code>getMasterPage(nr) -&gt; string</code>
24159 jghali 67
<p>Returns the name of master page applied to page "nr".</p>
23384 jghali 68
<p>May raise IndexError if the page number is out of range.</p></dd>
69
 
18234 jghali 70
<dt><a name="-getPageType"><strong>getPageType</strong>(...)</a></dt>
71
<dd><code>getPageType() -&gt; integer</code>
72
<p>Returns the type of the Page, 0 means left Page, 1 is a middle Page and 2 is a right Page</p></dd>
73
 
5297 mrdocs 74
<dt><a name="-getPageItems"><strong>getPageItems</strong></a>(...)</dt>
18234 jghali 75
<dd><code>getPageItems() -&gt; list</code>
5297 mrdocs 76
<p>Returns a list of tuples with items on the current page. The tuple is: (name, objectType, order) E.g. [('Text1', 4, 0), ('Image1', 2, 1)] means that object named 'Text1' is a text frame (type 4) and is the first at the page...</p></dd>
77
 
78
<dt><a name="-getPageMargins"><strong>getPageMargins</strong></a>(...)</dt>
18234 jghali 79
<dd><code>getPageMargins()</code>
80
<p>Returns the document page margins as a (top, left, right, bottom) tuple in the document's current units. See UNIT_&lt;type&gt; constants and <a href="#-getPageSize">getPageSize</a>().</p></dd>
5297 mrdocs 81
 
18234 jghali 82
<dt><a name="-getPageNMargins"><strong>getPageNMargins</strong></a>(...)</dt>
83
<dd><code>getPageNMargins(nr)</code>
84
<p>Returns a tuple with a particular page's margins measured in the document's current units. See UNIT_&lt;type&gt; constants and <a href="#-getPageSize">getPageSize</a>().</p></dd>
85
 
5297 mrdocs 86
<dt><a name="-getPageSize"><strong>getPageSize</strong></a>(...)</dt>
18234 jghali 87
<dd><code>getPageSize() -&gt; tuple</code>
88
<p>Returns a tuple with document page dimensions measured in the document's current units. See UNIT_&lt;type&gt; constants and <a href="#-getPageMargins">getPageMargins</a>()</p></dd>
5297 mrdocs 89
 
18234 jghali 90
<dt><a name="-getPageNSize"><strong>getPageNSize</strong></a>(...)</dt>
91
<dd><code>getPageNSize(nr) -&gt; tuple</code>
92
<p>Returns a tuple with a particular page's size measured in the document's current units. See UNIT_&lt;type&gt; constants and <a href="#-getPageMargins">getPageMargins</a>()</p></dd>
93
 
23384 jghali 94
<dt><a name="-getVGuides"><strong>getVGuides</strong></a>(...)</dt>
95
<dd><code>getVGuides()</code>
96
<p>See <a href="#-getHGuides">getHGuides</a>.</p></dd>
97
 
5297 mrdocs 98
<dt><a name="-gotoPage"><strong>gotoPage</strong></a>(...)</dt>
18234 jghali 99
<dd><code>gotoPage(nr)</code>
23382 jghali 100
<p>Moves to the page "nr" (that is, makes the current page "nr"). Note that gotoPage doesn't (currently) change the page the user's view is displaying, it just sets the page that script commands will operates on.</p>
5297 mrdocs 101
<p>May raise IndexError if the page number is out of range.</p></dd>
18234 jghali 102
 
103
<dt><a name="-importPage"><strong>importPage</strong>(...)</a></dt>
25094 jghali 104
<dd><code>importPage("fromDoc", (pageList), [create, importWhere, importWherePage])</code>
105
<p>Imports a set of pages (given as a tuple) from an existing document (the file name must be given). This function maps the "Page-&gt;Import" dropdown menu function.</p>
106
<p>The function accepts following arguments:
107
<ul>
108
<li>fromDoc: string; the filename of the document to import pages from</li>
109
<li>pageList: tuple; page numbers of pages to import</li>
110
<li>create: number; 0 to replace existing pages, 1 (default) to insert new pages</li>
111
<li>importWhere: number; used if create==1; 0 to create pages before importWherePage, 1 to create pages after importWherePage, 2 (default) to create pages at the end of the document</li>
112
<li>importWherePage: number; used if create==1 and importWhere==0|1; zero-based page number (of the current document) before or after which to import the pages</li>
113
</ul></p></dd>
18234 jghali 114
 
5297 mrdocs 115
<dt><a name="-newPage"><strong>newPage</strong></a>(...)</dt>
18234 jghali 116
<dd><code>newPage(where [,"masterpage"])</code>
117
<p>Creates a new page. If "where" is -1 the new Page is appended to the document, otherwise the new page is inserted before "where". Page numbers are counted from 1 upwards, no matter what the displayed first page number of your document is. The optional parameter "masterpage" specifies the name of the master page for the new page.</p>
5297 mrdocs 118
<p>May raise IndexError if the page number is out of range</p></dd>
119
 
120
<dt><a name="-pageCount"><strong>pageCount</strong></a>(...)</dt>
18234 jghali 121
<dd><code>pageCount() -&gt; integer</code>
23382 jghali 122
<p>Returns the number of pages in the document.</p>
123
<p>There is also a special character for page count, in decimal 23, and in hex 0x17. You might combine this with the special character for current page in a text frame (on a Master Page for example) as follows. Either of these is equivalent:</p></dd>
124
<dd><p><b>scribus.setText('Page ' + chr(30) + ' of ' + chr(23), textframe)</b></p>
125
<p><b>scribus.setText('Page \x1e of \x17', textframe)</p></b></dd>
5297 mrdocs 126
 
127
<dt><a name="-redrawAll"><strong>redrawAll</strong></a>(...)</dt>
18234 jghali 128
<dd><code>redrawAll()</code>
5297 mrdocs 129
<p>Redraws all pages.</p></dd>
130
 
131
<dt><a name="-savePageAsEPS"><strong>savePageAsEPS</strong></a>(...)</dt>
18234 jghali 132
<dd><code>savePageAsEPS("name")</code>
5297 mrdocs 133
<p>Saves the current page as an EPS to the file "name".</p>
134
<p>May raise ScribusError if the save failed.</p></dd>
135
 
136
<dt><a name="-setHGuides"><strong>setHGuides</strong></a>(...)</dt>
18234 jghali 137
<dd><code>setHGuides(list)</code>
5297 mrdocs 138
<p>Sets horizontal guides. Input parameter must be a list of guide positions measured in the current document units - see UNIT_&lt;type&gt; constants.</p>
23382 jghali 139
<p>Example:</p>
140
<p><b>setHGuides(getHGuides() + [200.0, 210.0])</b> # this will add new guides while saving existing guides</p>
141
<p><b>setHGuides([90,250])</b> # this will replace current guides entirely</p></dd>
18234 jghali 142
 
5297 mrdocs 143
<dt><a name="-setRedraw"><strong>setRedraw</strong></a>(...)</dt>
18234 jghali 144
<dd><code>setRedraw(bool)</code>
5297 mrdocs 145
<p>Disables page redraw when bool = False, otherwise redrawing is enabled. This change will persist even after the script exits, so make sure to call <a href="#-setRedraw">setRedraw</a>(True) in a finally: clause at the top level of your script.</p></dd>
146
 
147
<dt><a name="-setVGuides"><strong>setVGuides</strong></a>(...)</dt>
18234 jghali 148
<dd><code>setVGuides()</code>
25094 jghali 149
<p>The usage is analogous to that of <a href="#-setHGuides">setHGuides</a> for either adding to existing guides or replacing them.</p></dd>
5297 mrdocs 150
 
151
</dl>
10646 cbradney 152
</body>
153
</html>