r24150 by jghali - #16245: in the scripter copyObject can copy one single item at a time

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 1 23:26:57 UTC 2020


Author: jghali
Date: Sun Nov  1 23:26:57 2020
New Revision: 24150

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24150
Log:
#16245: in the scripter copyObject can copy one single item at a time

Modified:
    trunk/Scribus/doc/de/scripterapi-manobj.html
    trunk/Scribus/doc/en/scripterapi-manobj.html
    trunk/Scribus/doc/fr/scripterapi-manobj.html
    trunk/Scribus/doc/it/scripterapi-manobj.html
    trunk/Scribus/doc/ru/scripterapi-manobj.html
    trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.h
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp

Modified: trunk/Scribus/doc/de/scripterapi-manobj.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/doc/de/scripterapi-manobj.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-manobj.html	(original)
+++ trunk/Scribus/doc/de/scripterapi-manobj.html	Sun Nov  1 23:26:57 2020
@@ -18,11 +18,25 @@
 
 <dt><a name="-copyObject"><strong>copyObject</strong>(...)</a></dt>
 <dd><code>copyObject(["name"]) -> string</code>
-<p>copies the selected Object to the clipboard.</p></dd>
+<p>Copies the specified object or first item of selection if "name" is not given.</p>
+<p>Deprecated. Use copyObjects() instead.</p></dd>
+
+<dt><a name="-copyObjects"><strong>copyObjects</strong>(...)</a></dt>
+<dd><code>copyObjects(names)</code>
+<p>Copies the specified objects or the current object selection if no item names are given.</p>
+<p>The names of objects to copy can be provided as a string to copy a single object or as a list of strings to copy several objects at once.</p></dd>
 
 <dt><a name="-duplicateObject"><strong>duplicateObject</strong>(...)</a></dt>
 <dd><code>duplicateObject(["name"]) -> string</code>
-<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
+<p>Creates a duplicate of the specified object or of first item of selection if "name" is not given.</p>
+<p>Returns name of new object.</p>
+<p>Deprecated. Use duplicateObjects() instead.</p></dd>
+
+<dt><a name="-duplicateObjects"><strong>duplicateObjects</strong>(...)</a></dt>
+<dd><code>duplicateObjects(names) -> list</code>
+<p>Creates a duplicate of the specified objects or of the current selection if no names are given.</p>
+<p>The names of objects to duplicate can be provided as a string to duplicate a single object or as a list of strings to duplicate several objects at once.</p>
+<p>Returns a list of the names of the newly created objects.</p></dd>
 
 <dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
 <dd><code>getCharacterStyle(["name"])</code>
@@ -72,11 +86,18 @@
 
 <dt><a name="-moveObjectAbs"><strong>moveObjectAbs</strong></a>(...)</dt>
 <dd><code>moveObjectAbs(x, y [, "name"])</code>
-<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used.  If the object "name" belongs to a group, the whole group is moved.</p></dd>
+<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used. If the object "name" belongs to a group, the whole group is moved.</p></dd>
 
 <dt><a name="-pasteObject"><strong>pasteObject</strong>(...)</a></dt>
