r17622 by craig - #10011: Scripter - add function for change name of page item
scribus-commit
scribus-commit at lists.scribus.net
Sun Jun 24 14:16:04 UTC 2012
Author: craig
Date: Sun Jun 24 14:16:04 2012
New Revision: 17622
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17622
Log:
#10011: Scripter - add function for change name of page item
Modified:
branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
branches/Version14x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
Modified: branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17622&path=/branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp Sun Jun 24 14:16:04 2012
@@ -381,6 +381,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 */
@@ -394,5 +410,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: branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17622&path=/branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h (original)
+++ branches/Version14x/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h Sun Jun 24 14:16:04 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: branches/Version14x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17622&path=/branches/Version14x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sun Jun 24 14:16:04 2012
@@ -455,6 +455,7 @@
{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*>("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