r17621 by craig - #10011: Scripter - add function for change name of page item

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 24 14:15:54 UTC 2012


Author: craig
Date: Sun Jun 24 14:15:53 2012
New Revision: 17621

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17621
Log:
#10011: Scripter - add function for change name of page item

Modified:
    trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17621&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp Sun Jun 24 14:15:53 2012
@@ -382,6 +382,22 @@
 	Py_RETURN_NONE;
 }
 
+PyObject *scribus_setnewname(PyObject* /* self */, PyObject* args)
+{
+	char *Name = const_cast<char*>("");
+	char *newName = const_cast<char*>("");
+	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &newName, "utf-8", &Name))
+		return NULL;
+	if(!checkHaveDocument())
+		return NULL;
+	PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name));
+	if (currItem == NULL)
+		return NULL;
+	currItem->setItemName(newName);
+	Py_RETURN_NONE;
+}
+
+
 /*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
 with header files structure untouched (docstrings are kept near declarations)
 PV */
@@ -395,5 +411,6 @@
 	  << scribus_setlinewidth__doc__ << scribus_setlineshade__doc__ 
 	  << scribus_setlinejoin__doc__  << scribus_setlinecap__doc__   
 	  << scribus_setlinestyle__doc__ << scribus_setfillshade__doc__ 
-	  << scribus_setcornerrad__doc__ <<  scribus_setmultiline__doc__;
-}
+	  << scribus_setcornerrad__doc__ << scribus_setmultiline__doc__
+	  << scribus_setnewname__doc__;
+}

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17621&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h Sun Jun 24 14:15:53 2012
@@ -193,5 +193,16 @@
 /*! Set multiline */
 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\
+"));
+/*! Set newname */
+PyObject *scribus_setnewname(PyObject * /*self*/, PyObject* args);
 #endif
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17621&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sun Jun 24 14:15:53 2012
@@ -513,6 +513,7 @@
 	{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*>("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*>("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