r23622 by jghali - Fix some scripter function names in order to match user visible name and update getText() documentation

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 19 22:50:38 UTC 2020


Author: jghali
Date: Sun Apr 19 22:50:38 2020
New Revision: 23622

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23622
Log:
Fix some scripter function names in order to match user visible name and update getText() 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
    trunk/Scribus/doc/ru/scripterapi-textframes.html
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: trunk/Scribus/doc/de/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/doc/de/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-textframes.html	(original)
+++ trunk/Scribus/doc/de/scripterapi-textframes.html	Sun Apr 19 22:50:38 2020
@@ -46,7 +46,9 @@
 
 <dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
 <dd><code>getText(["name"]) -> string</code>
-<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>
+<p>Returns the text visible in text frame "name". If this text frame has some text selected, the selected text is returned. If "name" is not given the currently selected item is used.</p>
+<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
+<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
 
 <dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
 <dd><code>getTextColor(["name"]) -> string</code>

Modified: trunk/Scribus/doc/en/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/doc/en/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-textframes.html	(original)
+++ trunk/Scribus/doc/en/scripterapi-textframes.html	Sun Apr 19 22:50:38 2020
@@ -46,7 +46,9 @@
 
 <dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
 <dd><code>getText(["name"]) -> string</code>
-<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>
+<p>Returns the text visible in text frame "name". If this text frame has some text selected, the selected text is returned. If "name" is not given the currently selected item is used.</p>
+<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
+<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
 
 <dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
 <dd><code>getTextColor(["name"]) -> string</code>

Modified: trunk/Scribus/doc/fr/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/doc/fr/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-textframes.html	(original)
+++ trunk/Scribus/doc/fr/scripterapi-textframes.html	Sun Apr 19 22:50:38 2020
@@ -41,8 +41,9 @@
 
 <dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
 <dd><code>getText(["nom"]) -> chaîne</code>
-<p>Retourne le texte du cadre de texte "nom". Si ce cadre de texte contient du texte sélectionné, celui-ci est retourné. 
-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>
+<p>Retourne le texte visible dans le cadre de texte "nom". Si ce cadre de texte contient du texte sélectionné, celui-ci est retourné. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p>
+<p>Cette fonction retourne uniquement le texte visible dans le cadre spécifié. Si vous souhaitez obtenir le texte contenu dans une chaîne de texte, veuillez utiliser <a href="#-getAllText">getAllText()</a> en lieu et place.</p>
+<p>Comme cette fonction nécessite que la mise en page du texte soit à jour, il est possible que vous ayez besoin d'appeler <a href="#-layoutText">layoutText()</a> ou <a href="#-layoutTextChain">layoutTextChain()</a> au préalable afin d'obtenir le résultat attendu.</p></dd>
 
 <dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
 <dd><code>getTextColor(["nom"]) -> chaîne</code>

Modified: trunk/Scribus/doc/it/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/doc/it/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-textframes.html	(original)
+++ trunk/Scribus/doc/it/scripterapi-textframes.html	Sun Apr 19 22:50:38 2020
@@ -46,7 +46,9 @@
 
 <dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
 <dd><code>getText(["name"]) -> string</code>
-<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>
+<p>Returns the text visible in text frame "name". If this text frame has some text selected, the selected text is returned. If "name" is not given the currently selected item is used.</p>
+<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
+<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
 
 <dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
 <dd><code>getTextColor(["name"]) -> string</code>

Modified: trunk/Scribus/doc/ru/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/doc/ru/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-textframes.html	(original)
+++ trunk/Scribus/doc/ru/scripterapi-textframes.html	Sun Apr 19 22:50:38 2020
@@ -46,7 +46,9 @@
 
 <dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
 <dd><code>getText(["name"]) -> string</code>
-<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>
+<p>Returns the text visible in text frame "name". If this text frame has some text selected, the selected text is returned. If "name" is not given the currently selected item is used.</p>
+<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
+<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
 
 <dt><a name="-getTextColor"><strong>getTextColor</strong></a>(...)</dt>
 <dd><code>getTextColor(["name"]) -> string</code>

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	Sun Apr 19 22:50:38 2020
@@ -152,7 +152,7 @@
 	return PyLong_FromLong(item->currentCharStyle().fillShade());
 }
 
-PyObject *scribus_gettextsize(PyObject* /* self */, PyObject* args)
+PyObject *scribus_gettextlength(PyObject* /* self */, PyObject* args)
 {
 	char *Name = const_cast<char*>("");
 	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
@@ -307,7 +307,7 @@
 	        PointToValue(item->textToFrameDistBottom()));
 }
 
-PyObject *scribus_getframetext(PyObject* /* self */, PyObject* args)
+PyObject *scribus_gettext(PyObject* /* self */, PyObject* args)
 {
 	char *Name = const_cast<char*>("");
 	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
@@ -338,7 +338,7 @@
 	return PyUnicode_FromString(text.toUtf8());
 }
 
