r19459 by jghali - 12572, patch 07/12: add command to scripter for saving and reading PDF options

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 30 00:27:31 UTC 2014


Author: jghali
Date: Sat Aug 30 00:27:31 2014
New Revision: 19459

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19459
Log:
12572, patch 07/12: add command to scripter for saving and reading PDF options

Modified:
    trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19459&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.cpp Sat Aug 30 00:27:31 2014
@@ -18,6 +18,7 @@
 #include "scribusview.h"
 #include "selection.h"
 #include "fonts/scfontmetrics.h"
+#include "pdfoptionsio.h"
 
 PyObject *scribus_setredraw(PyObject* /* self */, PyObject* args)
 {
@@ -774,6 +775,40 @@
 PyObject *scribus_moveselectiontoback(PyObject*)
 {
 	ScCore->primaryMainWindow()->doc->sendItemSelectionToBack();
+	Py_RETURN_NONE;
+}
+
+PyObject *scribus_savepdfoptions(PyObject* /* self */, PyObject* args)
+{
+	char* file;
+	if(!checkHaveDocument())
+		return NULL;
+	if (!PyArg_ParseTuple(args, const_cast<char*>("es"), "utf-8", &file))
+		return NULL;
+
+	PDFOptionsIO io(ScCore->primaryMainWindow()->doc->pdfOptions());
+	if (!io.writeTo(file))
+	{
+		PyErr_SetString(ScribusException, io.lastError().toUtf8());
+		return NULL;
+	}
+	Py_RETURN_NONE;
+}
+
+PyObject *scribus_readpdfoptions(PyObject* /* self */, PyObject* args)
+{
+	char* file;
+	if(!checkHaveDocument())
+		return NULL;
+	if (!PyArg_ParseTuple(args, const_cast<char*>("es"), "utf-8", &file))
+		return NULL;
+
+	PDFOptionsIO io(ScCore->primaryMainWindow()->doc->pdfOptions());
+	if (!io.readFrom(file))
+	{
+		PyErr_SetString(ScribusException, io.lastError().toUtf8());
+		return NULL;
+	}
 	Py_RETURN_NONE;
 }
 
@@ -796,5 +831,6 @@
 	  << scribus_glayerblend__doc__ << scribus_glayertrans__doc__ 
 	  << scribus_removelayer__doc__ << scribus_createlayer__doc__ 
 	  << scribus_getlanguage__doc__ << scribus_moveselectiontofront__doc__
-	  << scribus_moveselectiontoback__doc__ << scribus_filequit__doc__;
-}
+	  << scribus_moveselectiontoback__doc__ << scribus_filequit__doc__
+	  << scribus_savepdfoptions__doc__ << scribus_readpdfoptions__doc__;
+}

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19459&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.h (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdmisc.h Sat Aug 30 00:27:31 2014
@@ -348,6 +348,20 @@
 /*! 04.01.2007 : Joachim Neu : Moves item selection to back. */
 PyObject *scribus_moveselectiontoback(PyObject*);
 
+PyDoc_STRVAR(scribus_savepdfoptions__doc__,
+QT_TR_NOOP("savePDFOptions(fileName)\n\
+\n\
+Save PDF options to fileName.\n\
+"));
+PyObject *scribus_savepdfoptions(PyObject* /* self */, PyObject* args);
+
+PyDoc_STRVAR(scribus_readpdfoptions__doc__,
+QT_TR_NOOP("readPDFOptions(fileName)\n\
+\n\
+Read PDF options from fileName.\n\
+"));
+PyObject *scribus_readpdfoptions(PyObject* /* self */, PyObject* args);
+
 #endif
 
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19459&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sat Aug 30 00:27:31 2014
@@ -442,6 +442,7 @@
 	{const_cast<char*>("progressReset"), (PyCFunction)scribus_progressreset, METH_NOARGS, tr(scribus_progressreset__doc__)},
 	{const_cast<char*>("progressSet"), scribus_progresssetprogress, METH_VARARGS, tr(scribus_progresssetprogress__doc__)},
 	{const_cast<char*>("progressTotal"), scribus_progresssettotalsteps, METH_VARARGS, tr(scribus_progresssettotalsteps__doc__)},
+	{const_cast<char*>("readPDFOptions"), (PyCFunction)scribus_readpdfoptions, METH_VARARGS, tr(scribus_readpdfoptions__doc__)},
 	{const_cast<char*>("redrawAll"), (PyCFunction)scribus_redraw, METH_NOARGS, tr(scribus_redraw__doc__)},
 	{const_cast<char*>("removeTableRows"), scribus_removetablerows, METH_VARARGS, tr(scribus_removetablerows__doc__)},
 	{const_cast<char*>("removeTableColumns"), scribus_removetablecolumns, METH_VARARGS, tr(scribus_removetablecolumns__doc__)},
@@ -455,6 +456,7 @@
 	{const_cast<char*>("saveDocAs"), scribus_savedocas, METH_VARARGS, tr(scribus_savedocas__doc__)},
 	{const_cast<char*>("saveDoc"), (PyCFunction)scribus_savedoc, METH_NOARGS, tr(scribus_savedoc__doc__)},
 	{const_cast<char*>("savePageAsEPS"), scribus_savepageeps, METH_VARARGS, tr(scribus_savepageeps__doc__)},
+	{const_cast<char*>("savePDFOptions"), (PyCFunction)scribus_savepdfoptions, METH_VARARGS, tr(scribus_savepdfoptions__doc__)},
 	{const_cast<char*>("scaleGroup"), scribus_scalegroup, METH_VARARGS, tr(scribus_scalegroup__doc__)},
 	{const_cast<char*>("scaleImage"), scribus_scaleimage, METH_VARARGS, tr(scribus_scaleimage__doc__)},
 	{const_cast<char*>("setImageBrightness"), scribus_setimagebrightness, METH_VARARGS, tr(scribus_setimagebrightness__doc__)},




More information about the scribus-commit mailing list