r23369 by jghali - #15959: Scripter: add setItemName() (ale)
scribus-commit
scribus-commit at lists.scribus.net
Sat Nov 23 11:51:05 UTC 2019
Author: jghali
Date: Sat Nov 23 11:51:05 2019
New Revision: 23369
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23369
Log:
#15959: Scripter: add setItemName() (ale)
Modified:
trunk/Scribus/doc/de/scripterapi-setobjprop.html
trunk/Scribus/doc/en/scripterapi-setobjprop.html
trunk/Scribus/doc/fr/scripterapi-setobjprop.html
trunk/Scribus/doc/it/scripterapi-setobjprop.html
trunk/Scribus/doc/ru/scripterapi-setobjprop.html
trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
Modified: trunk/Scribus/doc/de/scripterapi-setobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/doc/de/scripterapi-setobjprop.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-setobjprop.html (original)
+++ trunk/Scribus/doc/de/scripterapi-setobjprop.html Sat Nov 23 11:51:05 2019
@@ -67,6 +67,11 @@
<p>Sets the position of the picture in the image frame "name". If "name" is not given the currently selected item is used. The specified offset values are equal to the values shown on properties palette when point unit is used.</p>
<p>May raise <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> if the target frame is not an image frame</p></dd>
+<dt><a name="-setItemName"><strong>setItemName</strong></a>(...)</dt>
+<dd><code>setItemName(newName, [, "name"])</code>
+<p>Sets the name of the object "name" to "newName" and returns the name applied. If "name" is not given the currently selected item is used.</p>
+<p>May raise <a href="scripterapi.html#NotFoundError">NotFoundError</a> if the object doesn't exist.</p></dd>
+
<dt><a name="-setLineBlendmode"><strong>setLineBlendmode</strong>(...)</a></dt>
<dd><code>setLineBlendmode(blendmode, ["name"])</code>
<p>Sets the line blendmode of the object "name" to blendmode is the name of one of the defined colors. If "name" is not given the currently selected item is used.</p></dd>
Modified: trunk/Scribus/doc/en/scripterapi-setobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/doc/en/scripterapi-setobjprop.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-setobjprop.html (original)
+++ trunk/Scribus/doc/en/scripterapi-setobjprop.html Sat Nov 23 11:51:05 2019
@@ -67,6 +67,11 @@
<p>Sets the position of the picture in the image frame "name". If "name" is not given the currently selected item is used. The specified offset values are equal to the values shown on properties palette when point unit is used.</p>
<p>May raise <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> if the target frame is not an image frame</p></dd>
+<dt><a name="-setItemName"><strong>setItemName</strong></a>(...)</dt>
+<dd><code>setItemName(newName, [, "name"])</code>
+<p>Sets the name of the object "name" to "newName" and returns the name applied. If "name" is not given the currently selected item is used.</p>
+<p>May raise <a href="scripterapi.html#NotFoundError">NotFoundError</a> if the object doesn't exist.</p></dd>
+
<dt><a name="-setLineBlendmode"><strong>setLineBlendmode</strong>(...)</a></dt>
<dd><code>setLineBlendmode(blendmode, ["name"])</code>
<p>Sets the line blendmode of the object "name" to blendmode is the name of one of the defined colors. If "name" is not given the currently selected item is used.</p></dd>
Modified: trunk/Scribus/doc/fr/scripterapi-setobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/doc/fr/scripterapi-setobjprop.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-setobjprop.html (original)
+++ trunk/Scribus/doc/fr/scripterapi-setobjprop.html Sat Nov 23 11:51:05 2019
@@ -66,6 +66,11 @@
<p>Définit la position de l'image dans le cadre d'image "nom". Si le "nom" n'est pas fourni, l'élément sélectionné est utilisé. Les coordonnées spécifiées sont égales aux valeurs indiquées dans la palette des propriétés lorsque l'unité utilisée est le point.</p>
<p>Peut générer <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> si le cadre cible n'est pas un cadre d'image</p></dd>
+<dt><a name="-setItemName"><strong>setItemName</strong></a>(...)</dt>
+<dd><code>setItemName(nouveauNom, [, "nom"])</code>
+<p>Définit le nom de l'objet "nom" à la valeur "nouveauNom" et retourne le nom effectivement appliqué. Si le "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p>
+<p>Peut générer <a href="scripterapi.html#NotFoundError">NotFoundError</a> si l'objet n'existe pas.</p></dd>
+
<dt><a name="-setLineBlendmode"><strong>setLineBlendmode</strong>(...)</a></dt>
<dd><code>setLineBlendmode(modeFusion, ["nom"])</code>
<p>Définit le mode de fusion appliqué à au filet de l'objet "nom". Si le "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
@@ -110,9 +115,7 @@
<dt><a name="-setMultiLine"><strong>setMultiLine</strong></a>(...)</dt>
<dd><code>setMultiLine("styleNomme", ["nom"])</code>
<p>Définit le style de filet de l'objet "nom" à la valeur "styleNomme". Si le "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p>
-<p>Peut générer
-<a href="scripterapi.html#NotFoundError">NotFoundError</a> si le
-style de filet n'existe pas.</p></dd>
+<p>Peut générer <a href="scripterapi.html#NotFoundError">NotFoundError</a> si le style de filet n'existe pas.</p></dd>
<dt><a name="-setObjectAttributes"><strong>setObjectAttributes</strong></a>(...)</dt>
<dd><code>setObjectAttributes(attributs, ["nom"])</code>
Modified: trunk/Scribus/doc/it/scripterapi-setobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/doc/it/scripterapi-setobjprop.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-setobjprop.html (original)
+++ trunk/Scribus/doc/it/scripterapi-setobjprop.html Sat Nov 23 11:51:05 2019
@@ -67,6 +67,11 @@
<p>Sets the position of the picture in the image frame "name". If "name" is not given the currently selected item is used. The specified offset values are equal to the values shown on properties palette when point unit is used.</p>
<p>May raise <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> if the target frame is not an image frame</p></dd>
+<dt><a name="-setItemName"><strong>setItemName</strong></a>(...)</dt>
+<dd><code>setItemName(newName, [, "name"])</code>
+<p>Sets the name of the object "name" to "newName" and returns the name applied. If "name" is not given the currently selected item is used.</p>
+<p>May raise <a href="scripterapi.html#NotFoundError">NotFoundError</a> if the object doesn't exist.</p></dd>
+
<dt><a name="-setLineBlendmode"><strong>setLineBlendmode</strong>(...)</a></dt>
<dd><code>setLineBlendmode(blendmode, ["name"])</code>
<p>Sets the line blendmode of the object "name" to blendmode is the name of one of the defined colors. If "name" is not given the currently selected item is used.</p></dd>
Modified: trunk/Scribus/doc/ru/scripterapi-setobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/doc/ru/scripterapi-setobjprop.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-setobjprop.html (original)
+++ trunk/Scribus/doc/ru/scripterapi-setobjprop.html Sat Nov 23 11:51:05 2019
@@ -67,6 +67,11 @@
<p>Sets the position of the picture in the image frame "name". If "name" is not given the currently selected item is used. The specified offset values are equal to the values shown on properties palette when point unit is used.</p>
<p>May raise <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> if the target frame is not an image frame</p></dd>
+<dt><a name="-setItemName"><strong>setItemName</strong></a>(...)</dt>
+<dd><code>setItemName(newName, [, "name"])</code>
+<p>Sets the name of the object "name" to "newName" and returns the name applied. If "name" is not given the currently selected item is used.</p>
+<p>May raise <a href="scripterapi.html#NotFoundError">NotFoundError</a> if the object doesn't exist.</p></dd>
+
<dt><a name="-setLineBlendmode"><strong>setLineBlendmode</strong>(...)</a></dt>
<dd><code>setLineBlendmode(blendmode, ["name"])</code>
<p>Sets the line blendmode of the object "name" to blendmode is the name of one of the defined colors. If "name" is not given the currently selected item is used.</p></dd>
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp Sat Nov 23 11:51:05 2019
@@ -405,7 +405,7 @@
Py_RETURN_NONE;
}
-PyObject *scribus_setnewname(PyObject* /* self */, PyObject* args)
+PyObject *scribus_setitemname(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
char *newName = const_cast<char*>("");
@@ -413,11 +413,13 @@
return nullptr;
if (!checkHaveDocument())
return nullptr;
+
PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
if (currItem == nullptr)
return nullptr;
currItem->setItemName(newName);
- Py_RETURN_NONE;
+
+ return PyUnicode_FromString(currItem->itemName().toUtf8());
}
PyObject *scribus_setobjectattributes(PyObject* /* self */, PyObject* args)
@@ -541,5 +543,5 @@
<< scribus_setlinejoin__doc__ << scribus_setlinecap__doc__
<< scribus_setlinestyle__doc__ << scribus_setfillshade__doc__
<< scribus_setcornerrad__doc__ << scribus_setmultiline__doc__
- << scribus_setnewname__doc__ << scribus_setobjectattributes__doc__;
-}
+ << scribus_setitemname__doc__ << scribus_setobjectattributes__doc__;
+}
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h Sat Nov 23 11:51:05 2019
@@ -207,16 +207,16 @@
PyObject *scribus_setmultiline(PyObject * /*self*/, PyObject* args);
/*! docstring */
-PyDoc_STRVAR(scribus_setnewname__doc__,
-QT_TR_NOOP("setNewName(newname, [\"name\"])\n\
-\n\
-Sets the new name of the object \"name\" to the newname.\n\
-If \"name\" is not given the currently selected item is used.\n\
-\n\
-May raise NotFoundError if the line style doesn't exist.\n\
+PyDoc_STRVAR(scribus_setitemname__doc__,
+QT_TR_NOOP("setitemname(newName, [\"name\"])\n\
+\n\
+Sets the name of object \"name\" to newName and returns the name applied.\n\
+If \"name\" is not given the currently selected item is used.\n\
+\n\
+May raise NotFoundError if the object doesn't exist.\n\
"));
/*! Set newname */
-PyObject *scribus_setnewname(PyObject * /*self*/, PyObject* args);
+PyObject *scribus_setitemname(PyObject * /*self*/, PyObject* args);
/*! docstring */
PyDoc_STRVAR(scribus_setobjectattributes__doc__,
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23369&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sat Nov 23 11:51:05 2019
@@ -527,9 +527,9 @@
{const_cast<char*>("setLineWidth"), scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
{const_cast<char*>("setMargins"), scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
{const_cast<char*>("setBaseLine"), scribus_setbaseline, METH_VARARGS, tr(scribus_setbaseline__doc__)},
+ {const_cast<char*>("setItemName"), scribus_setitemname, METH_VARARGS, tr(scribus_setitemname__doc__)},
{const_cast<char*>("setMultiLine"), scribus_setmultiline, METH_VARARGS, tr(scribus_setmultiline__doc__)},
- {const_cast<char*>("setNewName"), scribus_setnewname, METH_VARARGS, tr(scribus_setnewname__doc__)},
- // duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"},
+ {const_cast<char*>("setNewName"), scribus_setitemname, METH_VARARGS, tr(scribus_setitemname__doc__)}, // Deprecated, was in fact never documented
{const_cast<char*>("setObjectAttributes"), scribus_setobjectattributes, METH_VARARGS, tr(scribus_setobjectattributes__doc__)},
{const_cast<char*>("setRedraw"), scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)},
// missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."},
More information about the scribus-commit
mailing list