Subversion Repositories Scribus


Rev 22280 | Blame | Compare with Previous | Last modification | View Log | RSS feed

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Predefined Constants</title>
<h2>Predefined Constants</h2>

<p>There are some Constants defined to help using the Commands: </p>

<h4>Scribus Version:</h4>
        <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>
        <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>
        <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>
if scribus.scribus_version_info[:3] &lt; (1,2,2):
    messageBox("Scribus - Python script",
        "This script requires Scribus 1.2.2 or newer. "+\
        "You're running %s." % scribus.scribus_version,

<h4>Unit Enumeration Constants: </h4>
        <dd>Measurement Unit Point = 0</dd>
        <dd>Measurement Unit Millimeter = 1</dd>
        <dd>Measurement Unit Inch = 2</dd>
        <dd>Measurement Unit Pica = 3</dd>

<h4>Unit Conversion Constants</h4>

<p>These conversion factors can be used to convert units to and from points.
Thus, to convert inches to points, you can simply write 'value/inch', to
convert points to inches you write 'value*inch', and to convert inches to mm
you write 'value*mm/inch' .</p>

        <dd>points in 1 pt</dd>
        <dd>inches in 1 pt</dt>
        <dt>pica in 1 pt</dt>
        <dt>centimetres in 1 pt</dt>
        <dt>millimetres in 1 pt</dt>
        <dt>Other constants will be provided if the Scribus core knows about them.</dt>

<h4>Page Orientation Definitions: </h4>
        <dd>Pageformat Portrait = 0</dd>
        <dd>Pageformat Landscape = 1</dd>

<h4>Definitions for Page Formats: </h4>
        <dd>Paperformat A0 = 2380 x 3368 Points</dd>
        <dd>Paperformat A1 = 1684 x 2380 Points</dd>
        <dd>Paperformat A2 = 1190 x 1684 Points</dd>
        <dd>Paperformat A3 = 842 x 1190 Points</dd>
        <dd>Paperformat A4 = 595 x 842 Points</dd>
        <dd>Paperformat A5 = 421 x 595 Points</dd>
        <dd>Paperformat A6 = 297 x 421 Points</dd>
        <dd>Paperformat A7 = 210 x 297 Points</dd>
        <dd>Paperformat A8 = 148 x 210 Points</dd>
        <dd>Paperformat A9 = 105 x 148 Points</dd>
        <dd>Paperformat B0 = 2836 x 4008 Points</dd>
        <dd>Paperformat B1 = 2004 x 2836 Points</dd>
        <dd>Paperformat B2 = 1418 x 2004 Points</dd>
        <dd>Paperformat B3 = 1002 x 1418 Points</dd>
        <dd>Paperformat B4 = 709 x 1002 Points</dd>
        <dd>Paperformat B5 = 501 x 709 Points</dd>
        <dd>Paperformat B6 = 355 x 501 Points</dd>
        <dd>Paperformat B7 = 250 x 355 Points</dd>
        <dd>Paperformat B8 = 178 x 250 Points</dd>
        <dd>Paperformat B9 = 125 x 178 Points</dd>
        <dd>Paperformat B10 = 89 x 125 Points</dd>
        <dd>Paperformat C5E = 462 x 649 Points</dd>
        <dd>Paperformat Comm10E = 298 x 683 Points</dd>
        <dd>Paperformat DLE = 312 x 624 Points</dd>
        <dd>Paperformat Executive = 542 x 720 Points</dd>
        <dd>Paperformat Folio = 595 x 935 Points</dd>
        <dd>Paperformat Ledger = 1224 x 792 Points</dd>
        <dd>Paperformat Legal = 612 x 1008 Points</dd>
        <dd>Paperformat Letter = 612 x 792 Points</dd>
        <dd>Paperformat Tabloid = 792 x 1224 Points</dd>

<h4>Definitions for Document Layout:</h4>
        <dd>Layout with facing Pages.</dd>
        <dd>Normal Layout of the Document.</dd>
        <dd>The first Page of the Document is a left Page.</dd>
        <dd>The first Page of the Document is a right Page.</dd>

<h4>Alignment Definitions </h4>
        <dd>Text is aligned to the Left.</dd>
        <dd>The Text is centered in the Textframe.</dd>
        <dd>The Text is aligned to the Right Side of the Textframe</dd>
        <dd>The Text has forced Alignment</dd>
        <dd>The Text has block Alignment</dd>

<h4>Line related Definitions: </h4>

<h4>Fill related Definitions: </h4>
    <dd>No gradient, plain color</dd>

<h4>Dialog Buttons</h4>
<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>
<tr><td><strong>Button Type</strong></td><td><strong>Return Value</strong></td></tr>
<tr>    <td>BUTTON_ABORT</td><td>262144</td></tr>
<tr>    <td>BUTTON_CANCEL</td><td>4194304</td></tr>

<p>There is also a hierarchy of buttons in terms of where they appear in the dialogs, although note its complexity:</p>
    <dt>BUTTON_YES will always be to the left of all other buttons.</dt>
    <dt>BUTTON_NO will always be to the left of all other buttons, except BUTTON_YES.</dt>
    <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>
    <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>

<h4>Dialog Icons</h4>