r24021 by jghali - #16224: scripter: add getNextLinkedFrame(), getPrevLinkedFrame(), getFirstLinkedFrame() and getLastLinkedFrame()
scribus-commit
scribus-commit at lists.scribus.net
Tue Sep 15 21:30:10 UTC 2020
Author: jghali
Date: Tue Sep 15 21:30:10 2020
New Revision: 24021
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24021
Log:
#16224: scripter: add getNextLinkedFrame(), getPrevLinkedFrame(), getFirstLinkedFrame() and getLastLinkedFrame()
Modified:
trunk/Scribus/doc/de/scripterapi-textframes.html
trunk/Scribus/doc/en/scripterapi-textframes.html
trunk/Scribus/doc/fr/scripterapi-textframes.html
trunk/Scribus/doc/it/scripterapi-textframes.html
trunk/Scribus/doc/ru/scripterapi-textframes.html
trunk/Scribus/scribus/pageitem_textframe.cpp
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/cmdtext.h
trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
Modified: trunk/Scribus/doc/de/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/doc/de/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/de/scripterapi-textframes.html Tue Sep 15 21:30:10 2020
@@ -32,6 +32,10 @@
<dd><code>getColumns(["name"]) -> integer</code>
<p>Gets the number of columns of the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
+<dt><a name="-getFirstLinkedFrame"><strong>getFirstLinkedFrame</strong></a>(...)</dt>
+<dd><code>getFirstLinkedFrame(["name"]) -> string</code>
+<p>Return the first text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getFont"><strong>getFont</strong></a>(...)</dt>
<dd><code>getFont(["name"]) -> string</code>
<p>Returns the font name for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p></dd>
@@ -46,9 +50,21 @@
<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
+<dt><a name="-getLastLinkedFrame"><strong>getLastLinkedFrame</strong></a>(...)</dt>
+<dd><code>getLastLinkedFrame(["name"]) -> string</code>
+<p>Return the last text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getLineSpacing"><strong>getLineSpacing</strong></a>(...)</dt>
<dd><code>getLineSpacing(["name"]) -> float</code>
<p>Returns the line spacing ("leading") of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getNextLinkedFrame"><strong>getNextLinkedFrame</strong></a>(...)</dt>
+<dd><code>getNextLinkedFrame(["name"]) -> string</code>
+<p>Return the next text frame in the chain or None if specified frame is the last frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getPrevLinkedFrame"><strong>getPrevLinkedFrame</strong></a>(...)</dt>
+<dd><code>getPrevLinkedFrame(["name"]) -> string</code>
+<p>Return the previous text frame in the chain or None if specified frame is the first frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
<dd><code>getText(["name"]) -> string</code>
Modified: trunk/Scribus/doc/en/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/doc/en/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/en/scripterapi-textframes.html Tue Sep 15 21:30:10 2020
@@ -32,6 +32,10 @@
<dd><code>getColumns(["name"]) -> integer</code>
<p>Gets the number of columns of the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
+<dt><a name="-getFirstLinkedFrame"><strong>getFirstLinkedFrame</strong></a>(...)</dt>
+<dd><code>getFirstLinkedFrame(["name"]) -> string</code>
+<p>Return the first text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getFont"><strong>getFont</strong></a>(...)</dt>
<dd><code>getFont(["name"]) -> string</code>
<p>Returns the font name for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p></dd>
@@ -46,9 +50,21 @@
<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
+<dt><a name="-getLastLinkedFrame"><strong>getLastLinkedFrame</strong></a>(...)</dt>
+<dd><code>getLastLinkedFrame(["name"]) -> string</code>
+<p>Return the last text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getLineSpacing"><strong>getLineSpacing</strong></a>(...)</dt>
<dd><code>getLineSpacing(["name"]) -> float</code>
<p>Returns the line spacing ("leading") of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getNextLinkedFrame"><strong>getNextLinkedFrame</strong></a>(...)</dt>
+<dd><code>getNextLinkedFrame(["name"]) -> string</code>
+<p>Return the next text frame in the chain or None if specified frame is the last frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getPrevLinkedFrame"><strong>getPrevLinkedFrame</strong></a>(...)</dt>
+<dd><code>getPrevLinkedFrame(["name"]) -> string</code>
+<p>Return the previous text frame in the chain or None if specified frame is the first frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
<dd><code>getText(["name"]) -> string</code>
Modified: trunk/Scribus/doc/fr/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/doc/fr/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/fr/scripterapi-textframes.html Tue Sep 15 21:30:10 2020
@@ -24,7 +24,11 @@
<dt><a name="-getColumns"><strong>getColumns</strong></a>(...)</dt>
<dd><code>getColumns(["nom"]) -> nombre entier</code>
-<p>Donne le nombre de colonnes du cadre de texte "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
+<p>Donne le nombre de colonnes du cadre de texte "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
+
+<dt><a name="-getFirstLinkedFrame"><strong>getFirstLinkedFrame</strong></a>(...)</dt>
+<dd><code>getFirstLinkedFrame(["name"]) -> chaîne</code>
+<p>Retourne le premier cadre dans la chaîne de texte. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
<dt><a name="-getFont"><strong>getFont</strong></a>(...)</dt>
<dd><code>getFont(["nom"]) -> chaîne</code>
@@ -41,9 +45,21 @@
<p>Cette fonction retourne uniquement le texte visible dans le cadre spécifié. Si vous souhaitez obtenir le texte contenu dans une chaîne de texte, veuillez utiliser <a href="#-getAllText">getAllText()</a> en lieu et place.</p>
<p>Comme cette fonction nécessite que la mise en page du texte soit à jour, il est possible que vous ayez besoin d'appeler <a href="#-layoutText">layoutText()</a> ou <a href="#-layoutTextChain">layoutTextChain()</a> au préalable afin d'obtenir le résultat attendu.</p></dd>
+<dt><a name="-getLastLinkedFrame"><strong>getLastLinkedFrame</strong></a>(...)</dt>
+<dd><code>getLastLinkedFrame(["name"]) -> chaîne</code>
+<p>Retourne le dernier cadre dans la chaîne de texte. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
+
<dt><a name="-getLineSpacing"><strong>getLineSpacing</strong></a>(...)</dt>
<dd><code>getLineSpacing(["nom"]) -> réel</code>
-<p>Retourne l'espacement de ligne ("leading") du cadre de texte "nom", exprimé en points. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
+<p>Retourne l'espacement de ligne ("leading") du cadre de texte "nom", exprimé en points. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
+
+<dt><a name="-getNextLinkedFrame"><strong>getNextLinkedFrame</strong></a>(...)</dt>
+<dd><code>getNextLinkedFrame(["nom"]) -> chaîne</code>
+<p>Retourne le cadre suivant dans la chaîne de texte ou None si le cadre spécifié est le dernier dans la chaîne. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
+
+<dt><a name="-getPrevLinkedFrame"><strong>getPrevLinkedFrame</strong></a>(...)</dt>
+<dd><code>getPrevLinkedFrame(["nom"]) -> chaîne</code>
+<p>Retourne le cadre précédent dans la chaîne de texte ou None si le cadre spécifié est le premier dans la chaîne. Si "nom" n'est pas fourni, l'élément sélectionné est utilisé.</p></dd>
<dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
<dd><code>getText(["nom"]) -> chaîne</code>
Modified: trunk/Scribus/doc/it/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/doc/it/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/it/scripterapi-textframes.html Tue Sep 15 21:30:10 2020
@@ -32,6 +32,10 @@
<dd><code>getColumns(["name"]) -> integer</code>
<p>Gets the number of columns of the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
+<dt><a name="-getFirstLinkedFrame"><strong>getFirstLinkedFrame</strong></a>(...)</dt>
+<dd><code>getFirstLinkedFrame(["name"]) -> string</code>
+<p>Return the first text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getFont"><strong>getFont</strong></a>(...)</dt>
<dd><code>getFont(["name"]) -> string</code>
<p>Returns the font name for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p></dd>
@@ -46,9 +50,21 @@
<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
+<dt><a name="-getLastLinkedFrame"><strong>getLastLinkedFrame</strong></a>(...)</dt>
+<dd><code>getLastLinkedFrame(["name"]) -> string</code>
+<p>Return the last text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getLineSpacing"><strong>getLineSpacing</strong></a>(...)</dt>
<dd><code>getLineSpacing(["name"]) -> float</code>
<p>Returns the line spacing ("leading") of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getNextLinkedFrame"><strong>getNextLinkedFrame</strong></a>(...)</dt>
+<dd><code>getNextLinkedFrame(["name"]) -> string</code>
+<p>Return the next text frame in the chain or None if specified frame is the last frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getPrevLinkedFrame"><strong>getPrevLinkedFrame</strong></a>(...)</dt>
+<dd><code>getPrevLinkedFrame(["name"]) -> string</code>
+<p>Return the previous text frame in the chain or None if specified frame is the first frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
<dd><code>getText(["name"]) -> string</code>
Modified: trunk/Scribus/doc/ru/scripterapi-textframes.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/doc/ru/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-textframes.html (original)
+++ trunk/Scribus/doc/ru/scripterapi-textframes.html Tue Sep 15 21:30:10 2020
@@ -32,6 +32,10 @@
<dd><code>getColumns(["name"]) -> integer</code>
<p>Gets the number of columns of the text frame "name". If "name" is not given the currently selected item is used.</p></dd>
+<dt><a name="-getFirstLinkedFrame"><strong>getFirstLinkedFrame</strong></a>(...)</dt>
+<dd><code>getFirstLinkedFrame(["name"]) -> string</code>
+<p>Return the first text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getFont"><strong>getFont</strong></a>(...)</dt>
<dd><code>getFont(["name"]) -> string</code>
<p>Returns the font name for the text frame "name". If this text frame has some text selected the value assigned to the first character of the selection is returned. If "name" is not given the currently selected item is used.</p></dd>
@@ -46,9 +50,21 @@
<p>This function returns only the text visible in specified frame. If you need to retrieve the text contained in a text chain, use <a href="#-getAllText">getAllText()</a> instead.</p>
<p>As this function depends on text layout being up-to-date, you may need to call <a href="#-layoutText">layoutText()</a> or <a href="#-layoutTextChain">layoutTextChain()</a> before calling this function in order to get expected result.</p></dd>
+<dt><a name="-getLastLinkedFrame"><strong>getLastLinkedFrame</strong></a>(...)</dt>
+<dd><code>getLastLinkedFrame(["name"]) -> string</code>
+<p>Return the last text frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getLineSpacing"><strong>getLineSpacing</strong></a>(...)</dt>
<dd><code>getLineSpacing(["name"]) -> float</code>
<p>Returns the line spacing ("leading") of the text frame "name" expressed in points. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getNextLinkedFrame"><strong>getNextLinkedFrame</strong></a>(...)</dt>
+<dd><code>getNextLinkedFrame(["name"]) -> string</code>
+<p>Return the next text frame in the chain or None if specified frame is the last frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getPrevLinkedFrame"><strong>getPrevLinkedFrame</strong></a>(...)</dt>
+<dd><code>getPrevLinkedFrame(["name"]) -> string</code>
+<p>Return the previous text frame in the chain or None if specified frame is the first frame in the chain. If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getText"><strong>getText</strong></a>(...)</dt>
<dd><code>getText(["name"]) -> string</code>
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Tue Sep 15 21:30:10 2020
@@ -1923,24 +1923,24 @@
else
current.yPos += (current.startOfCol ? 1 : style.lineSpacing());
lastLineY = maxYAsc;
- if (current.startOfCol)
+ /*if (current.startOfCol)
{
-// double addAsce;
-// if (DropCmode)
-// addAsce = qMax(realAsce, asce + offset);
-// else
-// addAsce = asce + offset;
-// if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing)
-// {
-// if (firstLineOffset() == FLOPRealGlyphHeight)
-// addAsce = realAsce;
-// else if (firstLineOffset() == FLOPLineSpacing)
-// addAsce = style.lineSpacing() + offset;
-// }
+ double addAsce;
+ if (DropCmode)
+ addAsce = qMax(realAsce, asce + offset);
+ else
+ addAsce = asce + offset;
+ if (style.lineSpacingMode() != ParagraphStyle::BaselineGridLineSpacing)
+ {
+ if (firstLineOffset() == FLOPRealGlyphHeight)
+ addAsce = realAsce;
+ else if (firstLineOffset() == FLOPLineSpacing)
+ addAsce = style.lineSpacing();
+ }
maxYAsc = current.yPos - addAsce;
}
else
- maxYAsc = current.yPos - realAsce;
+ maxYAsc = current.yPos - realAsce;*/
maxYDesc = current.yPos + realDesc;
if (style.lineSpacingMode() == ParagraphStyle::AutomaticLineSpacing)
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp Tue Sep 15 21:30:10 2020
@@ -267,6 +267,88 @@
return PyUnicode_FromString(item->currentCharStyle().fontFeatures().toUtf8());
}
+PyObject *scribus_getfirstlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ return PyUnicode_FromString(item->firstInChain()->itemName().toUtf8());
+}
+
+PyObject *scribus_getlastlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ return PyUnicode_FromString(item->lastInChain()->itemName().toUtf8());
+}
+
+PyObject *scribus_getnextlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ if (item->nextInChain() != nullptr)
+ return PyUnicode_FromString(item->nextInChain()->itemName().toUtf8());
+
+ Py_RETURN_NONE;
+}
+
+PyObject *scribus_getprevlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ if (item->prevInChain() != nullptr)
+ return PyUnicode_FromString(item->prevInChain()->itemName().toUtf8());
+
+ Py_RETURN_NONE;
+}
+
PyObject *scribus_getlinespace(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
@@ -1413,11 +1495,15 @@
<< scribus_getalltext__doc__
<< scribus_getcolumngap__doc__
<< scribus_getcolumns__doc__
+ << scribus_getfirstlinkedframe__doc__
<< scribus_getfont__doc__
<< scribus_getfontfeatures__doc__
<< scribus_getfontsize__doc__
<< scribus_getframetext__doc__
+ << scribus_getlastlinkedframe__doc__
<< scribus_getlinespace__doc__
+ << scribus_getnextlinkedframe__doc__
+ << scribus_getprevlinkedframe__doc__
<< scribus_gettext__doc__ // Deprecated
<< scribus_gettextcolor__doc__
<< scribus_gettextdistances__doc__
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h Tue Sep 15 21:30:10 2020
@@ -49,6 +49,52 @@
PyObject *scribus_getfontfeatures(PyObject * /*self*/, PyObject* args);
/*! docstring */
+PyDoc_STRVAR(scribus_getfirstlinkedframe__doc__,
+QT_TR_NOOP("getFirstLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the first text frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the first text frame in the chain */
+PyObject *scribus_getfirstlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getlastlinkedframe__doc__,
+QT_TR_NOOP("getLastLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the last text frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the last text frame in the chain */
+PyObject *scribus_getlastlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getnextlinkedframe__doc__,
+QT_TR_NOOP("getNextLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the next text frame in the chain or None\n\
+if specified frame is the last frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the next frame in the chain */
+PyObject *scribus_getnextlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getprevlinkedframe__doc__,
+QT_TR_NOOP("getPrevLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the previous text frame in the chain or None\n\
+if specified frame is the first frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the previous frame in the chain */
+PyObject *scribus_getprevlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
PyDoc_STRVAR(scribus_gettextcolor__doc__,
QT_TR_NOOP("getTextColor([\"name\"]) -> string\n\
\n\
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Tue Sep 15 21:30:10 2020
@@ -356,6 +356,7 @@
{const_cast<char*>("getFillBlendmode"), scribus_getfillblend, METH_VARARGS, tr(scribus_getfillblend__doc__)},
{const_cast<char*>("getFillShade"), scribus_getfillshade, METH_VARARGS, tr(scribus_getfillshade__doc__)},
{const_cast<char*>("getFillTransparency"), scribus_getfilltrans, METH_VARARGS, tr(scribus_getfilltrans__doc__)},
+ {const_cast<char*>("getFirstLinkedFrame"), scribus_getfirstlinkedframe, METH_VARARGS, tr(scribus_getfirstlinkedframe__doc__)},
{const_cast<char*>("getFont"), scribus_getfont, METH_VARARGS, tr(scribus_getfont__doc__)},
{const_cast<char*>("getFontFeatures"), scribus_getfontfeatures, METH_VARARGS, tr(scribus_getfontfeatures__doc__)},
{const_cast<char*>("getFontNames"), (PyCFunction)scribus_fontnames, METH_NOARGS, tr(scribus_fontnames__doc__)},
@@ -367,6 +368,7 @@
{const_cast<char*>("getImageFile"), scribus_getimagefile, METH_VARARGS, tr(scribus_getimagefile__doc__)},
{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*>("getLastLinkedFrame"), scribus_getlastlinkedframe, METH_VARARGS, tr(scribus_getlastlinkedframe__doc__)},
{const_cast<char*>("getLayers"), (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__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__)},
@@ -381,6 +383,7 @@
{const_cast<char*>("getLineStyles"), (PyCFunction)scribus_getlinestyles, METH_VARARGS, tr(scribus_getlinestyles__doc__)},
{const_cast<char*>("getLineWidth"), scribus_getlinewidth, METH_VARARGS, tr(scribus_getlinewidth__doc__)},
{const_cast<char*>("getMasterPage"), scribus_getmasterpage, METH_VARARGS, tr(scribus_getmasterpage__doc__)},
+ {const_cast<char*>("getNextLinkedFrame"), scribus_getnextlinkedframe, METH_VARARGS, tr(scribus_getnextlinkedframe__doc__)},
{const_cast<char*>("getPageItems"), (PyCFunction)scribus_getpageitems, METH_NOARGS, tr(scribus_getpageitems__doc__)},
{const_cast<char*>("getPageMargins"), (PyCFunction)scribus_getpagemargins, METH_NOARGS, tr(scribus_getpagemargins__doc__)},
{const_cast<char*>("getPageType"), (PyCFunction)scribus_getpagetype, METH_VARARGS, tr(scribus_getpagetype__doc__)},
@@ -390,6 +393,7 @@
{const_cast<char*>("getParagraphStyle"), scribus_getparagraphstyle, METH_VARARGS, tr(scribus_getparagraphstyle__doc__) },
{const_cast<char*>("getParagraphStyles"), (PyCFunction)scribus_getparagraphstyles, METH_NOARGS, tr(scribus_getparagraphstyles__doc__)},
{const_cast<char*>("getPosition"), scribus_getposition, METH_VARARGS, tr(scribus_getposition__doc__)},
+ {const_cast<char*>("getPrevLinkedFrame"), scribus_getprevlinkedframe, METH_VARARGS, tr(scribus_getprevlinkedframe__doc__)},
{const_cast<char*>("getRotation"), scribus_getrotation, METH_VARARGS, tr(scribus_getrotation__doc__)},
{const_cast<char*>("getObjectType"), scribus_getobjecttype, METH_VARARGS, tr(scribus_getobjecttype__doc__)},
{const_cast<char*>("getObjectAttributes"), scribus_getobjectattributes, METH_VARARGS, tr(scribus_getobjectattributes__doc__)},
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&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 Tue Sep 15 21:30:10 2020
@@ -267,6 +267,88 @@
return PyString_FromString(item->currentCharStyle().fontFeatures().toUtf8());
}
+PyObject *scribus_getfirstlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ return PyString_FromString(item->firstInChain()->itemName().toUtf8());
+}
+
+PyObject *scribus_getlastlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ return PyString_FromString(item->lastInChain()->itemName().toUtf8());
+}
+
+PyObject *scribus_getnextlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ if (item->nextInChain() != nullptr)
+ return PyString_FromString(item->nextInChain()->itemName().toUtf8());
+
+ Py_RETURN_NONE;
+}
+
+PyObject *scribus_getprevlinkedframe(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 linked frames of non-text frame.","python error").toLocal8Bit().constData());
+ return nullptr;
+ }
+
+ if (item->prevInChain() != nullptr)
+ return PyString_FromString(item->prevInChain()->itemName().toUtf8());
+
+ Py_RETURN_NONE;
+}
+
PyObject *scribus_getlinespace(PyObject* /* self */, PyObject* args)
{
char *Name = const_cast<char*>("");
@@ -1413,11 +1495,15 @@
<< scribus_getalltext__doc__
<< scribus_getcolumngap__doc__
<< scribus_getcolumns__doc__
+ << scribus_getfirstlinkedframe__doc__
<< scribus_getfont__doc__
<< scribus_getfontfeatures__doc__
<< scribus_getfontsize__doc__
<< scribus_getframetext__doc__
+ << scribus_getlastlinkedframe__doc__
<< scribus_getlinespace__doc__
+ << scribus_getnextlinkedframe__doc__
+ << scribus_getprevlinkedframe__doc__
<< scribus_gettext__doc__ // Deprecated
<< scribus_gettextcolor__doc__
<< scribus_gettextdistances__doc__
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdtext.h Tue Sep 15 21:30:10 2020
@@ -49,6 +49,52 @@
PyObject *scribus_getfontfeatures(PyObject * /*self*/, PyObject* args);
/*! docstring */
+PyDoc_STRVAR(scribus_getfirstlinkedframe__doc__,
+QT_TR_NOOP("getFirstLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the first text frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the first text frame in the chain */
+PyObject *scribus_getfirstlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getlastlinkedframe__doc__,
+QT_TR_NOOP("getLastLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the last text frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the last text frame in the chain */
+PyObject *scribus_getlastlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getnextlinkedframe__doc__,
+QT_TR_NOOP("getNextLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the next text frame in the chain or None\n\
+if specified frame is the last frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the next frame in the chain */
+PyObject *scribus_getnextlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_getprevlinkedframe__doc__,
+QT_TR_NOOP("getPrevLinkedFrame(item: str = None) -> str\n\
+\n\
+Return the previous text frame in the chain or None\n\
+if specified frame is the first frame in the chain.\n\
+\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Get the name of the previous frame in the chain */
+PyObject *scribus_getprevlinkedframe(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
PyDoc_STRVAR(scribus_gettextcolor__doc__,
QT_TR_NOOP("getTextColor([\"name\"]) -> string\n\
\n\
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24021&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 Tue Sep 15 21:30:10 2020
@@ -356,6 +356,7 @@
{const_cast<char*>("getFillBlendmode"), scribus_getfillblend, METH_VARARGS, tr(scribus_getfillblend__doc__)},
{const_cast<char*>("getFillShade"), scribus_getfillshade, METH_VARARGS, tr(scribus_getfillshade__doc__)},
{const_cast<char*>("getFillTransparency"), scribus_getfilltrans, METH_VARARGS, tr(scribus_getfilltrans__doc__)},
+ {const_cast<char*>("getFirstLinkedFrame"), scribus_getfirstlinkedframe, METH_VARARGS, tr(scribus_getfirstlinkedframe__doc__)},
{const_cast<char*>("getFont"), scribus_getfont, METH_VARARGS, tr(scribus_getfont__doc__)},
{const_cast<char*>("getFontFeatures"), scribus_getfontfeatures, METH_VARARGS, tr(scribus_getfontfeatures__doc__)},
{const_cast<char*>("getFontNames"), (PyCFunction)scribus_fontnames, METH_NOARGS, tr(scribus_fontnames__doc__)},
@@ -367,6 +368,7 @@
{const_cast<char*>("getImageFile"), scribus_getimagefile, METH_VARARGS, tr(scribus_getimagefile__doc__)},
{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*>("getLastLinkedFrame"), scribus_getlastlinkedframe, METH_VARARGS, tr(scribus_getlastlinkedframe__doc__)},
{const_cast<char*>("getLayers"), (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__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__)},
@@ -381,6 +383,7 @@
{const_cast<char*>("getLineStyles"), (PyCFunction)scribus_getlinestyles, METH_VARARGS, tr(scribus_getlinestyles__doc__)},
{const_cast<char*>("getLineWidth"), scribus_getlinewidth, METH_VARARGS, tr(scribus_getlinewidth__doc__)},
{const_cast<char*>("getMasterPage"), scribus_getmasterpage, METH_VARARGS, tr(scribus_getmasterpage__doc__)},
+ {const_cast<char*>("getNextLinkedFrame"), scribus_getnextlinkedframe, METH_VARARGS, tr(scribus_getnextlinkedframe__doc__)},
{const_cast<char*>("getPageItems"), (PyCFunction)scribus_getpageitems, METH_NOARGS, tr(scribus_getpageitems__doc__)},
{const_cast<char*>("getPageMargins"), (PyCFunction)scribus_getpagemargins, METH_NOARGS, tr(scribus_getpagemargins__doc__)},
{const_cast<char*>("getPageType"), (PyCFunction)scribus_getpagetype, METH_VARARGS, tr(scribus_getpagetype__doc__)},
@@ -390,6 +393,7 @@
{const_cast<char*>("getParagraphStyle"), scribus_getparagraphstyle, METH_VARARGS, tr(scribus_getparagraphstyle__doc__) },
{const_cast<char*>("getParagraphStyles"), (PyCFunction)scribus_getparagraphstyles, METH_NOARGS, tr(scribus_getparagraphstyles__doc__)},
{const_cast<char*>("getPosition"), scribus_getposition, METH_VARARGS, tr(scribus_getposition__doc__)},
+ {const_cast<char*>("getPrevLinkedFrame"), scribus_getprevlinkedframe, METH_VARARGS, tr(scribus_getprevlinkedframe__doc__)},
{const_cast<char*>("getRotation"), scribus_getrotation, METH_VARARGS, tr(scribus_getrotation__doc__)},
{const_cast<char*>("getObjectType"), scribus_getobjecttype, METH_VARARGS, tr(scribus_getobjecttype__doc__)},
{const_cast<char*>("getObjectAttributes"), scribus_getobjectattributes, METH_VARARGS, tr(scribus_getobjectattributes__doc__)},
More information about the scribus-commit
mailing list