Subversion Repositories Scribus

Rev

Rev 22280 | 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>Predefined Constants</title>
5
</head>
6
<body>
559 cbradney 7
<h2>Predefined Constants</h2>
8
 
9
<p>There are some Constants defined to help using the Commands: </p>
10
 
1045 subik 11
<h4>Scribus Version:</h4>
10347 mrdocs 12
        <p>The script interface provides two variables containing the current Scribus version in the <code>scribus</code> module. Scripts can use these variables to check that they're running under the version of Scribus they expect, and to report information about incompatibilities to the user. These two variables, <code>scribus_version</code> and <code>scribus_version_info</code>, were added in 1.2.1 and 1.3.0svn and will not be present in earlier versions. If you need to, you can check for their presence with <code>hasattr(scribus, 'scribus_version')</code>.</p>
13
        <p><code>scribus_version</code> contains the current Scribus version as a string. It will usually look like <code>'1.2.1svn'</code> or <code>'1.3.0'</code>, for example, but is not guaranteed to always follow that format. This variable is useful when you need to display the version to the user, for example when reporting an incompatibility. Do not parse or compare this variable, that is what <code>scribus_version_info</code> is for.</p>
14
        <p><code>scribus_version_info</code> is a tuple similar to the <code>sys.version_info</code> tuple provided by Python. It is a tuple of the form (majorversion, minorversion, patchlevel, extraversion, build) for example, 1.2.1svn will have <code>(1,2,1,'svn',0)</code> and 1.3.2 will have <code>(1,3,2,'',0)<code> . These tuples are ideal for checking for minimum versions, etc, because Python compares tuples element-by-element, left-to-right. For example:</p>
1045 subik 15
<pre>
16
if scribus.scribus_version_info[:3] &lt; (1,2,2):
1389 subik 17
    messageBox("Scribus - Python script",
18
        "This script requires Scribus 1.2.2 or newer. "+\
19
        "You're running %s." % scribus.scribus_version,
22280 gpittman 20
        scribus.ICON_CRITICAL)
1389 subik 21
    sys.exit()
1045 subik 22
</pre>
23
 
2429 craig 24
<h4>Unit Enumeration Constants: </h4>
559 cbradney 25
<dl>
1041 cbradney 26
        <dt>UNIT_POINTS</dt>
559 cbradney 27
        <dd>Measurement Unit Point = 0</dd>
1041 cbradney 28
        <dt>UNIT_MILLIMETERS</dt>
559 cbradney 29
        <dd>Measurement Unit Millimeter = 1</dd>
1041 cbradney 30
        <dt>UNIT_INCHES</dt>
559 cbradney 31
        <dd>Measurement Unit Inch = 2</dd>
1041 cbradney 32
        <dt>UNIT_PICAS</dt>
559 cbradney 33
        <dd>Measurement Unit Pica = 3</dd>
34
</dl>
35
 
2429 craig 36
<h4>Unit Conversion Constants</h4>
37
 
38
<p>These conversion factors can be used to convert units to and from points.
39
Thus, to convert inches to points, you can simply write 'value/inch', to
40
convert points to inches you write 'value*inch', and to convert inches to mm
41
you write 'value*mm/inch' .</p>
42
 
43
<dl>
44
        <dt>pt</dt>
45
        <dd>points in 1 pt</dd>
46
        <dt>inch</dt>
47
        <dd>inches in 1 pt</dt>
48
        <dt>p</dt>
49
        <dt>pica in 1 pt</dt>
50
        <dt>cm<dt>
51
        <dt>centimetres in 1 pt</dt>
52
        <dt>mm</dt>
53
        <dt>millimetres in 1 pt</dt>
54
        <dt>...</dt>
55
        <dt>Other constants will be provided if the Scribus core knows about them.</dt>
56
</dl>
57
 
559 cbradney 58
<h4>Page Orientation Definitions: </h4>
59
<dl>
1041 cbradney 60
        <dt>PORTRAIT</dt>
559 cbradney 61
        <dd>Pageformat Portrait = 0</dd>
1041 cbradney 62
        <dt>LANDSCAPE</dt>
63
        <dd>Pageformat Landscape = 1</dd>
559 cbradney 64
</dl>
65
 
66
<h4>Definitions for Page Formats: </h4>
67
<dl>
1041 cbradney 68
        <dt>PAPER_A0</dt>
559 cbradney 69
        <dd>Paperformat A0 = 2380 x 3368 Points</dd>
1041 cbradney 70
        <dt>PAPER_A1</dt>
559 cbradney 71
        <dd>Paperformat A1 = 1684 x 2380 Points</dd>
1041 cbradney 72
        <dt>PAPER_A2</dt>
559 cbradney 73
        <dd>Paperformat A2 = 1190 x 1684 Points</dd>
1041 cbradney 74
        <dt>PAPER_A3</dt>