-PyObject *scribus_gettext(PyObject* /* self */, PyObject* args)
+PyObject *scribus_getalltext(PyObject* /* self */, PyObject* args)
 {
 	char *Name = const_cast<char*>("");
 	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
@@ -371,7 +371,7 @@
 	return PyUnicode_FromString(text.toUtf8());
 }
 
-PyObject *scribus_setboxtext(PyObject* /* self */, PyObject* args)
+PyObject *scribus_settext(PyObject* /* self */, PyObject* args)
 {
 	char *Name = const_cast<char*>("");
 	char *Text;
@@ -387,12 +387,12 @@
 		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set text of non-text frame.","python error").toLocal8Bit().constData());
 		return nullptr;
 	}
-	QString Daten = QString::fromUtf8(Text);
-	Daten.replace("\r\n", SpecialChars::PARSEP);
-	Daten.replace(QChar('\n') , SpecialChars::PARSEP);
+	QString userText = QString::fromUtf8(Text);
+	userText.replace("\r\n", SpecialChars::PARSEP);
+	userText.replace(QChar('\n') , SpecialChars::PARSEP);
 	PyMem_Free(Text);
 	currItem->itemText.clear();
-	currItem->itemText.insertChars(0, Daten);
+	currItem->itemText.insertChars(0, userText);
 	currItem->invalidateLayout();
 
 	Py_RETURN_NONE;
@@ -1362,19 +1362,19 @@
 	QStringList s;
 	s << scribus_dehyphenatetext__doc__
 	  << scribus_deletetext__doc__
+	  << scribus_getalltext__doc__
 	  << scribus_getcolumngap__doc__
 	  << scribus_getcolumns__doc__
 	  << scribus_getfont__doc__
 	  << scribus_getfontfeatures__doc__
 	  << scribus_getfontsize__doc__
-	  << scribus_getframetext__doc__
 	  << scribus_getlinespace__doc__
 	  << scribus_gettext__doc__
 	  << scribus_gettextcolor__doc__
-	  << scribus_gettextdistances__doc__  
+	  << scribus_gettextdistances__doc__
+	  << scribus_gettextlength__doc__
 	  << scribus_gettextlines__doc__
 	  << scribus_gettextshade__doc__
-	  << scribus_gettextsize__doc__
 	  << scribus_gettextverticalalignment__doc__
 	  << scribus_hyphenatetext__doc__
 	  << scribus_inserthtmltext__doc__
@@ -1387,7 +1387,6 @@
 	  << scribus_outlinetext__doc__
 	  << scribus_selecttext__doc__
 	  << scribus_setalign__doc__
-	  << scribus_setboxtext__doc__
 	  << scribus_setcolumngap__doc__
 	  << scribus_setcolumns__doc__
 	  << scribus_setdirection__doc__
@@ -1398,6 +1397,7 @@
 	  << scribus_setlinespacemode__doc__
 	  << scribus_setpdfbookmark__doc__
 	  << scribus_settextdistances__doc__
