Author: jghali
Date: Tue Nov  5 00:45:03 2019
New Revision: 23332

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23332
Log:
#15911: After calling insertText(), getText() does not show all characters

Modified:
    trunk/Scribus/doc/de/scripterapi-textframes.html
    trunk/Scribus/doc/en/scripterapi-textframes.html
    trunk/Scribus/doc/it/scripterapi-textframes.html
    trunk/Scribus/doc/ru/scripterapi-textframes.html
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: trunk/Scribus/doc/de/scripterapi-textframes.html
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/doc/de/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-textframes.html    (original)
+++ trunk/Scribus/doc/de/scripterapi-textframes.html    Tue Nov  5 00:45:03 2019
@@ -96,6 +96,10 @@
 <p>Returns true if the text frame "name" is a PDF bookmark. If "name" is not 
given the currently selected item is used.</p>
 <p>May raise WrongFrameTypeError if the target frame is not a text 
frame</p></dd>
 
+<dt><a name="-layoutText"><strong>layoutText</strong></a>(...)</dt>
+<dd><code>layoutText(["name"])</code>
+<p>Relayout text in the text frame "name". If "name" is not given the 
currently selected item is used.</p></dd>
+
 <dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
 <dd><code>selectText(start, count, ["name"])</code>
 <p>Selects "count" characters of text in the text frame "name" starting from 
the character "start". Character counting starts at 0. If "count" is zero, any 
text selection will be cleared.  If "name" is not given the currently selected 
item is used.</p>

Modified: trunk/Scribus/doc/en/scripterapi-textframes.html
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/doc/en/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-textframes.html    (original)
+++ trunk/Scribus/doc/en/scripterapi-textframes.html    Tue Nov  5 00:45:03 2019
@@ -96,6 +96,10 @@
 <p>Returns true if the text frame "name" is a PDF bookmark. If "name" is not 
given the currently selected item is used.</p>
 <p>May raise WrongFrameTypeError if the target frame is not a text 
frame</p></dd>
 
+<dt><a name="-layoutText"><strong>layoutText</strong></a>(...)</dt>
+<dd><code>layoutText(["name"])</code>
+<p>Relayout text in the text frame "name". If "name" is not given the 
currently selected item is used.</p></dd>
+
 <dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
 <dd><code>selectText(start, count, ["name"])</code>
 <p>Selects "count" characters of text in the text frame "name" starting from 
the character "start". Character counting starts at 0. If "count" is zero, any 
text selection will be cleared.  If "name" is not given the currently selected 
item is used.</p>

Modified: trunk/Scribus/doc/it/scripterapi-textframes.html
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/doc/it/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-textframes.html    (original)
+++ trunk/Scribus/doc/it/scripterapi-textframes.html    Tue Nov  5 00:45:03 2019
@@ -96,6 +96,10 @@
 <p>Returns true if the text frame "name" is a PDF bookmark. If "name" is not 
given the currently selected item is used.</p>
 <p>May raise WrongFrameTypeError if the target frame is not a text 
frame</p></dd>
 
+<dt><a name="-layoutText"><strong>layoutText</strong></a>(...)</dt>
+<dd><code>layoutText(["name"])</code>
+<p>Relayout text in the text frame "name". If "name" is not given the 
currently selected item is used.</p></dd>
+
 <dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
 <dd><code>selectText(start, count, ["name"])</code>
 <p>Selects "count" characters of text in the text frame "name" starting from 
the character "start". Character counting starts at 0. If "count" is zero, any 
text selection will be cleared.  If "name" is not given the currently selected 
item is used.</p>

Modified: trunk/Scribus/doc/ru/scripterapi-textframes.html
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/doc/ru/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/ru/scripterapi-textframes.html    (original)
+++ trunk/Scribus/doc/ru/scripterapi-textframes.html    Tue Nov  5 00:45:03 2019
@@ -96,6 +96,10 @@
 <p>Returns true if the text frame "name" is a PDF bookmark. If "name" is not 
given the currently selected item is used.</p>
 <p>May raise WrongFrameTypeError if the target frame is not a text 
frame</p></dd>
 
+<dt><a name="-layoutText"><strong>layoutText</strong></a>(...)</dt>
+<dd><code>layoutText(["name"])</code>
+<p>Relayout text in the text frame "name". If "name" is not given the 
currently selected item is used.</p></dd>
+
 <dt><a name="-selectText"><strong>selectText</strong></a>(...)</dt>
 <dd><code>selectText(start, count, ["name"])</code>
 <p>Selects "count" characters of text in the text frame "name" starting from 
the character "start". Character counting starts at 0. If "count" is zero, any 
text selection will be cleared.  If "name" is not given the currently selected 
item is used.</p>

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp      (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp      Tue Nov  5 
00:45:03 2019
@@ -463,6 +463,26 @@
        gt.launchImporter(-1, fileName, false, QString("utf-8"), false, true, 
item);
 
        // FIXME: PyMem_Free() - are any needed??
+       Py_RETURN_NONE;
+}
+
+PyObject *scribus_layouttext(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() && !item->isPathText())
+       {
+               PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot delete 
text from a non-text frame.","python error").toLocal8Bit().constData());
+               return nullptr;
+       }
+       item->layout();
+
        Py_RETURN_NONE;
 }
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h        (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h        Tue Nov  5 
00:45:03 2019
@@ -205,6 +205,16 @@
 PyObject *scribus_inserthtmltext(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_layouttext__doc__,
+QT_TR_NOOP("layoutText([\"name\"])\n\
+\n\
+Relayout text in the text frame \"name\". If \"name\" is not given the 
currently\n\
+selected item is used.\n\
+"));
+/*! Delete text */
+PyObject *scribus_layouttext(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_setfont__doc__,
 QT_TR_NOOP("setFont(\"font\", [\"name\"])\n\
 \n\

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23332&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Tue Nov  5 
00:45:03 2019
@@ -420,6 +420,7 @@
        {const_cast<char*>("isLayerOutlined"), scribus_glayeroutline, 
METH_VARARGS, tr(scribus_glayeroutline__doc__)},
        {const_cast<char*>("isLayerFlow"), scribus_glayerflow, METH_VARARGS, 
tr(scribus_glayerflow__doc__)},
        {const_cast<char*>("isLocked"), scribus_islocked, METH_VARARGS, 
tr(scribus_islocked__doc__)},
+       {const_cast<char*>("layoutText"), scribus_layouttext, METH_VARARGS, 
tr(scribus_layouttext__doc__)},
        {const_cast<char*>("linkTextFrames"), scribus_linktextframes, 
METH_VARARGS, tr(scribus_linktextframes__doc__)},
        {const_cast<char*>("loadImage"), scribus_loadimage, METH_VARARGS, 
tr(scribus_loadimage__doc__)},
        {const_cast<char*>("loadStylesFromFile"), scribus_loadstylesfromfile, 
METH_VARARGS, tr(scribus_loadstylesfromfile__doc__)},


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to