r25080 by craig - #16780: Add in getItemPageNumber scripter function

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 14 21:01:00 UTC 2022


Author: craig
Date: Thu Apr 14 21:01:00 2022
New Revision: 25080

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25080
Log:
#16780: Add in getItemPageNumber scripter function

Modified:
    branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
    branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.h
    branches/Version15x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25080&path=/branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp	(original)
+++ branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp	Thu Apr 14 21:01:00 2022
@@ -1069,6 +1069,25 @@
 	return pyList;
 }
 
+
+PyObject *scribus_getitempagenumber(PyObject *, 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;
+	return PyLong_FromLong(i->OwnPage);
+}
+
 /*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
 with header files structure untouched (docstrings are kept near declarations)
 PV */
@@ -1091,6 +1110,7 @@
 	  << scribus_duplicateobject__doc__
 	  << scribus_duplicateobjects__doc__
 	  << scribus_getcharacterstyle__doc__
+	  << scribus_getitempagenumber__doc__
 	  << scribus_getparagraphstyle__doc__
 	  << scribus_getstyle__doc__
 	  << scribus_gettextflowmode__doc__
@@ -1103,3 +1123,4 @@
 	  << scribus_settextflowmode__doc__
 	  << scribus_textflowmode__doc__;
 }
+

Modified: branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25080&path=/branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.h
==============================================================================
--- branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.h	(original)
+++ branches/Version15x/Scribus/scribus/plugins/scriptplugin/cmdobj.h	Thu Apr 14 21:01:00 2022
@@ -401,5 +401,13 @@
 "));
 PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject *args);
 
+/*! docstring */
+PyDoc_STRVAR(scribus_getitempagenumber__doc__,
+QT_TR_NOOP("getItemPageNumber([name])\n\
+\n\
+Returns the page number for the given page item.\n\
+"));
+PyObject *scribus_getitempagenumber(PyObject * /* self */, PyObject *args);
+
 #endif
 

Modified: branches/Version15x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25080&path=/branches/Version15x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ branches/Version15x/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Thu Apr 14 21:01:00 2022
@@ -370,6 +370,7 @@
 	{const_cast<char*>("getImageOffset"), scribus_getimageoffset, METH_VARARGS, tr(scribus_getimageoffset__doc__)},
 	{const_cast<char*>("getImageScale"), scribus_getimagescale, METH_VARARGS, tr(scribus_getimagescale__doc__)},
 	{const_cast<char*>("getInfo"), (PyCFunction)scribus_getinfo, METH_VARARGS, tr(scribus_getinfo__doc__)},
+	{const_cast<char*>("getItemPageNumber"), scribus_getitempagenumber, METH_VARARGS, tr(scribus_getitempagenumber__doc__)},
 	{const_cast<char*>("getLastLinkedFrame"), scribus_getlastlinkedframe, METH_VARARGS, tr(scribus_getlastlinkedframe__doc__)},
 	{const_cast<char*>("getLayerBlendmode"), scribus_getlayerblendmode, METH_VARARGS, tr(scribus_getlayerblendmode__doc__)},
 	{const_cast<char*>("getLayerTransparency"), scribus_getlayertransparency, METH_VARARGS, tr(scribus_getlayertransparency__doc__)},




More information about the scribus-commit mailing list