-<dd><code>pasteObject(["name"]) -> string</code>
-<p>Pastes an Object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p></dd>
+<dd><code>pasteObject() -> string</code>
+<p>Pastes an object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a comma separated string.</p>
+<p>Deprecated. Use pasteObjects() instead.</p></dd>
+
+<dt><a name="-pasteObjects"><strong>pasteObjects</strong>(...)</a></dt>
+<dd><code>pasteObjects() -> list</code>
+<p>Pastes the content of clipboard to canvas. This will be used only or most sensibly following <em>copyObjects(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a list.</p></dd>
 
 <dt><a name="-rotateObject"><strong>rotateObject</strong></a>(...)</dt>
 <dd><code>rotateObject(rot [, "name"])</code>

Modified: trunk/Scribus/doc/en/scripterapi-manobj.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/doc/en/scripterapi-manobj.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-manobj.html	(original)
+++ trunk/Scribus/doc/en/scripterapi-manobj.html	Sun Nov  1 23:26:57 2020
@@ -18,11 +18,25 @@
 
 <dt><a name="-copyObject"><strong>copyObject</strong>(...)</a></dt>
 <dd><code>copyObject(["name"]) -> string</code>
-<p>copies the selected Object to the clipboard.</p></dd>
+<p>Copies the specified object or first item of selection if "name" is not given.</p>
+<p>Deprecated. Use copyObjects() instead.</p></dd>
+
+<dt><a name="-copyObjects"><strong>copyObjects</strong>(...)</a></dt>
+<dd><code>copyObjects(names)</code>
+<p>Copies the specified objects or the current object selection if no item names are given.</p>
+<p>The names of objects to copy can be provided as a string to copy a single object or as a list of strings to copy several objects at once.</p></dd>
 
 <dt><a name="-duplicateObject"><strong>duplicateObject</strong>(...)</a></dt>
 <dd><code>duplicateObject(["name"]) -> string</code>
-<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
+<p>Creates a duplicate of the specified object or of first item of selection if "name" is not given.</p>
+<p>Returns name of new object.</p>
+<p>Deprecated. Use duplicateObjects() instead.</p></dd>
+
+<dt><a name="-duplicateObjects"><strong>duplicateObjects</strong>(...)</a></dt>
+<dd><code>duplicateObjects(names) -> list</code>
+<p>Creates a duplicate of the specified objects or of the current selection if no names are given.</p>
+<p>The names of objects to duplicate can be provided as a string to duplicate a single object or as a list of strings to duplicate several objects at once.</p>
+<p>Returns a list of the names of the newly created objects.</p></dd>
 
 <dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
 <dd><code>getCharacterStyle(["name"])</code>
@@ -72,11 +86,18 @@
 
 <dt><a name="-moveObjectAbs"><strong>moveObjectAbs</strong></a>(...)</dt>
 <dd><code>moveObjectAbs(x, y [, "name"])</code>
-<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used.  If the object "name" belongs to a group, the whole group is moved.</p></dd>
+<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used. If the object "name" belongs to a group, the whole group is moved.</p></dd>
 
 <dt><a name="-pasteObject"><strong>pasteObject</strong>(...)</a></dt>
-<dd><code>pasteObject(["name"]) -> string</code>
-<p>Pastes an Object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p></dd>
+<dd><code>pasteObject() -> string</code>
+<p>Pastes an object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a comma separated string.</p>
+<p>Deprecated. Use pasteObjects() instead.</p></dd>
+
+<dt><a name="-pasteObjects"><strong>pasteObjects</strong>(...)</a></dt>
+<dd><code>pasteObjects() -> list</code>
+<p>Pastes the content of clipboard to canvas. This will be used only or most sensibly following <em>copyObjects(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a list.</p></dd>
 
 <dt><a name="-rotateObject"><strong>rotateObject</strong></a>(...)</dt>
 <dd><code>rotateObject(rot [, "name"])</code>

Modified: trunk/Scribus/doc/fr/scripterapi-manobj.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/doc/fr/scripterapi-manobj.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-manobj.html	(original)
+++ trunk/Scribus/doc/fr/scripterapi-manobj.html	Sun Nov  1 23:26:57 2020
@@ -15,11 +15,25 @@
 
 <dt><a name="-copyObject"><strong>copyObject</strong>(...)</a></dt>
 <dd><code>copyObject(["nom"]) -> chaîne</code>
-<p>Effectue une copie de l'objet sélectionné vers le presse-papiers.</p></dd>
+<p>Effectue une copie de l'objet sélectionné vers le presse-papiers ou du premier objet dans la sélection si "nom" n'est pas spécifié.</p>
+<p>Obsolète. Veuillez utiliser copyObjects() en lieu et place.</p></dd>
+
+<dt><a name="-copyObjects"><strong>copyObjects</strong>(...)</a></dt>
+<dd><code>copyObjects(noms)</code>
+<p>Effectue une copie des objets spécifiés vers le presse-papiers ou de la sélection courante si aucun nom d'objet n'est spécifié.</p>
+<p>Le nom des objets à copier peut être spécifié sous forme d'une chaîne de caractères afin de copier un seul objet ou d'une liste de chaînes afin de copier plusieurs objets à la fois.</p></dd>
 
 <dt><a name="-duplicateObject"><strong>duplicateObject</strong>(...)</a></dt>
 <dd><code>duplicateObject(["nom"]) -> chaîne</code>
-<p>Crée une copie du ou des objects sélectionnés dans le document courant.</p></dd>
+<p>Crée une copie de l'objet spécifié ou du premier objet dans la sélection si "nom" n'est pas spécifié.</p>
+<p>Retourne le nom de l'objet nouvellement créé.</p>
+<p>Obsolète. Veuillez utiliser duplicateObjects() en lieu et place.</p></dd>
+
+<dt><a name="-duplicateObjects"><strong>duplicateObjects</strong>(...)</a></dt>
+<dd><code>duplicateObjects(noms) -> list</code>
+<p>Crée une copie des objets spécifiés ou de la sélection courante si aucun nom d'objet n'est spécifié.</p>
+<p>Le nom des objets à dupliquer peut être spécifié sous forme d'une chaîne de caractères afin de dupliquer un seul objet ou d'une liste de chaînes afin de dupliquer plusieurs objets à la fois.</p>
+<p>Retourne une liste des noms des objets nouvellement créés.</p></dd>
 
 <dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
 <dd><code>getCharacterStyle(["nom"])  -> chaîne</code>
@@ -73,9 +87,18 @@
 
 <dt><a name="-moveObjectAbs"><strong>moveObjectAbs</strong></a>(...)</dt>
 <dd><code>moveObjectAbs(x, y [, "nom"])</code>
-<p>Déplace l'objet "nom" à une nouvelle position. Les coordonnées
-sont exprimées dans les unités de mesure du document (voir les
-constantes UNIT).  Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. Si l'objet "nom" appartient à un groupe, tout le groupe est déplacé.</p></dd>
+<p>Déplace l'objet "nom" à une nouvelle position. Les coordonnées sont exprimées dans les unités de mesure du document (voir les constantes UNIT).  Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. Si l'objet "nom" appartient à un groupe, tout le groupe est déplacé.</p></dd>
+
+<dt><a name="-pasteObject"><strong>pasteObject</strong>(...)</a></dt>
+<dd><code>pasteObject() -> chaîne</code>
+<p>Colle un objet depuis le presse-papier. Cette fonction doit être utilisée uniquement suivant un appel à la fonction <em>copyObject(...)</em>, sans quoi le presse-papier ne contiendra probablement aucune donnée susceptible d'être collée.</p>
+<p>Retourne les noms des objets nouvellement créés sous forme d'une chaîne séparés par des virgules.</p>
+<p>Obsolète. Veuillez utiliser pasteObjects() en lieu et place.</p></dd>
+
+<dt><a name="-pasteObjects"><strong>pasteObjects</strong>(...)</a></dt>
+<dd><code>pasteObjects() -> list</code>
+<p>Colle des objets depuis le presse-papier. Cette fonction doit être utilisée uniquement suivant un appel à la fonction <em>copyObjects(...)</em>, sans quoi le presse-papier ne contiendra probablement aucune donnée susceptible d'être collée.</p>
+<p>Retourne le nom des objets nouvellement créés sous forme d'une liste.</p></dd>
 
 <dt><a name="-rotateObject"><strong>rotateObject</strong></a>(...)</dt>
 <dd><code>rotateObject(rot [, "nom"])</code>

Modified: trunk/Scribus/doc/it/scripterapi-manobj.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/doc/it/scripterapi-manobj.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-manobj.html	(original)
+++ trunk/Scribus/doc/it/scripterapi-manobj.html	Sun Nov  1 23:26:57 2020
@@ -18,11 +18,25 @@
 
 <dt><a name="-copyObject"><strong>copyObject</strong>(...)</a></dt>
 <dd><code>copyObject(["name"]) -> string</code>
-<p>copies the selected Object to the clipboard.</p></dd>
+<p>Copies the specified object or first item of selection if "name" is not given.</p>
+<p>Deprecated. Use copyObjects() instead.</p></dd>
+
+<dt><a name="-copyObjects"><strong>copyObjects</strong>(...)</a></dt>
+<dd><code>copyObjects(names)</code>
+<p>Copies the specified objects or the current object selection if no item names are given.</p>
+<p>The names of objects to copy can be provided as a string to copy a single object or as a list of strings to copy several objects at once.</p></dd>
 
 <dt><a name="-duplicateObject"><strong>duplicateObject</strong>(...)</a></dt>
 <dd><code>duplicateObject(["name"]) -> string</code>
-<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
+<p>Creates a duplicate of the specified object or of first item of selection if "name" is not given.</p>
+<p>Returns name of new object.</p>
+<p>Deprecated. Use duplicateObjects() instead.</p></dd>
+
+<dt><a name="-duplicateObjects"><strong>duplicateObjects</strong>(...)</a></dt>
+<dd><code>duplicateObjects(names) -> list</code>
+<p>Creates a duplicate of the specified objects or of the current selection if no names are given.</p>
+<p>The names of objects to duplicate can be provided as a string to duplicate a single object or as a list of strings to duplicate several objects at once.</p>
+<p>Returns a list of the names of the newly created objects.</p></dd>
 
 <dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
 <dd><code>getCharacterStyle(["name"])</code>
@@ -72,11 +86,18 @@
 
 <dt><a name="-moveObjectAbs"><strong>moveObjectAbs</strong></a>(...)</dt>
 <dd><code>moveObjectAbs(x, y [, "name"])</code>
-<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used.  If the object "name" belongs to a group, the whole group is moved.</p></dd>
+<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used. If the object "name" belongs to a group, the whole group is moved.</p></dd>
 
 <dt><a name="-pasteObject"><strong>pasteObject</strong>(...)</a></dt>
-<dd><code>pasteObject(["name"]) -> string</code>
-<p>Pastes an Object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p></dd>
+<dd><code>pasteObject() -> string</code>
+<p>Pastes an object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a comma separated string.</p>
+<p>Deprecated. Use pasteObjects() instead.</p></dd>
+
+<dt><a name="-pasteObjects"><strong>pasteObjects</strong>(...)</a></dt>
+<dd><code>pasteObjects() -> list</code>
+<p>Pastes the content of clipboard to canvas. This will be used only or most sensibly following <em>copyObjects(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a list.</p></dd>
 
 <dt><a name="-rotateObject"><strong>rotateObject</strong></a>(...)</dt>
 <dd><code>rotateObject(rot [, "name"])</code>

Modified: trunk/Scribus/doc/ru/scripterapi-manobj.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/doc/ru/scripterapi-manobj.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-manobj.html	(original)
+++ trunk/Scribus/doc/ru/scripterapi-manobj.html	Sun Nov  1 23:26:57 2020
@@ -18,11 +18,25 @@
 
 <dt><a name="-copyObject"><strong>copyObject</strong>(...)</a></dt>
 <dd><code>copyObject(["name"]) -> string</code>
-<p>copies the selected Object to the clipboard.</p></dd>
+<p>Copies the specified object or first item of selection if "name" is not given.</p>
+<p>Deprecated. Use copyObjects() instead.</p></dd>
+
+<dt><a name="-copyObjects"><strong>copyObjects</strong>(...)</a></dt>
+<dd><code>copyObjects(names)</code>
+<p>Copies the specified objects or the current object selection if no item names are given.</p>
+<p>The names of objects to copy can be provided as a string to copy a single object or as a list of strings to copy several objects at once.</p></dd>
 
 <dt><a name="-duplicateObject"><strong>duplicateObject</strong>(...)</a></dt>
 <dd><code>duplicateObject(["name"]) -> string</code>
-<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
+<p>Creates a duplicate of the specified object or of first item of selection if "name" is not given.</p>
+<p>Returns name of new object.</p>
+<p>Deprecated. Use duplicateObjects() instead.</p></dd>
+
+<dt><a name="-duplicateObjects"><strong>duplicateObjects</strong>(...)</a></dt>
+<dd><code>duplicateObjects(names) -> list</code>
+<p>Creates a duplicate of the specified objects or of the current selection if no names are given.</p>
+<p>The names of objects to duplicate can be provided as a string to duplicate a single object or as a list of strings to duplicate several objects at once.</p>
+<p>Returns a list of the names of the newly created objects.</p></dd>
 
 <dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
 <dd><code>getCharacterStyle(["name"])</code>
@@ -72,11 +86,18 @@
 
 <dt><a name="-moveObjectAbs"><strong>moveObjectAbs</strong></a>(...)</dt>
 <dd><code>moveObjectAbs(x, y [, "name"])</code>
-<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used.  If the object "name" belongs to a group, the whole group is moved.</p></dd>
+<p>Moves the object "name" to a new location. The coordinates are expressed in the current measurement unit of the document (see UNIT constants).  If "name" is not given the currently selected item is used. If the object "name" belongs to a group, the whole group is moved.</p></dd>
 
 <dt><a name="-pasteObject"><strong>pasteObject</strong>(...)</a></dt>
-<dd><code>pasteObject(["name"]) -> string</code>
-<p>Pastes an Object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p></dd>
+<dd><code>pasteObject() -> string</code>
+<p>Pastes an object from the clipboard. This will be used only or most sensibly following <em>copyObject(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a comma separated string.</p>
+<p>Deprecated. Use pasteObjects() instead.</p></dd>
+
+<dt><a name="-pasteObjects"><strong>pasteObjects</strong>(...)</a></dt>
+<dd><code>pasteObjects() -> list</code>
+<p>Pastes the content of clipboard to canvas. This will be used only or most sensibly following <em>copyObjects(...)</em>, since otherwise there will likely be nothing in the clipboard to paste.</p>
+<p>Returns the names of the newly created object in a list.</p></dd>
 
 <dt><a name="-rotateObject"><strong>rotateObject</strong></a>(...)</dt>
 <dd><code>rotateObject(rot [, "name"])</code>

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp	Sun Nov  1 23:26:57 2020
@@ -848,10 +848,10 @@
 	return PyUnicode_FromString(currentDoc->m_Selection->itemAt(0)->itemName().toUtf8());
 }
 
-PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args)
-{
-	char* name = const_cast<char*>("");
-	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
+PyObject *scribus_duplicateobjects(PyObject * /* self */, PyObject *args)
+{
+	PyObject* pyObject = nullptr;
+	if (!PyArg_ParseTuple(args, "|O", &pyObject))
 		return nullptr;
 	if (!checkHaveDocument())
 		return nullptr;
@@ -860,6 +860,91 @@
 	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
 	ScribusDoc* currentDoc = currentWin->doc;
 
+	if ((pyObject != nullptr) && !PyUnicode_Check(pyObject) && !PyList_Check(pyObject))
+	{
+		PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a string or a list of strings", "python error").toLocal8Bit().constData());
+		return nullptr;
+	}
+
+	QStringList itemNames;
+	if ((pyObject != nullptr) && PyUnicode_Check(pyObject))
+	{
+		char* name = const_cast<char*>("");
+		if (!PyArg_Parse(pyObject, "es", "utf-8", &name))
+			return nullptr;
+		QString itemName = QString::fromUtf8(name);
+		if (!itemName.isEmpty())
+			itemNames.append(itemName);
+	}
+	else if ((pyObject != nullptr) && PyList_Check(pyObject))
+	{
+		int len = PyList_Size(pyObject);
+		for (int i = 0; i < len; ++i)
+		{
+			PyObject* pyItem = PyList_GetItem(pyObject, i);
+			if (!PyUnicode_Check(pyItem))
+			{
+				PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a list of strings", "python error").toLocal8Bit().constData());
+				return nullptr;
+			}
+			const char* name = PyUnicode_AsUTF8(pyItem);
+			QString itemName = QString::fromUtf8(name);
+			if (itemName.isEmpty())
+				continue;
+			itemNames.append(itemName);
+		}
+	}
+
+	if (!itemNames.isEmpty())
+	{
+		QList<PageItem*> pageItems;
+		pageItems.reserve(itemNames.count());
+
+		currentDoc->m_Selection->delaySignalsOn();
+		currentDoc->m_Selection->clear();
+		for (int i = 0; i < itemNames.count(); ++i)
+		{
+			QString itemName = itemNames.at(i);
+			PageItem *item = GetUniqueItem(itemName);
+			if (item == nullptr)
+				return nullptr;
+			pageItems.append(item);
+		}
+		currentDoc->m_Selection->addItems(pageItems);
+		currentDoc->m_Selection->delaySignalsOff();
+	}
+
+	if (currentDoc->m_Selection->isEmpty())
+	{
+		PyObject* pyList = PyList_New(0);
+		return pyList;
+	}
+
+	// do the duplicate
+	currentWin->slotEditCopy();
+	currentWin->slotEditPaste();
+
+	PyObject* pyList = PyList_New(currentDoc->m_Selection->count());
+	for (int i = 0; i < currentDoc->m_Selection->count(); ++i)
+	{
+		PageItem* item = currentDoc->m_Selection->itemAt(i);
+		PyList_SetItem(pyList, i, PyUnicode_FromString(item->itemName().toUtf8()));
+	}
+	return pyList;
+}
+
+PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args)
+{
+	char* name = const_cast<char*>("");
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+
+	// Is there a special name given? Yes -> add this to selection
+	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
+	ScribusDoc* currentDoc = currentWin->doc;
+
 	PageItem *i = GetUniqueItem(QString::fromUtf8(name));
 	if (i == nullptr)
 		return nullptr;
@@ -872,11 +957,81 @@
 	return PyUnicode_FromString(currentDoc->m_Selection->itemAt(0)->itemName().toUtf8());
 }
 
-PyObject *scribus_pasteobject(PyObject * /* self */, PyObject *args)
+PyObject *scribus_copyobjects(PyObject * /* self */, PyObject *args)
+{
+	PyObject* pyObject = nullptr;
+	if (!PyArg_ParseTuple(args, "|O", &pyObject))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+
+	// Is there a special name given? Yes -> add this to selection
+	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
+	ScribusDoc* currentDoc = currentWin->doc;
+
+	if ((pyObject != nullptr) && !PyUnicode_Check(pyObject) && !PyList_Check(pyObject))
+	{
+		PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a string or a list of strings", "python error").toLocal8Bit().constData());
+		return nullptr;
+	}
+
+	QStringList itemNames;
+	if ((pyObject != nullptr) && PyUnicode_Check(pyObject))
+	{
+		char* name = const_cast<char*>("");
+		if (!PyArg_Parse(pyObject, "es", "utf-8", &name))
+			return nullptr;
+		QString itemName = QString::fromUtf8(name);
+		if (!itemName.isEmpty())
+			itemNames.append(itemName);
+	}
+	else if ((pyObject != nullptr) && PyList_Check(pyObject))
+	{
+		int len = PyList_Size(pyObject);
+		for (int i = 0; i < len; i++)
+		{
+			PyObject* pyItem = PyList_GetItem(pyObject, i);
+			if (!PyUnicode_Check(pyItem))
+			{
+				PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a list of strings", "python error").toLocal8Bit().constData());
+				return nullptr;
+			}
+			const char* name = PyUnicode_AsUTF8(pyItem);
+			QString itemName = QString::fromUtf8(name);
+			if (itemName.isEmpty())
+				continue;
+			itemNames.append(itemName);
+		}
+	}
+
+	if (!itemNames.isEmpty())
+	{
+		QList<PageItem*> pageItems;
+		pageItems.reserve(itemNames.count());
+
+		currentDoc->m_Selection->delaySignalsOn();
+		currentDoc->m_Selection->clear();
+		for (int i = 0; i < itemNames.count(); ++i)
+		{
+			QString itemName = itemNames.at(i);
+			PageItem *item = GetUniqueItem(itemName);
+			if (item == nullptr)
+				return nullptr;
+			pageItems.append(item);
+		}
+		currentDoc->m_Selection->addItems(pageItems);
+		currentDoc->m_Selection->delaySignalsOff();
+	}
+
+	// do the copy
+	currentWin->slotEditCopy();
+
+	Py_RETURN_NONE;
+}
+
+PyObject *scribus_pasteobject(PyObject * /* self */, PyObject * /*args*/)
 {
 	char* name = const_cast<char*>("");
-	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
-		return nullptr;
 	if (!checkHaveDocument())
 		return nullptr;
 
@@ -898,6 +1053,26 @@
 	return PyUnicode_FromString(nameList.toUtf8());
 }
 
+PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject * /*args*/)
+{
+	char* name = const_cast<char*>("");
+	if (!checkHaveDocument())
+		return nullptr;
+
+	// do the paste
+	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
+	ScribusDoc* currentDoc = currentWin->doc;
+	currentWin->slotEditPaste();
+
+	PyObject* pyList = PyList_New(currentDoc->m_Selection->count());
+	for (int i = 0; i < currentDoc->m_Selection->count(); ++i)
+	{
+		PageItem* item = currentDoc->m_Selection->itemAt(i);
+		PyList_SetItem(pyList, i, PyUnicode_FromString(item->itemName().toUtf8()));
+	}
+	return pyList;
+}
+
 /*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
 with header files structure untouched (docstrings are kept near declarations)
 PV */
@@ -905,6 +1080,7 @@
 {
 	QStringList s;
 	s << scribus_copyobject__doc__
+	  << scribus_copyobjects__doc__
 	  << scribus_createbezierline__doc__
 	  << scribus_createellipse__doc__
 	  << scribus_createimage__doc__
@@ -917,12 +1093,14 @@
 	  << scribus_createtext__doc__
 	  << scribus_deleteobject__doc__
 	  << scribus_duplicateobject__doc__
+	  << scribus_duplicateobjects__doc__
 	  << scribus_getcharacterstyle__doc__
 	  << scribus_getparagraphstyle__doc__
 	  << scribus_getstyle__doc__
 	  << scribus_gettextflowmode__doc__
 	  << scribus_objectexists__doc__
 	  << scribus_pasteobject__doc__
+	  << scribus_pasteobjects__doc__
 	  << scribus_setcharstyle__doc__
 	  << scribus_setparagraphstyle__doc__
 	  << scribus_setstyle__doc__

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h	Sun Nov  1 23:26:57 2020
@@ -330,7 +330,9 @@
 PyDoc_STRVAR(scribus_duplicateobject__doc__,
 QT_TR_NOOP("duplicateObject([\"name\"]) -> string\n\
 \n\
-creates a duplicate of the selected object (or Selection Group). Returns name of new object.\n\
+Creates a duplicate of the specified object or of first item of selection if \"name\" is not given.\n\
+Returns name of new object.\n\
+Deprecated. Use duplicateObjects() instead.\n\
 "));
 /**
  Christian Hausknecht, 2006-07-12
@@ -339,10 +341,22 @@
 PyObject *scribus_duplicateobject(PyObject * /* self */, PyObject *args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_duplicateobjects__doc__,
+QT_TR_NOOP("duplicateObjects([names]) -> list\n\
+\n\
+Creates a duplicate of the specified objects or of the current selection if no names are given.\n\
+The names of objects to duplicate can be provided as a string to duplicate a single object\n\
+or as a list of strings to duplicate several objects at once.\n\
+Returns a list of the names of the newly created objects.\n\
+"));
+PyObject *scribus_duplicateobjects(PyObject * /* self */, PyObject *args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_copyobject__doc__,
 QT_TR_NOOP("copyObject([\"name\"]) -> string\n\
 \n\
-copies the selected Object (or Selection Group).\n\
+Copies the specified object or first item of selection if \"name\" is not given.\n\
+Deprecated. Use copyObjects instead.\n\
 "));
 /**
  Gregory Pittman, 2012-01-12
@@ -351,10 +365,24 @@
 PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_copyobjects__doc__,
+QT_TR_NOOP("copyObjects([names])\n\
+\n\
+Copies the specified objects or the current object selection if no item names are given.\n\
+The names of objects to copy can be provided as a string for copying a single object\n\
+or as a list of strings to copy several objects at once.\n\
+"));
+PyObject *scribus_copyobjects(PyObject * /* self */, PyObject *args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_pasteobject__doc__,
-QT_TR_NOOP("pasteObject([\"name\"]) -> string\n\
-\n\
-pastes a Duplicate of the selected Object (or Selection Group).\n\
+QT_TR_NOOP("pasteObject() -> string\n\
+\n\
+Pastes an object from the clipboard. This will be used only or most\n\
+sensibly following copyObject(...), since otherwise there will likely\n\
+be nothing in the clipboard to paste.\n\
+Returns the names of the newly created object in a comma separated string.\n\
+Deprecated. Use pasteObjects() instead.\n\
 "));
 /**
  Gregory Pittman, 2012-01-29
@@ -362,6 +390,17 @@
 */
 PyObject *scribus_pasteobject(PyObject * /* self */, PyObject *args);
 
+/*! docstring */
+PyDoc_STRVAR(scribus_pasteobjects__doc__,
+QT_TR_NOOP("pasteObjects() -> list\n\
+\n\
+Pastes the content of clipboard to canvas. This will be used only or most\n\
+sensibly following copyObjects(...), since otherwise there will likely\n\
+be nothing in the clipboard to paste.\n\
+Returns the names of the newly created object in a list.\n\
+"));
+PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject *args);
+
 /* Internal function not intended for general use; no docstring */
 PyObject* scribus_getframetype(PyObject* self, PyObject* args, PyObject* kw);
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Sun Nov  1 23:26:57 2020
@@ -597,9 +597,12 @@
 // 	{const_cast<char*>("getChildren"), (PyCFunction)scribus_getchildren, METH_VARARGS|METH_KEYWORDS, tr(scribus_getchildren__doc__)},
 // 	{const_cast<char*>("getChild"), (PyCFunction)scribus_getchild, METH_VARARGS|METH_KEYWORDS, tr(scribus_getchild__doc__)},
 	// by Christian Hausknecht
-	{const_cast<char*>("duplicateObject"), scribus_duplicateobject, METH_VARARGS, tr(scribus_duplicateobject__doc__)},
-	{const_cast<char*>("copyObject"), scribus_copyobject, METH_VARARGS, tr(scribus_copyobject__doc__)},
-	{const_cast<char*>("pasteObject"), scribus_pasteobject, METH_VARARGS, tr(scribus_pasteobject__doc__)},
+	{const_cast<char*>("copyObject"), scribus_copyobject, METH_VARARGS, tr(scribus_copyobject__doc__)}, // Deprecated
+	{const_cast<char*>("copyObjects"), scribus_copyobjects, METH_VARARGS, tr(scribus_copyobjects__doc__)},
+	{const_cast<char*>("duplicateObject"), scribus_duplicateobject, METH_VARARGS, tr(scribus_duplicateobject__doc__)}, // Deprecated
+	{const_cast<char*>("duplicateObjects"), scribus_duplicateobjects, METH_VARARGS, tr(scribus_duplicateobjects__doc__)},
+	{const_cast<char*>("pasteObject"), scribus_pasteobject, METH_NOARGS, tr(scribus_pasteobject__doc__)}, // Deprecated
+	{const_cast<char*>("pasteObjects"), scribus_pasteobjects, METH_NOARGS, tr(scribus_pasteobjects__doc__)},
 	// by Tj (hacker at iam.tj>
 	{const_cast<char*>("combinePolygons"), (PyCFunction)scribus_combinepolygons, METH_NOARGS, tr(scribus_combinepolygons__doc__)},
 	// Internal methods - Not for public use

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.cpp	Sun Nov  1 23:26:57 2020
@@ -848,10 +848,10 @@
 	return PyString_FromString(currentDoc->m_Selection->itemAt(0)->itemName().toUtf8());
 }
 
-PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args)
-{
-	char* name = const_cast<char*>("");
-	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
+PyObject *scribus_duplicateobjects(PyObject * /* self */, PyObject *args)
+{
+	PyObject* pyObject = nullptr;
+	if (!PyArg_ParseTuple(args, "|O", &pyObject))
 		return nullptr;
 	if (!checkHaveDocument())
 		return nullptr;
@@ -859,6 +859,91 @@
 	// Is there a special name given? Yes -> add this to selection
 	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
 	ScribusDoc* currentDoc = currentWin->doc;
+	
+	if ((pyObject != nullptr) && !PyString_Check(pyObject) && !PyList_Check(pyObject))
+	{
+		PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a string or a list of strings", "python error").toLocal8Bit().constData());
+		return nullptr;
+	}
+
+	QStringList itemNames;
+	if ((pyObject != nullptr) && PyString_Check(pyObject))
+	{
+		char* name = const_cast<char*>("");
+		if (!PyArg_Parse(pyObject, "es", "utf-8", &name))
+			return nullptr;
+		QString itemName = QString::fromUtf8(name);
+		if (!itemName.isEmpty())
+			itemNames.append(itemName);
+	}
+	else if ((pyObject != nullptr) && PyList_Check(pyObject))
+	{
+		int len = PyList_Size(pyObject);
+		for (int i = 0; i < len; ++i)
+		{
+			PyObject* pyItem = PyList_GetItem(pyObject, i);
+			if (!PyString_Check(pyItem))
+			{
+				PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a list of strings", "python error").toLocal8Bit().constData());
+				return nullptr;
+			}
+			char* name = PyString_AsString(pyItem);
+			QString itemName = QString::fromUtf8(name);
+			if (itemName.isEmpty())
+				continue;
+			itemNames.append(itemName);
+		}
+	}
+
+	if (!itemNames.isEmpty())
+	{
+		QList<PageItem*> pageItems;
+		pageItems.reserve(itemNames.count());
+
+		currentDoc->m_Selection->delaySignalsOn();
+		currentDoc->m_Selection->clear();
+		for (int i = 0; i < itemNames.count(); ++i)
+		{
+			QString itemName = itemNames.at(i);
+			PageItem *item = GetUniqueItem(itemName);
+			if (item == nullptr)
+				return nullptr;
+			pageItems.append(item);
+		}
+		currentDoc->m_Selection->addItems(pageItems);
+		currentDoc->m_Selection->delaySignalsOff();
+	}
+
+	if (currentDoc->m_Selection->isEmpty())
+	{
+		PyObject* pyList = PyList_New(0);
+		return pyList;
+	}
+
+	// do the duplicate
+	currentWin->slotEditCopy();
+	currentWin->slotEditPaste();
+
+	PyObject* pyList = PyList_New(currentDoc->m_Selection->count());
+	for (int i = 0; i < currentDoc->m_Selection->count(); ++i)
+	{
+		PageItem* item = currentDoc->m_Selection->itemAt(i);
+		PyList_SetItem(pyList, i, PyString_FromString(item->itemName().toUtf8()));
+	}
+	return pyList;
+}
+
+PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args)
+{
+	char* name = const_cast<char*>("");
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+
+	// Is there a special name given? Yes -> add this to selection
+	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
+	ScribusDoc* currentDoc = currentWin->doc;
 
 	PageItem *i = GetUniqueItem(QString::fromUtf8(name));
 	if (i == nullptr)
@@ -872,11 +957,81 @@
 	return PyString_FromString(currentDoc->m_Selection->itemAt(0)->itemName().toUtf8());
 }
 
