View Issue Details

IDProjectCategoryView StatusLast Update
0010011ScribusScripterpublic2012-11-13 20:41
Reportercezaryece Assigned Tojainbasil  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.4.0svn 
Fixed in Version1.4.2.svn 
Summary0010011: Scripter - add function for change name of page item
DescriptionAs I cant find smart way for changing name of page item in python scripts I have add function setNewName(newName, Name) to scripter.
If is is not needed pleas tell me how to do it in python script...
TagsNo tags attached.
Patch

Activities

cezaryece

2011-05-29 14:03

updater  

scripter_rename.patch (3,378 bytes)   
Index: Version135/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp
===================================================================
--- Version135/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp	(wersja 16630)
+++ Version135/Scribus/scribus/plugins/scriptplugin/cmdsetprop.cpp	(kopia robocza)
@@ -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__;
 }
Index: Version135/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
===================================================================
--- Version135/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(wersja 16630)
+++ Version135/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(kopia robocza)
@@ -454,6 +454,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."},
Index: Version135/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h
===================================================================
--- Version135/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h	(wersja 16630)
+++ Version135/Scribus/scribus/plugins/scriptplugin/cmdsetprop.h	(kopia robocza)
@@ -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
 
 
scripter_rename.patch (3,378 bytes)   

cbradney

2012-06-24 14:17

administrator   ~0028288

Last edited: 2012-06-24 14:17

Jain, please add this functionality to scripter2. This patch has been applied to scripter1 in 1.4.2.svn and 1.5.0.svn

Issue History

Date Modified Username Field Change
2011-05-29 14:03 cezaryece New Issue
2011-05-29 14:03 cezaryece File Added: scripter_rename.patch
2012-06-24 14:13 cbradney Assigned To => jainbasil
2012-06-24 14:13 cbradney Status new => assigned
2012-06-24 14:17 cbradney Note Added: 0028288
2012-06-24 14:17 cbradney Note Edited: 0028288
2012-06-24 14:21 jghali Summary Sripter - add function for change name of page item => Scripter - add function for change name of page item
2012-10-09 12:55 ale Status assigned => resolved
2012-10-09 12:55 ale Resolution open => fixed
2012-11-13 20:41 cbradney Status resolved => closed
2012-11-13 20:41 cbradney Fixed in Version => 1.4.2.svn