+	  << scribus_settext__doc__
 	  << scribus_settextfill__doc__
 	  << scribus_settextscalingh__doc__
 	  << scribus_settextscalingv__doc__

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h	Sun Apr 19 22:50:38 2020
@@ -73,14 +73,14 @@
 PyObject *scribus_gettextshade(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
-PyDoc_STRVAR(scribus_gettextsize__doc__,
+PyDoc_STRVAR(scribus_gettextlength__doc__,
 QT_TR_NOOP("getTextLength([\"name\"]) -> integer\n\
 \n\
 Returns the length of the text in the text frame \"name\".\n\
 If \"name\" is not given the currently selected item is used.\n\
 "));
 /*! Get text size */
-PyObject *scribus_gettextsize(PyObject * /*self*/, PyObject* args);
+PyObject *scribus_gettextlength(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_gettextlines__doc__,
@@ -93,19 +93,23 @@
 PyObject *scribus_gettextlines(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
-PyDoc_STRVAR(scribus_getframetext__doc__,
+PyDoc_STRVAR(scribus_gettext__doc__,
 QT_TR_NOOP("getText([\"name\"]) -> string\n\
 \n\
-Returns the text of the text frame \"name\". If this text frame has some text\n\
-selected, the selected text is returned. All text in the frame, not just\n\
-currently visible text, is returned. If \"name\" is not given the currently\n\
-selected item is used.\n\
+Returns the text visible in text frame \"name\". If this text frame has some text\n\
+selected, the selected text is returned. If \"name\" is not given the currently\n\
+selected item is used.\n\
+This function returns only the text visible in specified frame. If you need to \n\
+retrieve the text contained in a text chain, use getAllText() instead.\n\
+As this function depends on text layout being up-to-date, you may need to call \n\
+layoutText() or layoutTextChain() before calling this function in order to get \n\
+expected result.\n\
 "));
 /*! Get frame text */
-PyObject *scribus_getframetext(PyObject * /*self*/, PyObject* args);
-
-/*! docstring */
-PyDoc_STRVAR(scribus_gettext__doc__,
+PyObject *scribus_gettext(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getalltext__doc__,
 QT_TR_NOOP("getAllText([\"name\"]) -> string\n\
 \n\
 Returns the text of the text frame \"name\" and of all text frames which are\n\
@@ -114,7 +118,7 @@
 used.\n\
 "));
 /*! Get all text */
-PyObject *scribus_gettext(PyObject * /*self*/, PyObject* args);
+PyObject *scribus_getalltext(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_getlinespace__doc__,
@@ -168,7 +172,7 @@
 PyObject *scribus_getcolumns(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
-PyDoc_STRVAR(scribus_setboxtext__doc__,
+PyDoc_STRVAR(scribus_settext__doc__,
 QT_TR_NOOP("setText(\"text\", [\"name\"])\n\
 \n\
 Sets the text of the text frame \"name\" to the text of the string \"text\".\n\
@@ -177,7 +181,7 @@
 used.\n\
 "));
 /*! Set text */
-PyObject *scribus_setboxtext(PyObject * /*self*/, PyObject* args);
+PyObject *scribus_settext(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_inserttext__doc__,

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23622&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Sun Apr 19 22:50:38 2020
@@ -333,7 +333,7 @@
 	{const_cast<char*>("getActiveLayer"), (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
 	{const_cast<char*>("getAllObjects"), (PyCFunction)scribus_getallobj, METH_VARARGS|METH_KEYWORDS, tr(scribus_getallobj__doc__)},
 	{const_cast<char*>("getAllStyles"), (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)}, //Deprecated
-	{const_cast<char*>("getAllText"), scribus_gettext, METH_VARARGS, tr(scribus_gettext__doc__)},
+	{const_cast<char*>("getAllText"), scribus_getalltext, METH_VARARGS, tr(scribus_getalltext__doc__)},
 	{const_cast<char*>("getCharStyles"), (PyCFunction)scribus_getcharstylenames, METH_NOARGS, tr(scribus_getcharstylenames__doc__)},
 	{const_cast<char*>("getParagraphStyles"), (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},
 	{const_cast<char*>("getCellStyle"), scribus_getcellstyle, METH_VARARGS, tr(scribus_getcellstyle__doc__)},
@@ -398,9 +398,9 @@
 	{const_cast<char*>("getTableColumnWidth"), scribus_gettablecolumnwidth, METH_VARARGS, tr(scribus_gettablecolumnwidth__doc__)},
 	{const_cast<char*>("getTableStyle"), scribus_gettablestyle, METH_VARARGS, tr(scribus_gettablestyle__doc__)},
 	{const_cast<char*>("getTableFillColor"), scribus_gettablefillcolor, METH_VARARGS, tr(scribus_gettablefillcolor__doc__)},
-	{const_cast<char*>("getText"), scribus_getframetext, METH_VARARGS, tr(scribus_getframetext__doc__)},
+	{const_cast<char*>("getText"), scribus_gettext, METH_VARARGS, tr(scribus_gettext__doc__)},
 	{const_cast<char*>("getTextColor"), scribus_gettextcolor, METH_VARARGS, tr(scribus_gettextcolor__doc__)},
-	{const_cast<char*>("getTextLength"), scribus_gettextsize, METH_VARARGS, tr(scribus_gettextsize__doc__)},
+	{const_cast<char*>("getTextLength"), scribus_gettextlength, METH_VARARGS, tr(scribus_gettextlength__doc__)},
 	{const_cast<char*>("getTextLines"), scribus_gettextlines, METH_VARARGS, tr(scribus_gettextlines__doc__)},
 	{const_cast<char*>("getTextShade"), scribus_gettextshade, METH_VARARGS, tr(scribus_gettextshade__doc__)},
 	{const_cast<char*>("getTextVerticalAlignment"), scribus_gettextverticalalignment, METH_VARARGS, tr(scribus_gettextverticalalignment__doc__)},
@@ -548,7 +548,7 @@
 	{const_cast<char*>("setTableTopBorder"), scribus_settabletopborder, METH_VARARGS, tr(scribus_settabletopborder__doc__)},
 	{const_cast<char*>("setTableBottomBorder"), scribus_settablebottomborder, METH_VARARGS, tr(scribus_settablebottomborder__doc__)},
 	{const_cast<char*>("setTableFillColor"), scribus_settablefillcolor, METH_VARARGS, tr(scribus_settablefillcolor__doc__)},
-	{const_cast<char*>("setText"), scribus_setboxtext, METH_VARARGS, tr(scribus_setboxtext__doc__)},
+	{const_cast<char*>("setText"), scribus_settext, METH_VARARGS, tr(scribus_settext__doc__)},
 	{const_cast<char*>("setTextAlignment"), scribus_setalignment, METH_VARARGS, tr(scribus_setalign__doc__)},
 	{const_cast<char*>("setTextDirection"), scribus_setdirection, METH_VARARGS, tr(scribus_setdirection__doc__)},
 	{const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)},




More information about the scribus-commit mailing list