r24764 by craig - #9238: Add missing getLineSpacingMode() to Scripter

scribus-commit scribus-commit at lists.scribus.net
Fri Oct 29 22:50:56 UTC 2021


Author: craig
Date: Fri Oct 29 22:50:56 2021
New Revision: 24764

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24764
Log:
#9238: Add missing getLineSpacingMode() to Scripter

Modified:
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24764&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp	Fri Oct 29 22:50:56 2021
@@ -383,6 +383,24 @@
 		return nullptr;
 	}
 	return PyFloat_FromDouble(static_cast<double>(item->currentStyle().lineSpacing()));
+}
+
+PyObject *scribus_getlinespacingmode(PyObject* /* self */, PyObject* args)
+{
+	char *Name = const_cast<char*>("");
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
+	if (item == nullptr)
+		return nullptr;
+	if (!item->isTextFrame())
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get line spacing mode of non-text frame.","python error").toLocal8Bit().constData());
+		return nullptr;
+	}
+	return PyFloat_FromDouble(static_cast<double>(item->currentStyle().lineSpacingMode()));
 }
 
 PyObject *scribus_gettextdistances(PyObject* /* self */, PyObject* args)

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24764&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h	Fri Oct 29 22:50:56 2021
@@ -198,6 +198,15 @@
 PyObject *scribus_getlinespacing(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_getlinespacingmode__doc__,
+QT_TR_NOOP("getLineSpacingMode([\"name\"]) -> float\n\
+\n\
+Returns the line spacing mode of the text frame \"name\". If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get line spacing mode*/
+PyObject *scribus_getlinespacingmode(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_gettextdistances__doc__,
 QT_TR_NOOP("getTextDistances([\"name\"]) -> tuple\n\
 \n\

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24764&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Fri Oct 29 22:50:56 2021
@@ -379,6 +379,7 @@
 	{const_cast<char*>("getLineJoin"), scribus_getlinejoin, METH_VARARGS, tr(scribus_getlinejoin__doc__)},
 	{const_cast<char*>("getLineShade"), scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
 	{const_cast<char*>("getLineSpacing"), scribus_getlinespacing, METH_VARARGS, tr(scribus_getlinespacing__doc__)},
+	{const_cast<char*>("getLineSpacingMode"), scribus_getlinespacingmode, METH_VARARGS, tr(scribus_getlinespacingmode__doc__)},
 	{const_cast<char*>("getLineStyle"), scribus_getlinestyle, METH_VARARGS, tr(scribus_getlinestyle__doc__)},
 	{const_cast<char*>("getLineStyles"), (PyCFunction)scribus_getlinestyles, METH_VARARGS, tr(scribus_getlinestyles__doc__)},
 	{const_cast<char*>("getLineTransparency"), scribus_getlinetransparency, METH_VARARGS, tr(scribus_getlinetransparency__doc__)},

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24764&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.cpp	Fri Oct 29 22:50:56 2021
@@ -385,6 +385,25 @@
 	return PyFloat_FromDouble(static_cast<double>(item->currentStyle().lineSpacing()));
 }
 
+
+PyObject *scribus_getlinespacingmode(PyObject* /* self */, PyObject* args)
+{
+	char *Name = const_cast<char*>("");
+	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
+	if (item == nullptr)
+		return nullptr;
+	if (!item->isTextFrame())
+	{
+		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get line spacing mode of non-text frame.","python error").toLocal8Bit().constData());
+		return nullptr;
+	}
+	return PyFloat_FromDouble(static_cast<double>(item->currentStyle().lineSpacingMode()));
+}
+
 PyObject *scribus_gettextdistances(PyObject* /* self */, PyObject* args)
 {
 	char *Name = const_cast<char*>("");
@@ -1548,6 +1567,7 @@
 	  << scribus_getframetext__doc__
 	  << scribus_getlastlinkedframe__doc__
 	  << scribus_getlinespacing__doc__
+	  << scribus_getlinespacingmode__doc__
 	  << scribus_getnextlinkedframe__doc__
 	  << scribus_getprevlinkedframe__doc__
 	  << scribus_gettext__doc__ // Deprecated

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24764&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	Fri Oct 29 22:50:56 2021
@@ -379,6 +379,7 @@
 	{const_cast<char*>("getLineJoin"), scribus_getlinejoin, METH_VARARGS, tr(scribus_getlinejoin__doc__)},
 	{const_cast<char*>("getLineShade"), scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
 	{const_cast<char*>("getLineSpacing"), scribus_getlinespacing, METH_VARARGS, tr(scribus_getlinespacing__doc__)},
+	{const_cast<char*>("getLineSpacingMode"), scribus_getlinespacingmode, METH_VARARGS, tr(scribus_getlinespacingmode__doc__)},
 	{const_cast<char*>("getLineStyle"), scribus_getlinestyle, METH_VARARGS, tr(scribus_getlinestyle__doc__)},
 	{const_cast<char*>("getLineStyles"), (PyCFunction)scribus_getlinestyles, METH_VARARGS, tr(scribus_getlinestyles__doc__)},
 	{const_cast<char*>("getLineTransparency"), scribus_getlinetransparency, METH_VARARGS, tr(scribus_getlinetransparency__doc__)},




More information about the scribus-commit mailing list