r22293 by gpittman -

scribus-commit scribus-commit at lists.scribus.net
Fri Dec 29 16:34:17 UTC 2017


Author: gpittman
Date: Fri Dec 29 16:34:17 2017
New Revision: 22293

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22293
Log:
some enhancements and clarifications to documention on creating styles, special characters, and selecting text

Modified:
    trunk/Scribus/doc/en/scripterapi-object.html
    trunk/Scribus/doc/en/scripterapi-page.html
    trunk/Scribus/doc/en/scripterapi-textframes.html

Modified: trunk/Scribus/doc/en/scripterapi-object.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22293&path=/trunk/Scribus/doc/en/scripterapi-object.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-object.html	(original)
+++ trunk/Scribus/doc/en/scripterapi-object.html	Fri Dec 29 16:34:17 2017
@@ -46,6 +46,7 @@
 <li>"language" [optional] -> language code</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>
 </dd>
 
 <dt><a name="-createCustomLineStyle"><strong>createCustomLineStyle</strong></a>(...)</dt>

Modified: trunk/Scribus/doc/en/scripterapi-page.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22293&path=/trunk/Scribus/doc/en/scripterapi-page.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-page.html	(original)
+++ trunk/Scribus/doc/en/scripterapi-page.html	Fri Dec 29 16:34:17 2017
@@ -26,7 +26,11 @@
 
 <dt><a name="-currentPage"><strong>currentPage</strong></a>(...)</dt>
 <dd><code>currentPage() -> integer</code>
-<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></dd>
+<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>
+<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>
+<strong><p>scribus.setText('Page ' + chr(30), textframe)</p>
+<p>scribus.setText('Page \x1e', textframe)</p></strong>
+<p>See also <strong>pageCount()</strong></dd>
 
 <dt><a name="-deleteMasterPage"><strong>deleteMasterPage</strong>(...)</a></dt>
 <dd><code>deleteMasterPage(pageName)</code>
@@ -95,7 +99,10 @@
 	
 <dt><a name="-pageCount"><strong>pageCount</strong></a>(...)</dt>
 <dd><code>pageCount() -> integer</code>
-<p>Returns the number of pages in the document.</p></dd>
+<p>Returns the number of pages in the document.</p>
+<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>
+<strong><p>scribus.setText('Page ' + chr(30) + ' of ' + chr(23), textframe)</p>
+<p>scribus.setText('Page \x1e of \x17', textframe)</p></strong></dd>
 
 <dt><a name="-redrawAll"><strong>redrawAll</strong></a>(...)</dt>
 <dd><code>redrawAll()</code>

Modified: trunk/Scribus/doc/en/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22293&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 29 16:34:17 2017
@@ -93,7 +93,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><dd>def SelectAllText(textframe):<br/>
+        texlen = scribus.getTextLength(textframe)<br/>
+        scribus.selectText(0,texlen,textframe)<br/>
+        return</dd></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>




More information about the scribus-commit mailing list