r22785 by jghali - #15508: getTextColor / getLineColor mixup in the scripter documentation
scribus-commit
scribus-commit at lists.scribus.net
Fri Dec 14 22:58:00 UTC 2018
Author: jghali
Date: Fri Dec 14 22:58:00 2018
New Revision: 22785
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22785
Log:
#15508: getTextColor / getLineColor mixup in the scripter documentation
Modified:
trunk/Scribus/doc/de/scripterapi-textframes.html
trunk/Scribus/doc/en/scripterapi-textframes.html
trunk/Scribus/doc/fr/scripterapi-textframes.html
trunk/Scribus/doc/it/scripterapi-textframes.html
Modified: trunk/Scribus/doc/de/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22785&path=/trunk/Scribus/doc/de/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/de/scripterapi-textframes.html Fri Dec 14 22:58:00 2018
@@ -49,8 +49,9 @@
<p>Returns the text of the text frame "name". If this text frame has some text selected, the selected text is returned. All text in the frame, not just currently visible text, is returned. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
-<dd><code>getLineColor(["name"]) -> string</code>
-<p>Returns the name of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
+<dd><code>getTextColor(["name"]) -> string</code>
+<p>Returns the name of the text color used for text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
<dt><a name="-getTextDistances"><strong>getTextDistances</strong></a>(...)</dt>
<dd><code>getTextDistances(["name"]) -> tuple</code>
@@ -67,8 +68,13 @@
<p>Returns the number of lines of the text in the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
-<dd><code>getLineShade(["name"]) -> integer</code>
-<p>Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
+<dd><code>getTextShade(["name"]) -> integer</code>
+<p>Returns the shade of text color used for text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
+
+<dt><a name="-getTextVerticalAlignment"><strong>getTextVerticalAlignment</strong></a>(...)</dt>
+<dd><code>getTextVerticalAlignment(["name"]) -> integer</code>
+<p>Gets the vertical alignment of text inside text frame "name". If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-hyphenateText"><strong>hyphenateText</strong></a>(...)</dt>
<dd><code>hyphenateText(["name"]) -> bool</code>
@@ -93,7 +99,14 @@
<dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
<dd><code>selectText(start, count, ["name"])</code>
<p>Selects "count" characters of text in the text frame "name" starting from the character "start". Character counting starts at 0. If "count" is zero, any text selection will be cleared. If "name" is not given the currently selected item is used.</p>
-<p>May throw IndexError if the selection is outside the bounds of the text.</p></dd>
+<p>May throw IndexError if the selection is outside the bounds of the text.</p>
+<p>There is no specific command to select all of the text in a frame. To accomplish this, you might create a function in your script which you would call with the name of the frame as follows:</p>
+<p><b>def SelectAllText(textframe):</b></p>
+ <p><b> texlen = scribus.getTextLength(textframe)</b></p>
+ <p><b> scribus.selectText(0,texlen,textframe)</b></p>
+ <p><b> return</b></p></dd>
+<dd><p>One of the reasons this is important is that, should you want to select a frame and then apply a Paragraph Style to the frame, you will find that a frame with multiple paragraphs will not have the style set for all of the text, only the last paragraph. Therefore, the solution is to select all the text of the frame, and then apply the style.</p></dd>
+
<dt><a name="-setColumns"><strong>setColumns</strong></a>(...)</dt>
<dd><code>setColumns(nr, ["name"])</code>
@@ -166,6 +179,13 @@
<dd><code>setTextStroke("color", ["name"])</code>
<p>Set "color" of the text stroke. If "name" is not given the currently selected item is used.</p></dd>
+<dt><a name="-setTextVerticalAlignment"><strong>setTextVerticalAlignment</strong></a>(...)</dt>
+<dd>
+<code>setTextVerticalAlignment(align, ["name"])</code>
+<p>Sets the vertical alignment of text inside text frame "name" to the specified alignment. If "name" is not given the currently selected item is used. "align" should be one of the ALIGNV_ constants defined in this module - see dir(scribus).</p>
+<p>May throw ValueError for an invalid alignment constant.</p>
+</dd>
+
<dt><a name="-textOverflows"><strong>textOverflows</strong></a>(...)</dt>
<dd><code>textOverflows(["name", nolinks]) -> integer</code>
<p>Returns 1 if there are overflowing characters in text frame "name", 0 if not. If is nolinks set to non zero value it takes only one frame - it doesn't use text frame linking. Without this parameter it search all linking chain.</p>
Modified: trunk/Scribus/doc/en/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22785&path=/trunk/Scribus/doc/en/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/en/scripterapi-textframes.html Fri Dec 14 22:58:00 2018
@@ -49,8 +49,9 @@
<p>Returns the text of the text frame "name". If this text frame has some text selected, the selected text is returned. All text in the frame, not just currently visible text, is returned. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
-<dd><code>getLineColor(["name"]) -> string</code>
-<p>Returns the name of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
+<dd><code>getTextColor(["name"]) -> string</code>
+<p>Returns the name of the text color used for text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
<dt><a name="-getTextDistances"><strong>getTextDistances</strong></a>(...)</dt>
<dd><code>getTextDistances(["name"]) -> tuple</code>
@@ -68,7 +69,8 @@
<dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
<dd><code>getTextShade(["name"]) -> integer</code>
-<p>Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
+<p>Returns the shade of text color used for text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
<dt><a name="-getTextVerticalAlignment"><strong>getTextVerticalAlignment</strong></a>(...)</dt>
<dd><code>getTextVerticalAlignment(["name"]) -> integer</code>
Modified: trunk/Scribus/doc/fr/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22785&path=/trunk/Scribus/doc/fr/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/fr/scripterapi-textframes.html Fri Dec 14 22:58:00 2018
@@ -45,8 +45,9 @@
Tout le texte présent dans le cadre, et non seulement le texte visible, est retourné. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
<dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
-<dd><code><a href="#-getLineColor">getLineColor</a>(["nom"]) -> chaîne</code>
-<p>Retourne le nom de la couleur de filet de l'objet "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
+<dd><code><a href="#-getLineColor">getTextColor</a>(["nom"]) -> chaîne</code>
+<p>Retourne le nom de la couleur de texte définie pour l'objet "nom". Si ce cadre contient du texte sélectionné, la valeur assignée au premier caractère de la sélection est retournée. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p>
+<p>Peut générer ValueError si la constante d'alignement n'est pas valide.</p></dd>
<dt><a name="-getTextLength"><strong>getTextLength</strong></a>(...)</dt>
<dd><code><a href="#-getTextLength">getTextLength</a>(["nom"]) -> nombre entier</code>
@@ -54,7 +55,8 @@
<dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
<dd><code><a href="#-getTextShade">getTextShade</a>(["nom"]) -> nombre entier</code>
-<p>Retourne la valeur de la teinte de la couleur de filet de l'objet "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
+<p>Retourne la valeur de la teinte de couleur définie pour le texte de l'objet "nom". Si ce cadre contient du texte sélectionné, la valeur assignée au premier caractère de la sélection est retournée. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p>
+<p>Peut générer ValueError si la constante d'alignement n'est pas valide.</p></dd>
<dt><a name="-getTextVerticalAlignment"><strong>getTextVerticalAlignment</strong></a>(...)</dt>
<dd><code><a href="#-getTextVerticalAlignment">getTextVerticalAlignment</a>(["nom"]) -> nombre entier</code>
Modified: trunk/Scribus/doc/it/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22785&path=/trunk/Scribus/doc/it/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/it/scripterapi-textframes.html Fri Dec 14 22:58:00 2018
@@ -3,6 +3,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Handling Text Frames</title>
</head>
+<style>
+ at import "manual.css";
+</style>
<body>
<h2>Handling Text Frames</h2>
@@ -46,8 +49,9 @@
<p>Returns the text of the text frame "name". If this text frame has some text selected, the selected text is returned. All text in the frame, not just currently visible text, is returned. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
-<dd><code>getLineColor(["name"]) -> string</code>
-<p>Returns the name of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
+<dd><code>getTextColor(["name"]) -> string</code>
+<p>Returns the name of the text color used for text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
<dt><a name="-getTextDistances"><strong>getTextDistances</strong></a>(...)</dt>
<dd><code>getTextDistances(["name"]) -> tuple</code>
@@ -64,12 +68,22 @@
<p>Returns the number of lines of the text in the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
-<dd><code>getLineShade(["name"]) -> integer</code>
-<p>Returns the shading value of the line color of the object "name". If "name" is not given the currently selected item is used.</p></dd>
+<dd><code>getTextShade(["name"]) -> integer</code>
+<p>Returns the shade of text color used for text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
+
+<dt><a name="-getTextVerticalAlignment"><strong>getTextVerticalAlignment</strong></a>(...)</dt>
+<dd><code>getTextVerticalAlignment(["name"]) -> integer</code>
+<p>Gets the vertical alignment of text inside text frame "name". If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-hyphenateText"><strong>hyphenateText</strong></a>(...)</dt>
<dd><code>hyphenateText(["name"]) -> bool</code>
<p>Does hyphenation on text frame "name". If "name" is not given the currently selected item is used.</p>
+<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
+
+<dt><a name="-insertHtmlText"><strong>insertHtmlText</strong></a>(...)</dt>
+<dd><code>insertHtmlText("text", ["name"])</code>
+<p>Inserts the text from "file" into the text frame "name". Text must be UTF encoded (see <a href="#-setText">setText</a>() as reference). If "name" is not given the currently selected Item is used.</p>
<p>May raise WrongFrameTypeError if the target frame is not a text frame</p></dd>
<dt><a name="-insertText"><strong>insertText</strong></a>(...)</dt>
@@ -85,7 +99,14 @@
<dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
<dd><code>selectText(start, count, ["name"])</code>
<p>Selects "count" characters of text in the text frame "name" starting from the character "start". Character counting starts at 0. If "count" is zero, any text selection will be cleared. If "name" is not given the currently selected item is used.</p>
-<p>May throw IndexError if the selection is outside the bounds of the text.</p></dd>
+<p>May throw IndexError if the selection is outside the bounds of the text.</p>
+<p>There is no specific command to select all of the text in a frame. To accomplish this, you might create a function in your script which you would call with the name of the frame as follows:</p>
+<p><b>def SelectAllText(textframe):</b></p>
+ <p><b> texlen = scribus.getTextLength(textframe)</b></p>
+ <p><b> scribus.selectText(0,texlen,textframe)</b></p>
+ <p><b> return</b></p></dd>
+<dd><p>One of the reasons this is important is that, should you want to select a frame and then apply a Paragraph Style to the frame, you will find that a frame with multiple paragraphs will not have the style set for all of the text, only the last paragraph. Therefore, the solution is to select all the text of the frame, and then apply the style.</p></dd>
+
<dt><a name="-setColumns"><strong>setColumns</strong></a>(...)</dt>
<dd><code>setColumns(nr, ["name"])</code>
@@ -111,6 +132,11 @@
<dd><code>setLineSpacing(size, ["name"])</code>
<p>Sets the line spacing ("leading") of the text frame "name" to "size". "size" is a value in points. If "name" is not given the currently selected item is used.</p>
<p>May throw ValueError if the line spacing is out of bounds.</p></dd>
+
+<dt><a name="-setLineSpacingMode"><strong>setLineSpacingMode</strong></a>(...)</dt>
+<dd><code>setLineSpacingMode(mode, ["name"])</code>
+<p>Sets the line spacing mode of the text frame "name" to "mode". If "name" is not given the currently selected item is used. Mode values are the same as in createParagraphStyle.</p>
+<p>May throw ValueError if the line spacing mode is out of bounds.</p></dd>
<dt><a name="-setPDFBookmark"><strong>setPDFBookmark</strong>(...)</a></dt>
<dd><code>setPDFBookmark("toggle", ["name"])</code>
@@ -153,6 +179,13 @@
<dd><code>setTextStroke("color", ["name"])</code>
<p>Set "color" of the text stroke. If "name" is not given the currently selected item is used.</p></dd>
+<dt><a name="-setTextVerticalAlignment"><strong>setTextVerticalAlignment</strong></a>(...)</dt>
+<dd>
+<code>setTextVerticalAlignment(align, ["name"])</code>
+<p>Sets the vertical alignment of text inside text frame "name" to the specified alignment. If "name" is not given the currently selected item is used. "align" should be one of the ALIGNV_ constants defined in this module - see dir(scribus).</p>
+<p>May throw ValueError for an invalid alignment constant.</p>
+</dd>
+
<dt><a name="-textOverflows"><strong>textOverflows</strong></a>(...)</dt>
<dd><code>textOverflows(["name", nolinks]) -> integer</code>
<p>Returns 1 if there are overflowing characters in text frame "name", 0 if not. If is nolinks set to non zero value it takes only one frame - it doesn't use text frame linking. Without this parameter it search all linking chain.</p>
More information about the scribus-commit
mailing list