-PyObject *scribus_pasteobject(PyObject * /* self */, PyObject *args)
+PyObject *scribus_copyobjects(PyObject * /* self */, PyObject *args)
+{
+	PyObject* pyObject = nullptr;
+	if (!PyArg_ParseTuple(args, "|O", &pyObject))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+
+	// Is there a special name given? Yes -> add this to selection
+	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
+	ScribusDoc* currentDoc = currentWin->doc;
+	
+	if ((pyObject != nullptr) && !PyString_Check(pyObject) && !PyList_Check(pyObject))
+	{
+		PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a string or a list of strings", "python error").toLocal8Bit().constData());
+		return nullptr;
+	}
+
+	QStringList itemNames;
+	if ((pyObject != nullptr) && PyString_Check(pyObject))
+	{
+		char* name = const_cast<char*>("");
+		if (!PyArg_Parse(pyObject, "es", "utf-8", &name))
+			return nullptr;
+		QString itemName = QString::fromUtf8(name);
+		if (!itemName.isEmpty())
+			itemNames.append(itemName);
+	}
+	else if ((pyObject != nullptr) && PyList_Check(pyObject))
+	{
+		int len = PyList_Size(pyObject);
+		for (int i = 0; i < len; i++)
+		{
+			PyObject* pyItem = PyList_GetItem(pyObject, i);
+			if (!PyString_Check(pyItem))
+			{
+				PyErr_SetString(PyExc_TypeError, QObject::tr("incorrect argument: must be a list of strings", "python error").toLocal8Bit().constData());
+				return nullptr;
+			}
+			char* name = PyString_AsString(pyItem);
+			QString itemName = QString::fromUtf8(name);
+			if (itemName.isEmpty())
+				continue;
+			itemNames.append(itemName);
+		}
+	}
+	
+	if (!itemNames.isEmpty())
+	{
+		QList<PageItem*> pageItems;
+		pageItems.reserve(itemNames.count());
+
+		currentDoc->m_Selection->delaySignalsOn();
+		currentDoc->m_Selection->clear();
+		for (int i = 0; i < itemNames.count(); ++i)
+		{
+			QString itemName = itemNames.at(i);
+			PageItem *item = GetUniqueItem(itemName);
+			if (item == nullptr)
+				return nullptr;
+			pageItems.append(item);
+		}
+		currentDoc->m_Selection->addItems(pageItems);
+		currentDoc->m_Selection->delaySignalsOff();
+	}
+
+	// do the copy
+	currentWin->slotEditCopy();
+
+	Py_RETURN_NONE;
+}
+
+PyObject *scribus_pasteobject(PyObject * /* self */, PyObject * /*args*/)
 {
 	char* name = const_cast<char*>("");
-	if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
-		return nullptr;
 	if (!checkHaveDocument())
 		return nullptr;
 
@@ -898,6 +1053,26 @@
 	return PyString_FromString(nameList.toUtf8());
 }
 
+PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject * /*args*/)
+{
+	char* name = const_cast<char*>("");
+	if (!checkHaveDocument())
+		return nullptr;
+
+	// do the paste
+	ScribusMainWindow* currentWin = ScCore->primaryMainWindow();
+	ScribusDoc* currentDoc = currentWin->doc;
+	currentWin->slotEditPaste();
+
+	PyObject* pyList = PyList_New(currentDoc->m_Selection->count());
+	for (int i = 0; i < currentDoc->m_Selection->count(); ++i)
+	{
+		PageItem* item = currentDoc->m_Selection->itemAt(i);
+		PyList_SetItem(pyList, i, PyString_FromString(item->itemName().toUtf8()));
+	}
+	return pyList;
+}
+
 /*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
 with header files structure untouched (docstrings are kept near declarations)
 PV */
@@ -905,6 +1080,7 @@
 {
 	QStringList s;
 	s << scribus_copyobject__doc__
+	  << scribus_copyobjects__doc__
 	  << scribus_createbezierline__doc__
 	  << scribus_createellipse__doc__
 	  << scribus_createimage__doc__
@@ -917,12 +1093,14 @@
 	  << scribus_createtext__doc__
 	  << scribus_deleteobject__doc__
 	  << scribus_duplicateobject__doc__
+	  << scribus_duplicateobjects__doc__
 	  << scribus_getcharacterstyle__doc__
 	  << scribus_getparagraphstyle__doc__
 	  << scribus_getstyle__doc__
 	  << scribus_gettextflowmode__doc__
 	  << scribus_objectexists__doc__
 	  << scribus_pasteobject__doc__
+	  << scribus_pasteobjects__doc__
 	  << scribus_setcharstyle__doc__
 	  << scribus_setparagraphstyle__doc__
 	  << scribus_setstyle__doc__

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.h	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdobj.h	Sun Nov  1 23:26:57 2020
@@ -330,7 +330,9 @@
 PyDoc_STRVAR(scribus_duplicateobject__doc__,
 QT_TR_NOOP("duplicateObject([\"name\"]) -> string\n\
 \n\
-creates a duplicate of the selected object (or Selection Group). Returns name of new object.\n\
+Creates a duplicate of the specified object or of first item of selection if \"name\" is not given.\n\
+Returns name of new object.\n\
+Deprecated. Use duplicateObjects() instead.\n\
 "));
 /**
  Christian Hausknecht, 2006-07-12
@@ -339,10 +341,22 @@
 PyObject *scribus_duplicateobject(PyObject * /* self */, PyObject *args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_duplicateobjects__doc__,
+QT_TR_NOOP("duplicateObjects([names]) -> list\n\
+\n\
+Creates a duplicate of the specified objects or of the current selection if no names are given.\n\
+The names of objects to duplicate can be provided as a string to duplicate a single object\n\
+or as a list of strings to duplicate several objects at once.\n\
+Returns a list of the names of the newly created objects.\n\
+"));
+PyObject *scribus_duplicateobjects(PyObject * /* self */, PyObject *args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_copyobject__doc__,
 QT_TR_NOOP("copyObject([\"name\"]) -> string\n\
 \n\
-copies the selected Object (or Selection Group).\n\
+Copies the specified object or first item of selection if \"name\" is not given.\n\
+Deprecated. Use copyObjects instead.\n\
 "));
 /**
  Gregory Pittman, 2012-01-12
@@ -351,10 +365,24 @@
 PyObject *scribus_copyobject(PyObject * /* self */, PyObject *args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_copyobjects__doc__,