559 cbradney 75
        <dd>Paperformat A3 = 842 x 1190 Points</dd>
1041 cbradney 76
        <dt>PAPER_A4</dt>
559 cbradney 77
        <dd>Paperformat A4 = 595 x 842 Points</dd>
1041 cbradney 78
        <dt>PAPER_A5</dt>
559 cbradney 79
        <dd>Paperformat A5 = 421 x 595 Points</dd>
1041 cbradney 80
        <dt>PAPER_A6</dt>
559 cbradney 81
        <dd>Paperformat A6 = 297 x 421 Points</dd>
1041 cbradney 82
        <dt>PAPER_A7</dt>
559 cbradney 83
        <dd>Paperformat A7 = 210 x 297 Points</dd>
1041 cbradney 84
        <dt>PAPER_A8</dt>
559 cbradney 85
        <dd>Paperformat A8 = 148 x 210 Points</dd>
1041 cbradney 86
        <dt>PAPER_A9</dt>
559 cbradney 87
        <dd>Paperformat A9 = 105 x 148 Points</dd>
1041 cbradney 88
        <dt>PAPER_B0</dt>
559 cbradney 89
        <dd>Paperformat B0 = 2836 x 4008 Points</dd>
1041 cbradney 90
        <dt>PAPER_B1</dt>
559 cbradney 91
        <dd>Paperformat B1 = 2004 x 2836 Points</dd>
1041 cbradney 92
        <dt>PAPER_B2</dt>
559 cbradney 93
        <dd>Paperformat B2 = 1418 x 2004 Points</dd>
1041 cbradney 94
        <dt>PAPER_B3</dt>
559 cbradney 95
        <dd>Paperformat B3 = 1002 x 1418 Points</dd>
1041 cbradney 96
        <dt>PAPER_B4</dt>
559 cbradney 97
        <dd>Paperformat B4 = 709 x 1002 Points</dd>
1041 cbradney 98
        <dt>PAPER_B5</dt>
559 cbradney 99
        <dd>Paperformat B5 = 501 x 709 Points</dd>
1041 cbradney 100
        <dt>PAPER_B6</dt>
559 cbradney 101
        <dd>Paperformat B6 = 355 x 501 Points</dd>
1041 cbradney 102
        <dt>PAPER_B7</dt>
559 cbradney 103
        <dd>Paperformat B7 = 250 x 355 Points</dd>
1041 cbradney 104
        <dt>PAPER_B8</dt>
559 cbradney 105
        <dd>Paperformat B8 = 178 x 250 Points</dd>
1041 cbradney 106
        <dt>PAPER_B9</dt>
559 cbradney 107
        <dd>Paperformat B9 = 125 x 178 Points</dd>
1041 cbradney 108
        <dt>PAPER_B10</dt>
559 cbradney 109
        <dd>Paperformat B10 = 89 x 125 Points</dd>
1041 cbradney 110
        <dt>PAPER_C5E</dt>
559 cbradney 111
        <dd>Paperformat C5E = 462 x 649 Points</dd>
1041 cbradney 112
        <dt>PAPER_COMM10E</dt>
559 cbradney 113
        <dd>Paperformat Comm10E = 298 x 683 Points</dd>
1041 cbradney 114
        <dt>PAPER_DLE</dt>
559 cbradney 115
        <dd>Paperformat DLE = 312 x 624 Points</dd>
1045 subik 116
        <dt>PAPER_EXECUTIVE</dt>
559 cbradney 117
        <dd>Paperformat Executive = 542 x 720 Points</dd>
1041 cbradney 118
        <dt>PAPER_FOLIO</dt>
559 cbradney 119
        <dd>Paperformat Folio = 595 x 935 Points</dd>
1041 cbradney 120
        <dt>PAPER_LEDGER</dt>
559 cbradney 121
        <dd>Paperformat Ledger = 1224 x 792 Points</dd>
1041 cbradney 122
        <dt>PAPER_LEGAL</dt>
559 cbradney 123
        <dd>Paperformat Legal = 612 x 1008 Points</dd>
1041 cbradney 124
        <dt>PAPER_LETTER</dt>
559 cbradney 125
        <dd>Paperformat Letter = 612 x 792 Points</dd>
1041 cbradney 126
        <dt>PAPER_TABLOID</dt>
559 cbradney 127
        <dd>Paperformat Tabloid = 792 x 1224 Points</dd>
128
</dl>
129
 
1045 subik 130
<h4>Definitions for Document Layout:</h4>
559 cbradney 131
<dl>
1041 cbradney 132
        <dt>FACINGPAGES</dt>
559 cbradney 133
        <dd>Layout with facing Pages.</dd>
1041 cbradney 134
        <dt>NOFACINGPAGES</dt>
559 cbradney 135
        <dd>Normal Layout of the Document.</dd>
