r22848 by jghali - Add missing getImageOffset() function to scripter
scribus-commit
scribus-commit at lists.scribus.net
Sun Feb 24 03:10:59 UTC 2019
Author: jghali
Date: Sun Feb 24 03:10:59 2019
New Revision: 22848
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22848
Log:
Add missing getImageOffset() function to scripter
Modified:
trunk/Scribus/doc/de/scripterapi-getobjprop.html
trunk/Scribus/doc/en/scripterapi-getobjprop.html
trunk/Scribus/doc/en/scripterapi-images.html
trunk/Scribus/doc/fr/scripterapi-getobjprop.html
trunk/Scribus/doc/it/scripterapi-getobjprop.html
trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h
trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
Modified: trunk/Scribus/doc/de/scripterapi-getobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/doc/de/scripterapi-getobjprop.html
==============================================================================
--- trunk/Scribus/doc/de/scripterapi-getobjprop.html (original)
+++ trunk/Scribus/doc/de/scripterapi-getobjprop.html Sun Feb 24 03:10:59 2019
@@ -56,7 +56,11 @@
<dt><a name="-getImageFile"><strong>getImageFile</strong></a>(...)</dt>
<dd><code>getImageFile(["name"]) -> string</code>
<p>Returns the filename for the image in the image frame. If "name" is not given the currently selected item is used.</p></dd>
-
+
+<dt><a name="-getImageOffset"><strong>getImageOffset</strong></a>(...)</dt>
+<dd><code>getImageOffset(["name"]) -> (x,y)</code>
+<p>Returns a (x, y) tuple containing the offset values in point unit of the image frame "name". If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getImageScale"><strong>getImageScale</strong></a>(...)</dt>
<dd><code>getImageScale(["name"]) -> (x,y)</code>
<p>Returns a (x, y) tuple containing the scaling values of the image frame "name". If "name" is not given the currently selected item is used.</p></dd>
Modified: trunk/Scribus/doc/en/scripterapi-getobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/doc/en/scripterapi-getobjprop.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-getobjprop.html (original)
+++ trunk/Scribus/doc/en/scripterapi-getobjprop.html Sun Feb 24 03:10:59 2019
@@ -56,7 +56,11 @@
<dt><a name="-getImageFile"><strong>getImageFile</strong></a>(...)</dt>
<dd><code>getImageFile(["name"]) -> string</code>
<p>Returns the filename for the image in the image frame. If "name" is not given the currently selected item is used.</p></dd>
-
+
+<dt><a name="-getImageOffset"><strong>getImageOffset</strong></a>(...)</dt>
+<dd><code>getImageOffset(["name"]) -> (x,y)</code>
+<p>Returns a (x, y) tuple containing the offset values in point unit of the image frame "name". If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-getImageScale"><strong>getImageScale</strong></a>(...)</dt>
<dd><code>getImageScale(["name"]) -> (x,y)</code>
<p>Returns a (x, y) tuple containing the scaling values of the image frame "name". If "name" is not given the currently selected item is used.</p></dd>
Modified: trunk/Scribus/doc/en/scripterapi-images.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/doc/en/scripterapi-images.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-images.html (original)
+++ trunk/Scribus/doc/en/scripterapi-images.html Sun Feb 24 03:10:59 2019
@@ -47,6 +47,10 @@
<p>Sets the scaling factors of the picture in the image frame "name". If "name" is not given the currently selected item is used. A number of 1 means 100 %. Scaling factors are equal to the values shown on properties palette.</p>
<p>May raise <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> if the target frame is not an image frame</p></dd>
+<dt><a name="-getImageOffset"><strong>getImageOffset</strong></a>(...)</dt>
+<dd><code>getImageOffset(["name"]) -> (x,y)</code>
+<p>Returns a (x, y) tuple containing the offset values in point unit of the image frame "name". If "name" is not given the currently selected item is used.</p></dd>
+
<dt><a name="-setImageOffset"><strong>setImageOffset</strong></a>(...)</dt>
<dd><code>setImageOffset(x, y [, "name"])</code>
<p>Sets the position of the picture in the image frame "name". If "name" is not given the currently selected item is used. The specified offset values are equal to the values shown on properties palette when point unit is used.</p>
Modified: trunk/Scribus/doc/fr/scripterapi-getobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/doc/fr/scripterapi-getobjprop.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-getobjprop.html (original)
+++ trunk/Scribus/doc/fr/scripterapi-getobjprop.html Sun Feb 24 03:10:59 2019
@@ -53,10 +53,14 @@
<dt><a name="-getImageFile"><strong>getImageFile</strong></a>(...)</dt>
<dd><code>getImageName(["nom"]) -> chaîne</code>
<p>Retourne le nom du fichier image chargé dans le cadre d'image "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
-
+
+<dt><a name="-getImageOffset"><strong>getImageOffset</strong></a>(...)</dt>
+<dd><code>getImageOffset(["nom"]) -> (x,y)</code>
+<p>Retourne un vecteur (x, y) contenant les valeurs d'offset en unité points du cadre d'image "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
+
<dt><a name="-getImageScale"><strong>getImageScale</strong></a>(...)</dt>
<dd><code>getImageScale(["nom"]) -> (x,y)</code>
-<p>Retourne un vecteur (x, y) contenant les valeurs de redimensionnement du cadre d'image "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
+<p>Retourne un vecteur (x, y) contenant les valeurs d'échelle du cadre d'image "nom". Si "nom" n'est pas fourni, l'élément sélectionné est utilisé. </p></dd>
<dt><a name="-getLineBlendmode"><strong>getLineBlendmode</strong>(...)</a></dt>
<dd><code>getLineBlendmode(["nom"]) -> entier</code>
Modified: trunk/Scribus/doc/it/scripterapi-getobjprop.html
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/doc/it/scripterapi-getobjprop.html
==============================================================================
--- trunk/Scribus/doc/it/scripterapi-getobjprop.html (original)
+++ trunk/Scribus/doc/it/scripterapi-getobjprop.html Sun Feb 24 03:10:59 2019
@@ -56,6 +56,10 @@
<dt><a name="-getImageFile"><strong>getImageFile</strong></a>(...)</dt>
<dd><code>getImageFile(["name"]) -> string</code>
<p>Returns the filename for the image in the image frame. If "name" is not given the currently selected item is used.</p></dd>
+
+<dt><a name="-getImageOffset"><strong>getImageOffset</strong></a>(...)</dt>
+<dd><code>getImageOffset(["name"]) -> (x,y)</code>
+<p>Returns a (x, y) tuple containing the offset values in point unit of the image frame "name". If "name" is not given the currently selected item is used.</p></dd>
<dt><a name="-getImageScale"><strong>getImageScale</strong></a>(...)</dt>
<dd><code>getImageScale(["name"]) -> (x,y)</code>
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp Sun Feb 24 03:10:59 2019
@@ -208,6 +208,17 @@
return nullptr;
PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
return i != nullptr ? PyInt_FromLong(static_cast<long>(i->cornerRadius())) : nullptr;
+}
+
+PyObject *scribus_getimgoffset(PyObject* /* self */, PyObject* args)
+{
+ char *Name = const_cast<char*>("");
+ if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
+ return nullptr;
+ if (!checkHaveDocument())
+ return nullptr;
+ PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+ return i != nullptr ? Py_BuildValue("(ff)", i->imageXOffset() * i->imageXScale(), i->imageYOffset() * i->imageYScale()) : nullptr;
}
PyObject *scribus_getimgscale(PyObject* /* self */, PyObject* args)
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h Sun Feb 24 03:10:59 2019
@@ -187,6 +187,16 @@
PyObject *scribus_getimagefile(PyObject * /*self*/, PyObject* args);
/*! docstring */
+PyDoc_STRVAR(scribus_getimgoffset__doc__,
+ QT_TR_NOOP("getImageOffset([\"name\"]) -> (x,y)\n\
+\n\
+Returns a (x, y) tuple containing the offset values in point unit of the image\n\
+frame \"name\". If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Returns image scale of the object */
+PyObject *scribus_getimgoffset(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
PyDoc_STRVAR(scribus_getimgscale__doc__,
QT_TR_NOOP("getImageScale([\"name\"]) -> (x,y)\n\
\n\
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22848&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sun Feb 24 03:10:59 2019
@@ -376,6 +376,7 @@
{const_cast<char*>("getHGuides"), (PyCFunction)scribus_getHguides, METH_NOARGS, tr(scribus_getHguides__doc__)},
{const_cast<char*>("getImageColorSpace"), scribus_getimagecolorspace, METH_VARARGS, tr(scribus_getimagecolorspace__doc__) },
{const_cast<char*>("getImageFile"), scribus_getimagefile, METH_VARARGS, tr(scribus_getimagefile__doc__)},
+ {const_cast<char*>("getImageOffset"), scribus_getimgoffset, METH_VARARGS, tr(scribus_getimgoffset__doc__)},
{const_cast<char*>("getImageScale"), scribus_getimgscale, METH_VARARGS, tr(scribus_getimgscale__doc__)},
{const_cast<char*>("getLayers"), (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__doc__)},
{const_cast<char*>("getLayerBlendmode"), scribus_glayerblend, METH_VARARGS, tr(scribus_glayerblend__doc__)},
More information about the scribus-commit
mailing list