+QT_TR_NOOP("copyObjects([names])\n\
+\n\
+Copies the specified objects or the current object selection if no item names are given.\n\
+The names of objects to copy can be provided as a string for copying a single object\n\
+or as a list of strings to copy several objects at once.\n\
+"));
+PyObject *scribus_copyobjects(PyObject * /* self */, PyObject *args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_pasteobject__doc__,
-QT_TR_NOOP("pasteObject([\"name\"]) -> string\n\
-\n\
-pastes a Duplicate of the selected Object (or Selection Group).\n\
+QT_TR_NOOP("pasteObject() -> string\n\
+\n\
+Pastes an object from the clipboard. This will be used only or most\n\
+sensibly following copyObject(...), since otherwise there will likely\n\
+be nothing in the clipboard to paste.\n\
+Returns the names of the newly created object in a comma separated string.\n\
+Deprecated. Use pasteObjects() instead.\n\
 "));
 /**
  Gregory Pittman, 2012-01-29
@@ -362,6 +390,17 @@
 */
 PyObject *scribus_pasteobject(PyObject * /* self */, PyObject *args);
 
+/*! docstring */
+PyDoc_STRVAR(scribus_pasteobjects__doc__,
+QT_TR_NOOP("pasteObjects() -> list\n\
+\n\
+Pastes the content of clipboard to canvas. This will be used only or most\n\
+sensibly following copyObjects(...), since otherwise there will likely\n\
+be nothing in the clipboard to paste.\n\
+Returns the names of the newly created object in a list.\n\
+"));
+PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject *args);
+
 /* Internal function not intended for general use; no docstring */
 PyObject* scribus_getframetype(PyObject* self, PyObject* args, PyObject* kw);
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24150&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp	Sun Nov  1 23:26:57 2020
@@ -597,9 +597,12 @@
 // 	{const_cast<char*>("getChildren"), (PyCFunction)scribus_getchildren, METH_VARARGS|METH_KEYWORDS, tr(scribus_getchildren__doc__)},
 // 	{const_cast<char*>("getChild"), (PyCFunction)scribus_getchild, METH_VARARGS|METH_KEYWORDS, tr(scribus_getchild__doc__)},
 	// by Christian Hausknecht
-	{const_cast<char*>("duplicateObject"), scribus_duplicateobject, METH_VARARGS, tr(scribus_duplicateobject__doc__)},
-	{const_cast<char*>("copyObject"), scribus_copyobject, METH_VARARGS, tr(scribus_copyobject__doc__)},
-	{const_cast<char*>("pasteObject"), scribus_pasteobject, METH_VARARGS, tr(scribus_pasteobject__doc__)},
+	{const_cast<char*>("copyObject"), scribus_copyobject, METH_VARARGS, tr(scribus_copyobject__doc__)}, // Deprecated
+	{const_cast<char*>("copyObjects"), scribus_copyobjects, METH_VARARGS, tr(scribus_copyobjects__doc__)},
+	{const_cast<char*>("duplicateObject"), scribus_duplicateobject, METH_VARARGS, tr(scribus_duplicateobject__doc__)}, // Deprecated
+	{const_cast<char*>("duplicateObjects"), scribus_duplicateobjects, METH_VARARGS, tr(scribus_duplicateobjects__doc__)},
+	{const_cast<char*>("pasteObject"), scribus_pasteobject, METH_NOARGS, tr(scribus_pasteobject__doc__)}, // Deprecated
+	{const_cast<char*>("pasteObjects"), scribus_pasteobjects, METH_NOARGS, tr(scribus_pasteobjects__doc__)},
 	// by Tj (hacker at iam.tj>
 	{const_cast<char*>("combinePolygons"), (PyCFunction)scribus_combinepolygons, METH_NOARGS, tr(scribus_combinepolygons__doc__)},
 	// Internal methods - Not for public use




More information about the scribus-commit mailing list