1041 cbradney 136
        <dt>FIRSTPAGELEFT</dt>
559 cbradney 137
        <dd>The first Page of the Document is a left Page.</dd>
1041 cbradney 138
        <dt>FIRSTPAGERIGHT</dt>
559 cbradney 139
        <dd>The first Page of the Document is a right Page.</dd>
140
</dl>
141
 
142
<h4>Alignment Definitions </h4>
143
<dl>
24686 craig 144
        <dt>ALIGN_LEFT</dt>
559 cbradney 145
        <dd>Text is aligned to the Left.</dd>
1041 cbradney 146
        <dt>ALIGN_CENTERED</dt>
559 cbradney 147
        <dd>The Text is centered in the Textframe.</dd>
1041 cbradney 148
        <dt>ALIGN_RIGHT</dt>
559 cbradney 149
        <dd>The Text is aligned to the Right Side of the Textframe</dd>
1041 cbradney 150
        <dt>ALIGN_FORCED</dt>
559 cbradney 151
        <dd>The Text has forced Alignment</dd>
1041 cbradney 152
        <dt>ALIGN_BLOCK</dt>
153
        <dd>The Text has block Alignment</dd>
559 cbradney 154
</dl>
155
 
156
<h4>Line related Definitions: </h4>
157
<dl>
1041 cbradney 158
    <dt>LINE_DASH</dt>
159
    <dt>LINE_DASHDOT</dt>
160
    <dt>LINE_DASHDOTDOT</dt>
161
    <dt>LINE_DOT</dt>
162
    <dt>LINE_SOLID</dt>
163
    <dt>JOIN_BEVEL</dt>
164
    <dt>JOIN_MITTER</dt>
165
    <dt>JOIN_ROUND</dt>
166
    <dt>CAP_FLAT</dt>
167
    <dt>CAP_ROUND</dt>
168
    <dt>CAP_SQUARE</dt>
559 cbradney 169
</dl>
1045 subik 170
 
559 cbradney 171
<h4>Fill related Definitions: </h4>
172
<dl>
1041 cbradney 173
        <dt>FILL_NOG</dt>
174
    <dd>No gradient, plain color</dd>
175
        <dt>FILL_HORIZONTALG</dt>
176
        <dt>FILL_VERTICALG</dt>
177
        <dt>FILL_DIAGONALG</dt>
178
        <dt>FILL_CROSSDIAGONALG</dt>
1045 subik 179
        <dt>FILL_RADIALG</dt>
559 cbradney 180
</dl>
1041 cbradney 181
 
182
<h4>Dialog Buttons</h4>
183
<dl>
22280 gpittman 184
<p>This table shows the return values when you are using buttons, for example, with the <strong>messageBox()</strong> command. The value will be the same regardless of which button (button1, button2, or button3) these constants have been assigned.</p>
185
<p>
186
<table>
187
<tr><td><strong>Button Type</strong></td><td><strong>Return Value</strong></td></tr>
188
<tr>    <td>BUTTON_ABORT</td><td>262144</td></tr>
189
<tr>    <td>BUTTON_CANCEL</td><td>4194304</td></tr>
190
    <tr><td>BUTTON_IGNORE</td><td>1048576</td></tr>
191
    <tr><td>BUTTON_NO</td><td>65536</td></tr>
192
    <tr><td>BUTTON_NONE</td><td>N/A</td></tr>
193
    <tr><td>BUTTON_OK</td><td>1024</td></tr>
194
    <tr><td>BUTTON_RETRY</td><td>524288</td></tr>
195
    <tr><td>BUTTON_YES</td><td>16384</td></tr>
196
</table></p>
197
 
198
<p>There is also a hierarchy of buttons in terms of where they appear in the dialogs, although note its complexity:</p>
199
<dl>
200
    <dt>BUTTON_YES will always be to the left of all other buttons.</dt>
201
    <dt>BUTTON_NO will always be to the left of all other buttons, except BUTTON_YES.</dt>
202
    <dt>BUTTON_RETRY, BUTTON_OK, and BUTTON_IGNORE are in a middle group which appear relative to each other according to assignment, so whichever is button1, will be to the left of button2, and so on. Any of these will always be to the left of BUTTON_CANCEL or BUTTON_ABORT.</dt>
203
    <dt>BUTTON_CANCEL and BUTTON_ABORT are in a rightward group that will always be to the right of all other buttons, but with respect to each other according to assignment.</dt>
1041 cbradney 204
</dl>
205
 
206
<h4>Dialog Icons</h4>
207
<dl>
208
    <dt>ICON_CRITICAL</dt>
209
    <dt>ICON_INFORMATION</dt>
210
    <dt>ICON_NONE</dt>
211
    <dt>ICON_WARNING</dt>
212
</dl>
213
 
10646 cbradney 214
</body>
215
</html>