Author: jghali
Date: Thu Oct 3 04:21:35 2019
New Revision: 23232
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23232
Log:
#15800: Add tabs support for scripter plugin <chefe>
Modified:
trunk/Scribus/doc/de/scripterapi-constants.html
trunk/Scribus/doc/de/scripterapi-styles.html
trunk/Scribus/doc/en/scripterapi-constants.html
trunk/Scribus/doc/en/scripterapi-styles.html
trunk/Scribus/doc/fr/scripterapi-constants.html
trunk/Scribus/doc/fr/scripterapi-styles.html
trunk/Scribus/doc/it/scripterapi-constants.html
trunk/Scribus/doc/it/scripterapi-styles.html
trunk/Scribus/doc/ru/scripterapi-constants.html
trunk/Scribus/doc/ru/scripterapi-styles.html
trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.h
trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
Modified: trunk/Scribus/doc/de/scripterapi-constants.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/de/scripterapi-constants.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-constants.html (original)
+++ trunk/Scribus/doc/de/scripterapi-constants.html Thu Oct 3 04:21:35 2019
@@ -295,5 +295,16 @@
</dl>
</td></tr></table>
+<h4>Tab alignment</h4>
+<table><tr><td>
+<dl>
+ <dt>TAB_LEFT</dt>
+ <dt>TAB_RIGHT</dt>
+ <dt>TAB_PERIOD</dt>
+ <dt>TAB_COMMA</dt>
+ <dt>TAB_CENTER</dt>
+</dl>
+</td></tr></table>
+
</body>
</html>
Modified: trunk/Scribus/doc/de/scripterapi-styles.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/de/scripterapi-styles.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-styles.html (original)
+++ trunk/Scribus/doc/de/scripterapi-styles.html Thu Oct 3 04:21:35 2019
@@ -163,6 +163,14 @@
<li>dropcapoffset [optional] -> offset of the caps if used</li>
<li>"charstyle" [optional] -> char style to use</li>
<li>"bullet" [optional] -> string to use as bullet</li>
+<li>"tabs" [optional] -> a list of tab definitions
+<ul>
+ <li>a tab is defined as a tuple with the following format
(position,type,fillchar)</li>
+ <li>position [required] -> float value for the position</li>
+ <li>type [optional] -> left: 0 [default], right: 1, period: 2, comma: 3,
center: 4</li>
+ <li>fillchar [optional] -> the char to fill the space; default is none</li>
+</ul>
+</li>
</ul>
</p>
<p>If you wish to skip a number of settings, unfortunately, this command will
not accept null values, i.e., a series of commas. You <i>must</i> put some
integer value for each of the potential parameters. For example, imagine you
wish to only specify a name for the Paragraph Style, and the Character Style.
Your command should be something like:
Modified: trunk/Scribus/doc/en/scripterapi-constants.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/en/scripterapi-constants.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-constants.html (original)
+++ trunk/Scribus/doc/en/scripterapi-constants.html Thu Oct 3 04:21:35 2019
@@ -307,5 +307,16 @@
</dl>
</td></tr></table>
+<h4>Tab alignment</h4>
+<table><tr><td>
+<dl>
+ <dt>TAB_LEFT</dt>
+ <dt>TAB_RIGHT</dt>
+ <dt>TAB_PERIOD</dt>
+ <dt>TAB_COMMA</dt>
+ <dt>TAB_CENTER</dt>
+</dl>
+</td></tr></table>
+
</body>
</html>
Modified: trunk/Scribus/doc/en/scripterapi-styles.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/en/scripterapi-styles.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-styles.html (original)
+++ trunk/Scribus/doc/en/scripterapi-styles.html Thu Oct 3 04:21:35 2019
@@ -163,6 +163,14 @@
<li>dropcapoffset [optional] -> offset of the caps if used</li>
<li>"charstyle" [optional] -> char style to use</li>
<li>"bullet" [optional] -> string to use as bullet</li>
+<li>"tabs" [optional] -> a list of tab definitions
+<ul>
+ <li>a tab is defined as a tuple with the following format
(position,type,fillchar)</li>
+ <li>position [required] -> float value for the position</li>
+ <li>type [optional] -> left: 0 [default], right: 1, period: 2, comma: 3,
center: 4</li>
+ <li>fillchar [optional] -> the char to fill the space; default is none</li>
+</ul>
+</li>
</ul>
</p>
<p>If you wish to skip a number of settings, unfortunately, this command will
not accept null values, i.e., a series of commas. You <i>must</i> put some
integer value for each of the potential parameters. For example, imagine you
wish to only specify a name for the Paragraph Style, and the Character Style.
Your command should be something like:
Modified: trunk/Scribus/doc/fr/scripterapi-constants.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/fr/scripterapi-constants.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-constants.html (original)
+++ trunk/Scribus/doc/fr/scripterapi-constants.html Thu Oct 3 04:21:35 2019
@@ -303,6 +303,17 @@
</dl>
</td></tr></table>
+<h4>Alignement par TAB</h4>
+<table><tr><td>
+<dl>
+ <dt>TAB_LEFT</dt>
+ <dt>TAB_RIGHT</dt>
+ <dt>TAB_PERIOD</dt>
+ <dt>TAB_COMMA</dt>
+ <dt>TAB_CENTER</dt>
+</dl>
+</td></tr></table>
+
</body>
</html>
Modified: trunk/Scribus/doc/fr/scripterapi-styles.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/fr/scripterapi-styles.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-styles.html (original)
+++ trunk/Scribus/doc/fr/scripterapi-styles.html Thu Oct 3 04:21:35 2019
@@ -160,6 +160,14 @@
<li>dropcapoffset [optionnel] -> décalage horizontal des lettrines si
l'utilisation de lettrines est activée</li>
<li>"charstyle" [optionnel] -> nom du style de caractère à utiliser</li>
<li>"bullet" [optionnel] -> chaîne de caractère à utiliser pour les
puces</li>
+<li>"tabs" [optional] -> a list of tab definitions
+<ul>
+ <li>un tab est défini par un triplet de valeur sous la forme suivante
(position, type, fillchar)</li>
+ <li>position [requis] -> nombre réel représentant la position</li>
+ <li>type [optionnel] -> gauche: 0 [default], droit: 1, point: 2, virgule:
3, centré: 4</li>
+ <li>fillchar [optionnel] -> le caractère utilisé pour remplir l'espace
occupé par le TAB, aucun par défaut.</li>
+</ul>
+</li>
</ul>
</p>
<p>Si vous désirez omettre un certain nombre d'éléments, cette fonction
n'acceptera pas de valeurs null, i.e., une série de virgule. Vous <i>devez</i>
spécifier un paramètre entier pour chacun des paramètres omis. Par example,
si vous désirez spécifier uniquement un nom de style de paragraphe et un nom
de style de caractère, votre appel de fonction ressemblera à ceci:
Modified: trunk/Scribus/doc/it/scripterapi-constants.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/it/scripterapi-constants.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-constants.html (original)
+++ trunk/Scribus/doc/it/scripterapi-constants.html Thu Oct 3 04:21:35 2019
@@ -295,5 +295,16 @@
</dl>
</td></tr></table>
+<h4>Tab alignment</h4>
+<table><tr><td>
+<dl>
+ <dt>TAB_LEFT</dt>
+ <dt>TAB_RIGHT</dt>
+ <dt>TAB_PERIOD</dt>
+ <dt>TAB_COMMA</dt>
+ <dt>TAB_CENTER</dt>
+</dl>
+</td></tr></table>
+
</body>
</html>
Modified: trunk/Scribus/doc/it/scripterapi-styles.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/it/scripterapi-styles.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-styles.html (original)
+++ trunk/Scribus/doc/it/scripterapi-styles.html Thu Oct 3 04:21:35 2019
@@ -163,6 +163,14 @@
<li>dropcapoffset [optional] -> offset of the caps if used</li>
<li>"charstyle" [optional] -> char style to use</li>
<li>"bullet" [optional] -> string to use as bullet</li>
+<li>"tabs" [optional] -> a list of tab definitions
+<ul>
+ <li>a tab is defined as a tuple with the following format
(position,type,fillchar)</li>
+ <li>position [required] -> float value for the position</li>
+ <li>type [optional] -> left: 0 [default], right: 1, period: 2, comma: 3,
center: 4</li>
+ <li>fillchar [optional] -> the char to fill the space; default is none</li>
+</ul>
+</li>
</ul>
</p>
<p>If you wish to skip a number of settings, unfortunately, this command will
not accept null values, i.e., a series of commas. You <i>must</i> put some
integer value for each of the potential parameters. For example, imagine you
wish to only specify a name for the Paragraph Style, and the Character Style.
Your command should be something like:
Modified: trunk/Scribus/doc/ru/scripterapi-constants.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/ru/scripterapi-constants.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-constants.html (original)
+++ trunk/Scribus/doc/ru/scripterapi-constants.html Thu Oct 3 04:21:35 2019
@@ -1,305 +1,322 @@
-<html dir="ltr">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Predefined Constants</title>
-</head>
-<style>
-@import "manual.css";
-</style>
-<body>
-<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>
-<pre>
-if scribus.scribus_version_info[:3] < (1,2,2):
- messageBox("Scribus - Python script",
- "This script requires Scribus 1.2.2 or newer.
"+"You're running %s." % scribus.scribus_version,
scribus.ICON_CRITICAL)
- sys.exit()
-</pre>
-<p><em>Note that if you are using this style of import statement:</em></p>
-<pre>import scribus</pre>
-<p>you will need to add a prefix to these predefined constants, for example,
<strong>scribus.ICON_CRITICAL</strong>.</p>
-
-
-<h4>Unit Enumeration Constants: </h4>
-<table><tr><td>
-<dl>
- <dt>UNIT_POINTS</dt>
- <dd>Measurement Unit Point = 0</dd>
- <dt>UNIT_MILLIMETERS</dt>
- <dd>Measurement Unit Millimeter = 1</dd>
- <dt>UNIT_INCHES</dt>
- <dd>Measurement Unit Inch = 2</dd>
- <dt>UNIT_PICAS</dt>
- <dd>Measurement Unit Pica = 3</dd>
-</dl>
-</td></tr></table>
-
-<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>
-
-<table><tr><td>
-<dl>
- <dt>pt</dt>
- <dd>points in 1 pt</dd>
- <dt>inch</dt>
- <dd>inches in 1 pt <dt>p</dt> <dd>pica in 1 pt</dd> <dt>cm<dt>
- <dd>centimetres in 1 pt</dd>
- <dt>mm</dt>
- <dd>millimetres in 1 pt</dd>
- <dt>...</dt>
- <dd>Other constants will be provided if the Scribus core knows about
them.</dd>
-</dt></dt></dd></dl>
-</td></tr></table>
-
-<h4>Page Orientation Definitions: </h4>
-<table><tr><td>
-<dl>
- <dt>PORTRAIT</dt>
- <dd>Page orientation Portrait = 0</dd>
- <dt>LANDSCAPE</dt>
- <dd>Page orientation Landscape = 1</dd>
-</dl>
-</td></tr></table>
-
-<h4>Definitions for Page Formats: </h4>
-<p>If you are using these, it's important to understand that these
constants are simply tuples of these specific numbers. There are now two sets
of these constants for A and B series of paper formats.</p>
-<p>The original set, such as PAPER_A4, is used when a document is created with
points units. Now you can also use the similarly named PAPER_A4_MM when you are
using millimeters as the page units. As before, they must be used with the
appropriate constant, either UNIT_POINTS or UNIT_MILLIMETERS. What you can then
do, for example, is use them to create a document in points, then switch the
units of the document with the setUnit() command.</p>
-<table><tr>
-<td>
-<dl>
- <dt>PAPER_A0</dt>
- <dd>Paper format A0 = 2380 x 3368 Points</dd>
- <dt>PAPER_A1</dt>
- <dd>Paper format A1 = 1684 x 2380 Points</dd>
- <dt>PAPER_A2</dt>
- <dd>Paper format A2 = 1190 x 1684 Points</dd>
- <dt>PAPER_A3</dt>
- <dd>Paper format A3 = 842 x 1190 Points</dd>
- <dt>PAPER_A4</dt>
- <dd>Paper format A4 = 595 x 842 Points</dd>
- <dt>PAPER_A5</dt>
- <dd>Paper format A5 = 421 x 595 Points</dd>
- <dt>PAPER_A6</dt>
- <dd>Paper format A6 = 297 x 421 Points</dd>
- <dt>PAPER_A7</dt>
- <dd>Paper format A7 = 210 x 297 Points</dd>
- <dt>PAPER_A8</dt>
- <dd>Paper format A8 = 148 x 210 Points</dd>
- <dt>PAPER_A9</dt>
- <dd>Paper format A9 = 105 x 148 Points</dd></dl></td>
-<td>
-<dl>
- <dt>PAPER_A0_MM</dt>
- <dd>Paper format A0 = 841 x 1189 Millimeters</dd>
- <dt>PAPER_A1_MM</dt>
- <dd>Paper format A1 = 594 x 841 Millimeters</dd>
- <dt>PAPER_A2_MM</dt>
- <dd>Paper format A2 = 420 x 594 Millimeters</dd>
- <dt>PAPER_A3_MM</dt>
- <dd>Paper format A3 = 297 x 420 Millimeters</dd>
- <dt>PAPER_A4_MM</dt>
- <dd>Paper format A4 = 210 x 297 Millimeters</dd>
- <dt>PAPER_A5_MM</dt>
- <dd>Paper format A5 = 148 x 210 Millimeters</dd>
- <dt>PAPER_A6_MM</dt>
- <dd>Paper format A6 = 105 x 148 Millimeters</dd>
- <dt>PAPER_A7_MM</dt>
- <dd>Paper format A7 = 74 x 105 Millimeters</dd>
- <dt>PAPER_A8_MM</dt>
- <dd>Paper format A8 = 52 x 74 Millimeters</dd>
- <dt>PAPER_A9_MM</dt>
- <dd>Paper format A9 = 37 x 52 Millimeters</dd></dl></td></tr>
-<tr><td>
-<dl>
- <dt>PAPER_B0</dt>
- <dd>Paper format B0 = 2836 x 4008 Points</dd>
- <dt>PAPER_B1</dt>
- <dd>Paper format B1 = 2004 x 2836 Points</dd>
- <dt>PAPER_B2</dt>
- <dd>Paper format B2 = 1418 x 2004 Points</dd>
- <dt>PAPER_B3</dt>
- <dd>Paper format B3 = 1002 x 1418 Points</dd>
- <dt>PAPER_B4</dt>
- <dd>Paper format B4 = 709 x 1002 Points</dd>
- <dt>PAPER_B5</dt>
- <dd>Paper format B5 = 501 x 709 Points</dd>
- <dt>PAPER_B6</dt>
- <dd>Paper format B6 = 355 x 501 Points</dd>
- <dt>PAPER_B7</dt>
- <dd>Paper format B7 = 250 x 355 Points</dd>
- <dt>PAPER_B8</dt>
- <dd>Paper format B8 = 178 x 250 Points</dd>
- <dt>PAPER_B9</dt>
- <dd>Paper format B9 = 125 x 178 Points</dd>
- <dt>PAPER_B10</dt>
- <dd>Paper format B10 = 89 x 125 Points</dd></dl></td>
-<td>
-<dl>
- <dt>PAPER_B0_MM</dt>
- <dd>Paper format B0 = 1000 x 1414 Millimeters</dd>
- <dt>PAPER_B1_MM</dt>
- <dd>Paper format B1 = 707 x 1000 Millimeters</dd>
- <dt>PAPER_B2_MM</dt>
- <dd>Paper format B2 = 500 x 707 Millimeters</dd>
- <dt>PAPER_B3_MM</dt>
- <dd>Paper format B3 = 353 x 500 Millimeters</dd>
- <dt>PAPER_B4_MM</dt>
- <dd>Paper format B4 = 250 x 353 Millimeters</dd>
- <dt>PAPER_B5_MM</dt>
- <dd>Paper format B5 = 176 x 250 Millimeters</dd>
- <dt>PAPER_B6_MM</dt>
- <dd>Paper format B6 = 125 x 176 Millimeters</dd>
- <dt>PAPER_B7_MM</dt>
- <dd>Paper format B7 = 88 x 125 Millimeters</dd>
- <dt>PAPER_B8_MM</dt>
- <dd>Paper format B8 = 62 x 88 Millimeters</dd>
- <dt>PAPER_B9_MM</dt>
- <dd>Paper format B9 = 44 x 62 Millimeters</dd>
- <dt>PAPER_B10_MM</dt>
- <dd>Paper format B10 = 31 x 44 Millimeters</dd></dl></td></tr>
-<tr><td>
-<dl>
- <dt>PAPER_C5E</dt>
- <dd>Paper format C5E = 462 x 649 Points</dd>
- <dt>PAPER_COMM10E</dt>
- <dd>Paper format Comm10E = 298 x 683 Points</dd>
- <dt>PAPER_DLE</dt>
- <dd>Paper format DLE = 312 x 624 Points</dd>
- <dt>PAPER_EXECUTIVE</dt>
- <dd>Paper format Executive = 542 x 720 Points</dd>
- <dt>PAPER_FOLIO</dt>
- <dd>Paper format Folio = 595 x 935 Points</dd>
- <dt>PAPER_LEDGER</dt>
- <dd>Paper format Ledger = 1224 x 792 Points</dd>
- <dt>PAPER_LEGAL</dt>
- <dd>Paper format Legal = 612 x 1008 Points</dd>
- <dt>PAPER_LETTER</dt>
- <dd>Paper format Letter = 612 x 792 Points</dd>
- <dt>PAPER_TABLOID</dt>
- <dd>Paper format Tabloid = 792 x 1224 Points</dd>
-</dl></td></tr>
-</table>
-
-<h4>Definitions for Document Layout:</h4>
-<table><tr><td>
-<dl>
- <dt>FACINGPAGES</dt>
- <dd>Layout with facing Pages.</dd>
- <dt>NOFACINGPAGES</dt>
- <dd>Normal Layout of the Document.</dd>
- <dt>FIRSTPAGELEFT</dt>
- <dd>The first Page of the Document is a left Page.</dd>
- <dt>FIRSTPAGERIGHT</dt>
- <dd>The first Page of the Document is a right Page.</dd>
-</dl>
-</td></tr></table>
-
-<h4>Alignment Definitions: </h4>
-<table><tr><td>
-<dl>
- <dt>ALIGN_LEFT</dt>
- <dd>Text is aligned to the Left.</dd>
- <dt>ALIGN_CENTERED</dt>
- <dd>The Text is centered in the Textframe.</dd>
- <dt>ALIGN_RIGHT</dt>
- <dd>The Text is aligned to the Right Side of the Textframe</dd>
- <dt>ALIGN_FORCED</dt>
- <dd>The Text has forced Alignment</dd>
- <dt>ALIGN_BLOCK</dt>
- <dd>The Text has block Alignment</dd>
-</dl>
-</td></tr></table>
-
-<h4>Vertical alignment Definitions: </h4>
-<table><tr><td>
-<dl>
- <dt>ALIGNV_TOP</dt>
- <dd>Text is aligned vertically to the top.</dd>
- <dt>ALIGNV_CENTERED</dt>
- <dd>Text is aligned vertically to the center.</dd>
- <dt>ALIGNV_BOTTOM</dt>
- <dd>Text is aligned vertically to the bottom.</dd>
-</dl>
-</td></tr></table>
-
-<h4>Line related Definitions: </h4>
-<table><tr><td>
-<dl>
- <dt>LINE_DASH</dt>
- <dt>LINE_DASHDOT</dt>
- <dt>LINE_DASHDOTDOT</dt>
- <dt>LINE_DOT</dt>
- <dt>LINE_SOLID</dt>
- <dt><p></dt>
- <dt>JOIN_BEVEL</dt>
- <dt>JOIN_MITTER</dt>
- <dt>JOIN_ROUND</dt>
- <dt><p></dt>
- <dt>CAP_FLAT</dt>
- <dt>CAP_ROUND</dt>
- <dt>CAP_SQUARE</dt>
-</dl>
-</td></tr></table>
-
-<h4>Colorspace Definitions: </h4>
-<table><tr><td>
-<dl>
- <dt>CSPACE_UNDEFINED</dt>
- <dt>CSPACE_RGB</dt>
- <dt>CSPACE_CMYK</dt>
- <dt>CSPACE_GRAY</dt>
- <dt>CSPACE_DUOTONE</dt>
- <dt>CSPACE_MONOCHROME</dt>
-</dl>
-</td></tr></table>
-
-<h4>Fill related Definitions: </h4>
-<table><tr><td>
-<dl>
- <dt>FILL_NOG</dt>
- <dd>No gradient, plain color</dd>
- <dt>FILL_HORIZONTALG</dt>
- <dt>FILL_VERTICALG</dt>
- <dt>FILL_DIAGONALG</dt>
- <dt>FILL_CROSSDIAGONALG</dt>
- <dt>FILL_RADIALG</dt>
-</dl>
-</td></tr></table>
-
-<h4>Dialog Buttons</h4>
-<p>
-<table>
-<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>
- <tr><td>BUTTON_IGNORE</td><td>1048576</td></tr>
- <tr><td>BUTTON_NO</td><td>65536</td></tr>
- <tr><td>BUTTON_NONE</td><td>N/A</td></tr>
- <tr><td>BUTTON_OK</td><td>1024</td></tr>
- <tr><td>BUTTON_RETRY</td><td>524288</td></tr>
- <tr><td>BUTTON_YES</td><td>16384</td></tr>
-</table></p>
-
-<p>There is also a hierarchy of buttons in terms of how they appear in the
dialogs, with this ordering, left to right:</p>
-<p>BUTTON_YES, BUTTON_NO, BUTTON_OK, BUTTON_RETRY, BUTTON_IGNORE,
BUTTON_ABORT, BUTTON_CANCEL</p>
-<p>For example, even if you assign CANCEL to button1, RETRY to button2, and
YES to button3, they will appear YES, RETRY, and CANCEL left to right in the
dialog.</p>
-
-<h4>Dialog Icons</h4>
-<table><tr><td>
-<dl>
- <dt>ICON_CRITICAL</dt>
- <dt>ICON_INFORMATION</dt>
- <dt>ICON_NONE</dt>
- <dt>ICON_WARNING</dt>
-</dl>
-</td></tr></table>
-
-</body>
-</html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>Predefined Constants</title>
+</head>
+<style>
+@import "manual.css";
+</style>
+<body>
+<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>
+<pre>
+if scribus.scribus_version_info[:3] < (1,2,2):
+ messageBox("Scribus - Python script",
+ "This script requires Scribus 1.2.2 or newer. "+"You're running %s." %
scribus.scribus_version, scribus.ICON_CRITICAL)
+ sys.exit()
+</pre>
+<p><em>Note that if you are using this style of import statement:</em></p>
+<pre>import scribus</pre>
+<p>you will need to add a prefix to these predefined constants, for example,
<strong>scribus.ICON_CRITICAL</strong>.</p>
+
+
+<h4>Unit Enumeration Constants: </h4>
+<table><tr><td>
+<dl>
+ <dt>UNIT_POINTS</dt>
+ <dd>Measurement Unit Point = 0</dd>
+ <dt>UNIT_MILLIMETERS</dt>
+ <dd>Measurement Unit Millimeter = 1</dd>
+ <dt>UNIT_INCHES</dt>
+ <dd>Measurement Unit Inch = 2</dd>
+ <dt>UNIT_PICAS</dt>
+ <dd>Measurement Unit Pica = 3</dd>
+</dl>
+</td></tr></table>
+
+<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>
+
+<table><tr><td>
+<dl>
+ <dt>pt</dt>
+ <dd>points in 1 pt</dd>
+ <dt>inch</dt>
+ <dd>inches in 1 pt</dt>
+ <dt>p</dt>
+ <dd>pica in 1 pt</dd>
+ <dt>cm<dt>
+ <dd>centimetres in 1 pt</dd>
+ <dt>mm</dt>
+ <dd>millimetres in 1 pt</dd>
+ <dt>...</dt>
+ <dd>Other constants will be provided if the Scribus core knows about
them.</dd>
+</dl>
+</td></tr></table>
+
+<h4>Page Orientation Definitions: </h4>
+<table><tr><td>
+<dl>
+ <dt>PORTRAIT</dt>
+ <dd>Page orientation Portrait = 0</dd>
+ <dt>LANDSCAPE</dt>
+ <dd>Page orientation Landscape = 1</dd>
+</dl>
+</td></tr></table>
+
+<h4>Definitions for Page Formats: </h4>
+<p>If you are using these, it's important to understand that these constants
are simply tuples of these specific numbers. There are now two sets of these
constants for A and B series of paper formats.</p>
+<p>The original set, such as PAPER_A4, is used when a document is created with
points units. Now you can also use the similarly named PAPER_A4_MM when you are
using millimeters as the page units. As before, they must be used with the
appropriate constant, either UNIT_POINTS or UNIT_MILLIMETERS. What you can then
do, for example, is use them to create a document in points, then switch the
units of the document with the setUnit() command.</p>
+<table><tr>
+<td>
+<dl>
+ <dt>PAPER_A0</dt>
+ <dd>Paper format A0 = 2380 x 3368 Points</dd>
+ <dt>PAPER_A1</dt>
+ <dd>Paper format A1 = 1684 x 2380 Points</dd>
+ <dt>PAPER_A2</dt>
+ <dd>Paper format A2 = 1190 x 1684 Points</dd>
+ <dt>PAPER_A3</dt>
+ <dd>Paper format A3 = 842 x 1190 Points</dd>
+ <dt>PAPER_A4</dt>
+ <dd>Paper format A4 = 595 x 842 Points</dd>
+ <dt>PAPER_A5</dt>
+ <dd>Paper format A5 = 421 x 595 Points</dd>
+ <dt>PAPER_A6</dt>
+ <dd>Paper format A6 = 297 x 421 Points</dd>
+ <dt>PAPER_A7</dt>
+ <dd>Paper format A7 = 210 x 297 Points</dd>
+ <dt>PAPER_A8</dt>
+ <dd>Paper format A8 = 148 x 210 Points</dd>
+ <dt>PAPER_A9</dt>
+ <dd>Paper format A9 = 105 x 148 Points</dd></dl></td>
+<td>
+<dl>
+ <dt>PAPER_A0_MM</dt>
+ <dd>Paper format A0 = 841 x 1189 Millimeters</dd>
+ <dt>PAPER_A1_MM</dt>
+ <dd>Paper format A1 = 594 x 841 Millimeters</dd>
+ <dt>PAPER_A2_MM</dt>
+ <dd>Paper format A2 = 420 x 594 Millimeters</dd>
+ <dt>PAPER_A3_MM</dt>
+ <dd>Paper format A3 = 297 x 420 Millimeters</dd>
+ <dt>PAPER_A4_MM</dt>
+ <dd>Paper format A4 = 210 x 297 Millimeters</dd>
+ <dt>PAPER_A5_MM</dt>
+ <dd>Paper format A5 = 148 x 210 Millimeters</dd>
+ <dt>PAPER_A6_MM</dt>
+ <dd>Paper format A6 = 105 x 148 Millimeters</dd>
+ <dt>PAPER_A7_MM</dt>
+ <dd>Paper format A7 = 74 x 105 Millimeters</dd>
+ <dt>PAPER_A8_MM</dt>
+ <dd>Paper format A8 = 52 x 74 Millimeters</dd>
+ <dt>PAPER_A9_MM</dt>
+ <dd>Paper format A9 = 37 x 52 Millimeters</dd></dl></td></tr>
+<tr><td>
+<dl>
+ <dt>PAPER_B0</dt>
+ <dd>Paper format B0 = 2836 x 4008 Points</dd>
+ <dt>PAPER_B1</dt>
+ <dd>Paper format B1 = 2004 x 2836 Points</dd>
+ <dt>PAPER_B2</dt>
+ <dd>Paper format B2 = 1418 x 2004 Points</dd>
+ <dt>PAPER_B3</dt>
+ <dd>Paper format B3 = 1002 x 1418 Points</dd>
+ <dt>PAPER_B4</dt>
+ <dd>Paper format B4 = 709 x 1002 Points</dd>
+ <dt>PAPER_B5</dt>
+ <dd>Paper format B5 = 501 x 709 Points</dd>
+ <dt>PAPER_B6</dt>
+ <dd>Paper format B6 = 355 x 501 Points</dd>
+ <dt>PAPER_B7</dt>
+ <dd>Paper format B7 = 250 x 355 Points</dd>
+ <dt>PAPER_B8</dt>
+ <dd>Paper format B8 = 178 x 250 Points</dd>
+ <dt>PAPER_B9</dt>
+ <dd>Paper format B9 = 125 x 178 Points</dd>
+ <dt>PAPER_B10</dt>
+ <dd>Paper format B10 = 89 x 125 Points</dd></dl></td>
+<td>
+<dl>
+ <dt>PAPER_B0_MM</dt>
+ <dd>Paper format B0 = 1000 x 1414 Millimeters</dd>
+ <dt>PAPER_B1_MM</dt>
+ <dd>Paper format B1 = 707 x 1000 Millimeters</dd>
+ <dt>PAPER_B2_MM</dt>
+ <dd>Paper format B2 = 500 x 707 Millimeters</dd>
+ <dt>PAPER_B3_MM</dt>
+ <dd>Paper format B3 = 353 x 500 Millimeters</dd>
+ <dt>PAPER_B4_MM</dt>
+ <dd>Paper format B4 = 250 x 353 Millimeters</dd>
+ <dt>PAPER_B5_MM</dt>
+ <dd>Paper format B5 = 176 x 250 Millimeters</dd>
+ <dt>PAPER_B6_MM</dt>
+ <dd>Paper format B6 = 125 x 176 Millimeters</dd>
+ <dt>PAPER_B7_MM</dt>
+ <dd>Paper format B7 = 88 x 125 Millimeters</dd>
+ <dt>PAPER_B8_MM</dt>
+ <dd>Paper format B8 = 62 x 88 Millimeters</dd>
+ <dt>PAPER_B9_MM</dt>
+ <dd>Paper format B9 = 44 x 62 Millimeters</dd>
+ <dt>PAPER_B10_MM</dt>
+ <dd>Paper format B10 = 31 x 44 Millimeters</dd></dl></td></tr>
+<tr><td>
+<dl>
+ <dt>PAPER_C5E</dt>
+ <dd>Paper format C5E = 462 x 649 Points</dd>
+ <dt>PAPER_COMM10E</dt>
+ <dd>Paper format Comm10E = 298 x 683 Points</dd>
+ <dt>PAPER_DLE</dt>
+ <dd>Paper format DLE = 312 x 624 Points</dd>
+ <dt>PAPER_EXECUTIVE</dt>
+ <dd>Paper format Executive = 542 x 720 Points</dd>
+ <dt>PAPER_FOLIO</dt>
+ <dd>Paper format Folio = 595 x 935 Points</dd>
+ <dt>PAPER_LEDGER</dt>
+ <dd>Paper format Ledger = 1224 x 792 Points</dd>
+ <dt>PAPER_LEGAL</dt>
+ <dd>Paper format Legal = 612 x 1008 Points</dd>
+ <dt>PAPER_LETTER</dt>
+ <dd>Paper format Letter = 612 x 792 Points</dd>
+ <dt>PAPER_TABLOID</dt>
+ <dd>Paper format Tabloid = 792 x 1224 Points</dd>
+</dl></td></tr>
+</table>
+
+<h4>Definitions for Document Layout:</h4>
+<table><tr><td>
+<dl>
+ <dt>FACINGPAGES</dt>
+ <dd>Layout with facing Pages.</dd>
+ <dt>NOFACINGPAGES</dt>
+ <dd>Normal Layout of the Document.</dd>
+ <dt>FIRSTPAGELEFT</dt>
+ <dd>The first Page of the Document is a left Page.</dd>
+ <dt>FIRSTPAGERIGHT</dt>
+ <dd>The first Page of the Document is a right Page.</dd>
+</dl>
+</td></tr></table>
+
+<h4>Alignment Definitions: </h4>
+<table><tr><td>
+<dl>
+ <dt>ALIGN_LEFT</dt>
+ <dd>Text is aligned to the Left.</dd>
+ <dt>ALIGN_CENTERED</dt>
+ <dd>The Text is centered in the Textframe.</dd>
+ <dt>ALIGN_RIGHT</dt>
+ <dd>The Text is aligned to the Right Side of the Textframe</dd>
+ <dt>ALIGN_FORCED</dt>
+ <dd>The Text has forced Alignment</dd>
+ <dt>ALIGN_BLOCK</dt>
+ <dd>The Text has block Alignment</dd>
+</dl>
+</td></tr></table>
+
+<h4>Vertical alignment Definitions: </h4>
+<table><tr><td>
+<dl>
+ <dt>ALIGNV_TOP</dt>
+ <dd>Text is aligned vertically to the top.</dd>
+ <dt>ALIGNV_CENTERED</dt>
+ <dd>Text is aligned vertically to the center.</dd>
+ <dt>ALIGNV_BOTTOM</dt>
+ <dd>Text is aligned vertically to the bottom.</dd>
+</dl>
+</td></tr></table>
+
+<h4>Line related Definitions: </h4>
+<table><tr><td>
+<dl>
+ <dt>LINE_DASH</dt>
+ <dt>LINE_DASHDOT</dt>
+ <dt>LINE_DASHDOTDOT</dt>
+ <dt>LINE_DOT</dt>
+ <dt>LINE_SOLID</dt>
+ <dt><p/></dt>
+ <dt>JOIN_BEVEL</dt>
+ <dt>JOIN_MITTER</dt>
+ <dt>JOIN_ROUND</dt>
+ <dt><p/></dt>
+ <dt>CAP_FLAT</dt>
+ <dt>CAP_ROUND</dt>
+ <dt>CAP_SQUARE</dt>
+</dl>
+</td></tr></table>
+
+<h4>Colorspace Definitions: </h4>
+<table><tr><td>
+<dl>
+ <dt>CSPACE_UNDEFINED</dt>
+ <dt>CSPACE_RGB</dt>
+ <dt>CSPACE_CMYK</dt>
+ <dt>CSPACE_GRAY</dt>
+ <dt>CSPACE_DUOTONE</dt>
+ <dt>CSPACE_MONOCHROME</dt>
+</dl>
+</td></tr></table>
+
+<h4>Fill related Definitions: </h4>
+<table><tr><td>
+<dl>
+ <dt>FILL_NOG</dt>
+ <dd>No gradient, plain color</dd>
+ <dt>FILL_HORIZONTALG</dt>
+ <dt>FILL_VERTICALG</dt>
+ <dt>FILL_DIAGONALG</dt>
+ <dt>FILL_CROSSDIAGONALG</dt>
+ <dt>FILL_RADIALG</dt>
+</dl>
+</td></tr></table>
+
+<h4>Dialog Buttons</h4>
+<p>
+<table>
+<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>
+ <tr><td>BUTTON_IGNORE</td><td>1048576</td></tr>
+ <tr><td>BUTTON_NO</td><td>65536</td></tr>
+ <tr><td>BUTTON_NONE</td><td>N/A</td></tr>
+ <tr><td>BUTTON_OK</td><td>1024</td></tr>
+ <tr><td>BUTTON_RETRY</td><td>524288</td></tr>
+ <tr><td>BUTTON_YES</td><td>16384</td></tr>
+</table></p>
+
+<p>There is also a hierarchy of buttons in terms of how they appear in the
dialogs, with this ordering, left to right:</p>
+<p>BUTTON_YES, BUTTON_NO, BUTTON_OK, BUTTON_RETRY, BUTTON_IGNORE,
BUTTON_ABORT, BUTTON_CANCEL</p>
+<p>For example, even if you assign CANCEL to button1, RETRY to button2, and
YES to button3, they will appear YES, RETRY, and CANCEL left to right in the
dialog.</p>
+
+<h4>Dialog Icons</h4>
+<table><tr><td>
+<dl>
+ <dt>ICON_CRITICAL</dt>
+ <dt>ICON_INFORMATION</dt>
+ <dt>ICON_NONE</dt>
+ <dt>ICON_WARNING</dt>
+</dl>
+</td></tr></table>
+
+<h4>Tab alignment</h4>
+<table><tr><td>
+<dl>
+ <dt>TAB_LEFT</dt>
+ <dt>TAB_RIGHT</dt>
+ <dt>TAB_PERIOD</dt>
+ <dt>TAB_COMMA</dt>
+ <dt>TAB_CENTER</dt>
+</dl>
+</td></tr></table>
+
+</body>
+</html>
Modified: trunk/Scribus/doc/ru/scripterapi-styles.html
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/doc/ru/scripterapi-styles.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-styles.html (original)
+++ trunk/Scribus/doc/ru/scripterapi-styles.html Thu Oct 3 04:21:35 2019
@@ -1,6 +1,6 @@
-<html dir="ltr">
+<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Creating and Manipulating Styles</title>
</head>
<style>
@@ -13,11 +13,13 @@
<dt><a name="-createCharStyle"><strong>createCharStyle</strong></a>(...)</dt>
<dd><code>createCharStyle(...)</code>
-<p>Creates a character style. This function takes the following keyword
parameters: <ul>
-<li>"name" [required] -> name of the char style to create (first
parameter)</li>
-<li>"font" [optional] -> name of the font to use (second
parameter)</li>
-<li>fontsize [optional] -> font size to set (double) (third parameter)</li>
-<li>"features" [optional] -> nearer typographic details can be
defined by a string that might contain the following phrases comma-separated
(without spaces!) (fourth parameter - a string): <ul>
+<p>Creates a character style. This function takes the following keyword
parameters:
+<ul>
+<li>"name" [required] -> name of the char style to create (first
parameter)</li>
+<li>"font" [optional] -> name of the font to use (second parameter)</li>
+<li>fontsize [optional] -> font size to set (double) (third parameter)</li>
+<li>"features" [optional] -> nearer typographic details can be defined by a
string that might contain the following phrases comma-separated (without
spaces!) (fourth parameter - a string):
+<ul>
<li>inherit</li>
<li>bold</li>
<li>italic</li>
@@ -30,104 +32,155 @@
<li>shadowed</li>
<li>allcaps</li>
<li>smallcaps</li>
-</ul> </li>
-<li>"fillcolor" [optional], fillshade [optional] -> specify fill
options (5th parameter: string, 6th parameter: a float 1.0 = 100%)</li>
-<li>"strokecolor" [optional], strokeshade [optional] -> specify
stroke options (7th parameter: string, 8th parameter: a float 1.0 = 100%)</li>
-<li>baselineoffset [optional] -> offset of the baseline (ninth
parameter)</li>
-<li>shadowxoffset [optional], shadowyoffset [optional] -> offset of the
shadow if used (10th and 11th parameters)</li>
-<li>outlinewidth [optional] -> width of the outline if used (12th
parameter)</li>
-<li>underlineoffset [optional], underlinewidth [optional] -> underline
options if used (13th and 14th parameters)</li>
-<li>strikethruoffset [optional], strikethruwidth [optional] -> strikethru
options if used (15th and 16th parameters)</li>
-<li>scaleh [optional], scalev [optional] -> scale of the chars (17th and
18th parameters - float values, 1.0 = 100%)</li>
-<li>tracking [optional] -> tracking of the text (19th parameter - number
with odd math, e.g. -50 = -5.0%)</li>
-<li>"language" [optional] -> language code (20th parameter - a
string en = English)</li>
-<li>"fontfeatures" [optional] -> a string that contains a
comma-separated list of OpenType font features (21th parameter - a string): <ul>
- <li>Ligatures: <ul>
+</ul>
+</li>
+<li>"fillcolor" [optional], fillshade [optional] -> specify fill options (5th
parameter: string, 6th parameter: a float 1.0 = 100%)</li>
+<li>"strokecolor" [optional], strokeshade [optional] -> specify stroke options
(7th parameter: string, 8th parameter: a float 1.0 = 100%)</li>
+<li>baselineoffset [optional] -> offset of the baseline (ninth parameter)</li>
+<li>shadowxoffset [optional], shadowyoffset [optional] -> offset of the shadow
if used (10th and 11th parameters)</li>
+<li>outlinewidth [optional] -> width of the outline if used (12th
parameter)</li>
+<li>underlineoffset [optional], underlinewidth [optional] -> underline options
if used (13th and 14th parameters)</li>
+<li>strikethruoffset [optional], strikethruwidth [optional] -> strikethru
options if used (15th and 16th parameters)</li>
+<li>scaleh [optional], scalev [optional] -> scale of the chars (17th and 18th
parameters - float values, 1.0 = 100%)</li>
+<li>tracking [optional] -> tracking of the text (19th parameter - number with
odd math, e.g. -50 = -5.0%)</li>
+<li>"language" [optional] -> language code (20th parameter - a string en =
English)</li>
+<li>"fontfeatures" [optional] -> a string that contains a comma-separated list
of OpenType font features (21th parameter - a string):
+<ul>
+ <li>Ligatures:
+ <ul>
<li>-liga: disable common ligatures</li>
<li>-clig: disable contextual ligatures</li>
<li>+dlig: enable discretionary ligatures</li>
<li>+hlig: enable historical ligatures</li>
- </ul> </li>
- <li>Script Position: <ul>
+ </ul>
+ </li>
+ <li>Script Position:
+ <ul>
<li>+subs: enable subscript</li>
<li>+sups: enable superscript</li>
<li>+ordn: enable ordinals</li>
- </ul> </li>
- <li>Capitals: <ul>
+ </ul>
+ </li>
+ <li>Capitals:
+ <ul>
<li>+smcp: enable small capitals</li>
<li>+c2sc: enable small capitals from capitals</li>
<li>+pcap: enable petite capitals</li>
<li>+c2pc: enable petite capitals from capitals</li>
<li>+unic: enable unicase</li>
<li>+titl: enable titling</li>
- </ul> </li>
- <li>Numerals: <ul>
+ </ul>
+ </li>
+ <li>Numerals:
+ <ul>
<li>+lnum: enable lining figures</li>
<li>+tnum: enable old style numerals</li>
- </ul> </li>
- <li>Numeral Width: <ul>
+ </ul>
+ </li>
+ <li>Numeral Width:
+ <ul>
<li>+pnum: enable proportional figures</li>
<li>+tnum: enable tabular figures</li>
- </ul> </li>
- <li>Numeral Fractions: <ul>
+ </ul>
+ </li>
+ <li>Numeral Fractions:
+ <ul>
<li>+frac: enable diagonal fractions</li>
<li>+afrc: enable stacked fractions</li>
- </ul> </li>
- <li>Numeral zero: <ul>
+ </ul>
+ </li>
+ <li>Numeral zero:
+ <ul>
<li>+zero: enable slashed zero</li>
- </ul> </li>
- <li>Style sets: <ul>
+ </ul>
+ </li>
+ <li>Style sets:
+ <ul>
<li>+ss01: enable 1st style set</li>
<li>...</li>
<li>+ss20: enable 20th style set</li>
- </ul> </li>
-</ul> </li>
-</ul> </p>
-<p>On a practical level, this is a challenging command to fully understand if
you wish to assign a number of settings, since keeping track of where you are,
and which kind of entry is needed (string vs number) is not easy. For some
guidance on this showing in particular how to set tracking, see the wiki page
<a href="https://wiki.scribus.net/canvas/Text_and_Text_Manipulation">Text and
Text Manipulation</a>.</p>
+ </ul>
+ </li>
+</ul>
+</li>
+</ul>
+</p>
+<p>Any style attribute not explicitly defined will have its value inherited
from default character style.</p>
+<p>Due to the important number of arguments of this function, it is strongly
advised to use Python keyword syntax when calling this function. For example if
a style needs to alter only font size, do not use this syntax:
+<ul style="list-style-type:none">
+ <li><code>newStyle = createCharStyle("New Style", "Arial Regular",
12)</code></li>
+</ul></p>
+<p>but use this syntax instead:
+<ul style="list-style-type:none">
+ <li><code>newStyle = createCharStyle("New Style", fontsize=12)</code></li>
+</ul>
+</p>
+<p>For some guidance on this showing in particular how to set tracking, see
the wiki page <a
href="https://wiki.scribus.net/canvas/Text_and_Text_Manipulation">Text and Text
Manipulation</a>.</p>
</dd>
<dt><a
name="-createCustomLineStyle"><strong>createCustomLineStyle</strong></a>(...)</dt>
<dd><code>createCustomLineStyle(styleName, style)</code>
-<p>Creates the custom line style 'styleName'.</p>
-<p>This function takes list of dictionary as parameter for "style".
Each dictionary represent one subline within style. Dictionary can have those
keys: <ul>
-<li>Color [optional] -> name of the color to use (string)</li>
-<li>Dash [optional] -> type of line to use (integer)</li>
-<li>LineEnd [optional] -> type of LineEnd to use (integer)</li>
-<li>LineJoin [optional] -> type of LineJoin to use (integer)</li>
-<li>Shade [optional] -> opacity of line (integer)</li>
-<li>Width [optional] -> width of line (double)</li>
-</ul> </p>
+<p>Creates the custom line style 'styleName'.</p>
+<p>This function takes list of dictionary as parameter for "style". Each
dictionary represent one subline within style. Dictionary can have those keys:
+<ul>
+<li>Color [optional] -> name of the color to use (string)</li>
+<li>Dash [optional] -> type of line to use (integer)</li>
+<li>LineEnd [optional] -> type of LineEnd to use (integer)</li>
+<li>LineJoin [optional] -> type of LineJoin to use (integer)</li>
+<li>Shade [optional] -> opacity of line (integer)</li>
+<li>Width [optional] -> width of line (double)</li>
+</ul>
+</p>
</dd>
<dt><a
name="-createParagraphStyle"><strong>createParagraphStyle</strong></a>(...)</dt>
<dd><code>createParagraphStyle(...)</code>
-<p>Creates a paragraph style. This function takes the following keyword
parameters: <ul>
-<li>"name" [required] -> specifies the name of the paragraphstyle
to create</li>
-<li>linespacingmode [optional] -> specifies the linespacing mode; possible
modes are: <ul>
+<p>Creates a paragraph style. This function takes the following keyword
parameters:
+<ul>
+<li>"name" [required] -> specifies the name of the paragraphstyle to
create</li>
+<li>linespacingmode [optional] -> specifies the linespacing mode; possible
modes are:
+<ul>
<li>fixed linespacing: 0</li>
<li>automatic linespacing: 1</li>
<li>baseline grid linespacing: 2</li>
-</ul> </li>
-<li>linespacing [optional] -> specifies the linespacing if using fixed
linespacing</li>
-<li>alignment [optional] -> specifies the alignment of the paragraph <ul>
+</ul>
+</li>
+<li>linespacing [optional] -> specifies the linespacing if using fixed
linespacing</li>
+<li>alignment [optional] -> specifies the alignment of the paragraph
+<ul>
<li>left: 0</li>
<li>center: 1</li>
<li>right: 2</li>
<li>justify: 3</li>
<li>extend: 4</li>
-</ul> </li>
-<li>leftmargin [optional], rightmargin [optional] -> specify the margin</li>
-<li>gapbefore [optional], gapafter [optional] -> specify the gaps to the
heading and following paragraphs</li>
-<li>firstindent [optional] -> the indent of the first line</li>
-<li>hasdropcap [optional] -> specifies if there are caps (1 = yes, 0 =
no)</li>
-<li>dropcaplines [optional] -> height (in lines) of the caps if used</li>
-<li>dropcapoffset [optional] -> offset of the caps if used</li>
-<li>"charstyle" [optional] -> char style to use</li>
-</ul> </p>
-<p>If you wish to skip a number of settings, unfortunately, this command will
not accept null values, i.e., a series of commas. You <i>must</i> put some
integer value for each of the potential parameters. For example, imagine you
wish to only specify a name for the Paragraph Style, and the Character Style.
Your command should be something like:</p>
-<p><strong>scribus.createParagraphStyle("MyNewStyle",0,0,0,0,0,0,0,0,0,"MyCharStyle")</strong></p>
-<p>On the other hand, if you only wanted to specify a name and linespacing
mode, you can quit whenever after you finished with non-zero data:</p>
-<p><strong>scribus.createParagraphStyle("MyOtherNewStyle",1)</strong></p>
+</ul>
+</li>
+<li>leftmargin [optional], rightmargin [optional] -> specify the margin</li>
+<li>gapbefore [optional], gapafter [optional] -> specify the gaps to the
heading and following paragraphs</li>
+<li>firstindent [optional] -> the indent of the first line</li>
+<li>hasdropcap [optional] -> specifies if there are caps (1 = yes, 0 = no)</li>
+<li>dropcaplines [optional] -> height (in lines) of the caps if used</li>
+<li>dropcapoffset [optional] -> offset of the caps if used</li>
+<li>"charstyle" [optional] -> char style to use</li>
+<li>"bullet" [optional] -> string to use as bullet</li>
+<li>"tabs" [optional] -> a list of tab definitions
+<ul>
+ <li>a tab is defined as a tuple with the following format
(position,type,fillchar)</li>
+ <li>position [required] -> float value for the position</li>
+ <li>type [optional] -> left: 0 [default], right: 1, period: 2, comma: 3,
center: 4</li>
+ <li>fillchar [optional] -> the char to fill the space; default is none</li>
+</ul>
+</li>
+</ul>
+</p>
+<p>If you wish to skip a number of settings, unfortunately, this command will
not accept null values, i.e., a series of commas. You <i>must</i> put some
integer value for each of the potential parameters. For example, imagine you
wish to only specify a name for the Paragraph Style, and the Character Style.
Your command should be something like:
+<ul style="list-style-type:none">
+ <li><code>scribus.createParagraphStyle("MyNewStyle", 0, 0, 0, 0, 0, 0, 0,
0, 0, "MyCharStyle"))</code></li>
+</ul></p>
+<p>On the other hand, if you only wanted to specify a name and linespacing
mode, you can quit whenever after you finished with non-zero data:
+<ul style="list-style-type:none">
+ <li><code>scribus.createParagraphStyle("MyOtherNewStyle", 1)</code></li>
+</ul></p>
</dd>
<dt><a name="-getAllStyles"><strong>getAllStyles</strong></a>(...)</dt>
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.cpp Thu Oct 3
04:21:35 2019
@@ -39,17 +39,19 @@
const_cast<char*>("dropcapoffset"),
const_cast<char*>("charstyle"),
const_cast<char*>("bullet"),
+ const_cast<char*>("tabs"),
nullptr};
char *name = const_cast<char*>(""), *charStyle = const_cast<char*>("");
char *bullet = const_cast<char*>("");
int lineSpacingMode = 0, alignment = 0, dropCapLines = 2, hasDropCap =
0;
double lineSpacing = 15.0, leftMargin = 0.0, rightMargin = 0.0;
double gapBefore = 0.0, gapAfter = 0.0, firstIndent = 0.0, peOffset = 0;
- if (!PyArg_ParseTupleAndKeywords(args, keywords, "es|ididddddiideses",
+ PyObject *tabDefinitions = nullptr;
+ if (!PyArg_ParseTupleAndKeywords(args, keywords, "es|ididddddiidesesO",
keywordargs, "utf-8", &name, &lineSpacingMode, &lineSpacing,
&alignment,
&leftMargin, &rightMargin, &gapBefore, &gapAfter, &firstIndent,
&hasDropCap, &dropCapLines, &peOffset, "utf-8", &charStyle,
- "utf-8", &bullet))
+ "utf-8", &bullet, &tabDefinitions))
return nullptr;
if (!checkHaveDocument())
return nullptr;
@@ -105,9 +107,45 @@
{
tmpParagraphStyle.setHasBullet(false);
}
-
+
tmpParagraphStyle.setParEffectOffset(peOffset);
tmpParagraphStyle.charStyle().setParent(charStyle);
+
+ if (tabDefinitions != nullptr)
+ {
+ int n = PyList_Size(tabDefinitions);
+ for (int i = 0; i < n; i++)
+ {
+ PyObject* tabDefinition =
PyList_GetItem(tabDefinitions, i);
+ int size = PyTuple_Check(tabDefinition) ?
PyTuple_Size(tabDefinition) : 1;
+ PyObject* tabPositionDefinition =
PyTuple_Check(tabDefinition) ? PyTuple_GetItem(tabDefinition, 0) :
tabDefinition;
+
+ float tabPosition = 0.0;
+ if (!PyArg_Parse(tabPositionDefinition, "f",
&tabPosition))
+ {
+ PyErr_SetString(PyExc_TypeError,
QObject::tr("invalid tab-position specified.","python
error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ int tabType = 0;
+ if (size >= 2) {
+ PyArg_Parse(PyTuple_GetItem(tabDefinition, 1),
"i", &tabType);
+ }
+
+ char *fillChar = const_cast<char*>("");
+ if (size == 3) {
+ PyArg_Parse(PyTuple_GetItem(tabDefinition, 2),
"es", "utf-8", &fillChar);
+ }
+
+ QString fillCharString =
QString::fromUtf8(fillChar).trimmed();
+
+ ParagraphStyle::TabRecord tr;
+ tr.tabFillChar = (fillCharString.size() > 0) ?
fillCharString.at(0) : QChar();
+ tr.tabPosition = static_cast<qreal>(tabPosition);
+ tr.tabType = tabType;
+ tmpParagraphStyle.appendTabValue(tr);
+ }
+ }
StyleSet<ParagraphStyle> tmpStyleSet;
tmpStyleSet.create(tmpParagraphStyle);
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.h
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdstyle.h Thu Oct 3
04:21:35 2019
@@ -41,6 +41,11 @@
dropcapoffset [optional] -> offset of the caps if used\n\n\
\"charstyle\" [optional] -> char style to use\n\n\
\"bullet\" [optional] -> string to use as bullet\n\n\
+\"tabs\" [optional] -> a list containg tab definitions\n\n\
+-> a tab is defined as a tuple with the following format
(position,type,fillchar)\"\n\n\
+-> position [required] -> float value for the position\n\n\
+-> type [optional] -> left: 0 [default], right: 1, period: 2, comma: 3,
center: 4\n\n\
+-> fillchar [optional] -> the char to fill the space; default is none\n\n\
"));
/*! 02.01.2007 - 05.01.2007 : Joachim Neu : Create a paragraph style.
Special thanks go to avox for helping me! */
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL:
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23232&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Thu Oct 3
04:21:35 2019
@@ -784,6 +784,12 @@
PyDict_SetItemString(d, const_cast<char*>("PAGE_2"),
Py_BuildValue(const_cast<char*>("i"), 1));
PyDict_SetItemString(d, const_cast<char*>("PAGE_3"),
Py_BuildValue(const_cast<char*>("i"), 2));
PyDict_SetItemString(d, const_cast<char*>("PAGE_4"),
Py_BuildValue(const_cast<char*>("i"), 3));
+ // tab alignment
+ PyDict_SetItemString(d, const_cast<char*>("TAB_LEFT"),
Py_BuildValue(const_cast<char*>("i"), 0));
+ PyDict_SetItemString(d, const_cast<char*>("TAB_RIGHT"),
Py_BuildValue(const_cast<char*>("i"), 1));
+ PyDict_SetItemString(d, const_cast<char*>("TAB_PERIOD"),
Py_BuildValue(const_cast<char*>("i"), 2));
+ PyDict_SetItemString(d, const_cast<char*>("TAB_COMMA"),
Py_BuildValue(const_cast<char*>("i"), 3));
+ PyDict_SetItemString(d, const_cast<char*>("TAB_CENTER"),
Py_BuildValue(const_cast<char*>("i"), 4));
// Measurement units understood by Scribus's units.cpp functions are
exported as constant conversion
// factors to be used from Python.
_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit