r23599 by craig - #15493: Add setBleeds to scripter for py2/3
scribus-commit
scribus-commit at lists.scribus.net
Sun Apr 12 21:08:52 UTC 2020
Author: craig
Date: Sun Apr 12 21:08:51 2020
New Revision: 23599
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23599
Log:
#15493: Add setBleeds to scripter for py2/3
Modified:
trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.h
trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.cpp
trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.h
trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23599&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.cpp Sun Apr 12 21:08:51 2020
@@ -110,6 +110,24 @@
bool ret = ScCore->primaryMainWindow()->doFileNew(b, h, tpr, lr, rr, btr, 0, 1, false, ds, unit, fsl, ori, fNr, "Custom", true);
// qApp->processEvents();
return PyLong_FromLong(static_cast<long>(ret));
+}
+
+PyObject *scribus_setbleeds(PyObject */* self */, PyObject *args)
+{
+ double lr, tpr, btr, rr;
+ if (!PyArg_ParseTuple(args, "dddd", &lr, &rr, &tpr, &btr))
+ return nullptr;
+ if (!checkHaveDocument())
+ return nullptr;
+ MarginStruct bleeds(ValueToPoint(tpr), ValueToPoint(lr), ValueToPoint(btr), ValueToPoint(rr));
+
+ ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
+ ScribusView* currentView = ScCore->primaryMainWindow()->view;
+ currentDoc->setBleeds(bleeds);
+ currentView->reformPages();
+ currentDoc->setModified(true);
+ currentView->DrawNew();
+ Py_RETURN_NONE;
}
PyObject *scribus_setmargins(PyObject* /* self */, PyObject* args)
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23599&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmddoc.h Sun Apr 12 21:08:51 2020
@@ -182,6 +182,17 @@
PyObject *scribus_setinfo(PyObject * /*self*/, PyObject* args);
/*! docstring */
+PyDoc_STRVAR(scribus_setbleeds__doc__,
+QT_TR_NOOP("setBleeds(lr, rr, tr, br)\n\
+\n\
+Sets the bleeds of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\
+bleeds are given in the measurement units of the document - see UNIT_<type>\n\
+constants.\n\
+"));
+/** Sets document bleeds - left, right, top and bottom. */
+PyObject *scribus_setbleeds(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
PyDoc_STRVAR(scribus_setmargins__doc__,
QT_TR_NOOP("setMargins(lr, rr, tr, br)\n\
\n\
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23599&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sun Apr 12 21:08:51 2020
@@ -528,6 +528,7 @@
{const_cast<char*>("setLineSpacingMode"), scribus_setlinespacemode, METH_VARARGS, tr(scribus_setlinespacemode__doc__)},
{const_cast<char*>("setLineStyle"), scribus_setlinestyle, METH_VARARGS, tr(scribus_setlinestyle__doc__)},
{const_cast<char*>("setLineWidth"), scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
+ {const_cast<char*>("setBleeds"), scribus_setbleeds, METH_VARARGS, tr(scribus_setbleeds__doc__)},
{const_cast<char*>("setMargins"), scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
{const_cast<char*>("setBaseLine"), scribus_setbaseline, METH_VARARGS, tr(scribus_setbaseline__doc__)},
{const_cast<char*>("setItemName"), scribus_setitemname, METH_VARARGS, tr(scribus_setitemname__doc__)},
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23599&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.cpp Sun Apr 12 21:08:51 2020
@@ -112,18 +112,36 @@
return PyInt_FromLong(static_cast<long>(ret));
}
-PyObject *scribus_setmargins(PyObject* /* self */, PyObject* args)
+PyObject *scribus_setbleeds(PyObject */* self */, PyObject *args)
{
double lr, tpr, btr, rr;
if (!PyArg_ParseTuple(args, "dddd", &lr, &rr, &tpr, &btr))
return nullptr;
if (!checkHaveDocument())
return nullptr;
+ MarginStruct bleeds(ValueToPoint(tpr), ValueToPoint(lr), ValueToPoint(btr), ValueToPoint(rr));
+
+ ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
+ ScribusView* currentView = ScCore->primaryMainWindow()->view;
+ currentDoc->setBleeds(bleeds));
+ currentView->reformPages();
+ currentDoc->setModified(true);
+ currentView->DrawNew();
+ Py_RETURN_NONE;
+}
+
+PyObject *scribus_setmargins(PyObject* /* self */, PyObject* args)
+{
+ double lr, tpr, btr, rr;
+ if (!PyArg_ParseTuple(args, "dddd", &lr, &rr, &tpr, &btr))
+ return nullptr;
+ if (!checkHaveDocument())
+ return nullptr;
MarginStruct margins(ValueToPoint(tpr), ValueToPoint(lr), ValueToPoint(btr), ValueToPoint(rr));
ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
ScribusView* currentView = ScCore->primaryMainWindow()->view;
- currentDoc->resetPage(currentDoc->pagePositioning(), &margins);
+ currentDoc->setMargins(margins);
currentView->reformPages();
currentDoc->setModified(true);
currentView->GotoPage(currentDoc->currentPageNumber());
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23599&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmddoc.h Sun Apr 12 21:08:51 2020
@@ -174,6 +174,17 @@
PyObject *scribus_setinfo(PyObject * /*self*/, PyObject* args);
/*! docstring */
+PyDoc_STRVAR(scribus_setbleeds__doc__,
+QT_TR_NOOP("setBleeds(lr, rr, tr, br)\n\
+\n\
+Sets the bleeds of the document, Left(lr), Right(rr), Top(tr) and Bottom(br)\n\
+bleeds are given in the measurement units of the document - see UNIT_<type>\n\
+constants.\n\
+"));
+/** Sets document bleeds - left, right, top and bottom. */
+PyObject *scribus_setbleeds(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
PyDoc_STRVAR(scribus_setmargins__doc__,
QT_TR_NOOP("setMargins(lr, rr, tr, br)\n\
\n\
Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23599&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 Sun Apr 12 21:08:51 2020
@@ -523,6 +523,7 @@
{const_cast<char*>("setLineSpacingMode"), scribus_setlinespacemode, METH_VARARGS, tr(scribus_setlinespacemode__doc__)},
{const_cast<char*>("setLineStyle"), scribus_setlinestyle, METH_VARARGS, tr(scribus_setlinestyle__doc__)},
{const_cast<char*>("setLineWidth"), scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
+ {const_cast<char*>("setBleeds"), scribus_setbleeds, METH_VARARGS, tr(scribus_setbleeds__doc__)},
{const_cast<char*>("setMargins"), scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
{const_cast<char*>("setBaseLine"), scribus_setbaseline, METH_VARARGS, tr(scribus_setbaseline__doc__)},
{const_cast<char*>("setMultiLine"), scribus_setmultiline, METH_VARARGS, tr(scribus_setmultiline__doc__)},
More information about the scribus-commit
mailing list