Subversion Repositories Scribus

Rev

Rev 23694 | Rev 23697 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
82 Franz 7
/***************************************************************************
8
                          scriptplugin.cpp  -  description
9
                             -------------------
10
    begin                : Thu Oct 3 08:00:00 CEST 2002
11
    copyright            : (C) 2002 by Franz Schmid
12
    email                : Franz.Schmid@altmuehlnet.de
13
 ***************************************************************************/
14
 
15
/***************************************************************************
16
 *                                                                         *
17
 *   This program is free software; you can redistribute it and/or modify  *
18
 *   it under the terms of the GNU General Public License as published by  *
19
 *   the Free Software Foundation; either version 2 of the License, or     *
20
 *   (at your option) any later version.                                   *
21
 *                                                                         *
22
 ***************************************************************************/
792 subik 23
 
24
// include cmdvar.h first, as it pulls in <Python.h>
22049 jghali 25
#include "cmdannotations.h"
792 subik 26
#include "cmdvar.h"
16856 craig 27
#include "cmdcell.h"
10862 cbradney 28
#include "cmdcolor.h"
103 Franz 29
#include "cmddialog.h"
30
#include "cmddoc.h"
10862 cbradney 31
#include "cmdgetprop.h"
32
#include "cmdgetsetprop.h"
33
#include "cmdmani.h"
34
#include "cmdmisc.h"
35
#include "cmdobj.h"
103 Franz 36
#include "cmdpage.h"
37
#include "cmdsetprop.h"
16856 craig 38
#include "cmdtable.h"
103 Franz 39
#include "cmdtext.h"
40
#include "cmdutil.h"
11384 subik 41
#include "cmdstyle.h"
203 Franz 42
#include "guiapp.h"
20185 craig 43
#include "iconmanager.h"
10862 cbradney 44
#include "objimageexport.h"
45
#include "objpdffile.h"
46
#include "objprinter.h"
14629 cbradney 47
#include "prefs_scripter.h"
10862 cbradney 48
#include "scconfig.h"
1693 craig 49
#include "scpaths.h"
10862 cbradney 50
#include "scribuscore.h"
3071 subik 51
#include "scribusstructs.h"
10862 cbradney 52
#include "scriptercore.h"
53
#include "scriptplugin.h"
54
#include "svgimport.h"
20185 craig 55
#include "ui/customfdialog.h"
56
#include "ui/helpbrowser.h"
57
#include "ui/propertiespalette.h"
58
#include "ui/scmwmenumanager.h"
10862 cbradney 59
#include "units.h"
10200 cbradney 60
 
20185 craig 61
 
10223 cbradney 62
#include <QApplication>
63
#include <QMessageBox>
64
#include <QTextCodec>
65
#include <QRegExp>
66
#include <QPixmap>
67
#include <QWidget>
68
#include <QString>
8501 cbradney 69
//Added by qt3to4:
9535 fschmid 70
#include <QByteArray>
82 Franz 71
#include <cstdlib>
853 subik 72
#include <iostream>
73
 
3216 craig 74
 
4119 craig 75
#ifdef HAVE_SCRIPTER2
76
extern void scripter2_init();
77
#endif
78
 
647 fschmid 79
// Exceptions; visible from cmdvar.h, set up in initscribus()
80
PyObject* ScribusException;
81
PyObject* NoDocOpenError;
853 subik 82
PyObject* WrongFrameTypeError;
83
PyObject* NoValidObjectError;
899 cbradney 84
PyObject* NotFoundError;
85
PyObject* NameExistsError;
647 fschmid 86
 
1425 subik 87
// Other extern variables defined in cmdvar.h
88
PyObject* wrappedMainWindow;
89
PyObject* wrappedQApp;
1718 craig 90
ScripterCore* scripterCore;
1425 subik 91
 
1718 craig 92
 
3207 craig 93
int scriptplugin_getPluginAPIVersion()
82 Franz 94
{
3207 craig 95
        return PLUGIN_API_VERSION;
82 Franz 96
}
97
 
3207 craig 98
ScPlugin* scriptplugin_getPlugin()
82 Franz 99
{
22606 craig 100
        scripterCore=nullptr;
3207 craig 101
        ScriptPlugin* plug = new ScriptPlugin();
102
        Q_CHECK_PTR(plug);
103
        return plug;
82 Franz 104
}
105
 
3207 craig 106
void scriptplugin_freePlugin(ScPlugin* plugin)
660 fschmid 107
{
3207 craig 108
        ScriptPlugin* plug = dynamic_cast<ScriptPlugin*>(plugin);
109
        Q_ASSERT(plug);
110
        delete plug;
660 fschmid 111
}
112
 
22639 craig 113
ScriptPlugin::ScriptPlugin()
1269 cbradney 114
{
3207 craig 115
        // Set action info in languageChange, so we only have to do
116
        // it in one place.
117
        languageChange();
1269 cbradney 118
}
119
 
23116 craig 120
ScriptPlugin::~ScriptPlugin() = default;
1269 cbradney 121
 
3207 craig 122
void ScriptPlugin::languageChange()
1269 cbradney 123
{
3207 craig 124
        if (scripterCore)
125
                scripterCore->languageChange();
1269 cbradney 126
}
127
 
5243 cbradney 128
void ScriptPlugin::addToMainWindowMenu(ScribusMainWindow* mw)
129
{
130
        if (scripterCore)
131
                scripterCore->addToMainWindowMenu(mw);
132
}
133
 
3207 craig 134
const QString ScriptPlugin::fullTrName() const
1269 cbradney 135
{
3207 craig 136
        return QObject::tr("Scripter");
1269 cbradney 137
}
138
 
3207 craig 139
const ScActionPlugin::AboutData* ScriptPlugin::getAboutData() const
1269 cbradney 140
{
3241 craig 141
        AboutData* about = new AboutData;
142
        Q_CHECK_PTR(about);
143
        about->authors = QString::fromUtf8(
144
                        "Petr Van\xc4\x9bk <petr@scribus.info>, "
145
                        "Franz Schmid <franz@scribus.info>, "
146
                        "Craig Ringer <craig@scribus.info>");
23352 craig 147
        about->shortDescription = tr("Embedded Python scripting support for Python 3.x.");
3241 craig 148
        // about->description = tr("Write me!")
3439 subik 149
        // about->version
3241 craig 150
        // about->releaseDate
151
        // about->copyright
152
        // about->license
153
        return about;
1269 cbradney 154
}
155
 
3207 craig 156
void ScriptPlugin::deleteAboutData(const AboutData* about) const
2223 cbradney 157
{
3241 craig 158
        Q_ASSERT(about);
159
        delete about;
2223 cbradney 160
}
161
 
3207 craig 162
bool ScriptPlugin::initPlugin()
82 Franz 163
{
14171 jghali 164
#if defined(Q_OS_WIN)
165
        QString pyHome = qApp->applicationDirPath() + "/python";
166
        if (QDir(pyHome).exists())
167
        {
168
                QString ph = QDir::toNativeSeparators(pyHome);
23278 jghali 169
                pythonHome.resize(2 * ph.length() + 2);
170
                memcpy(pythonHome.data(), ph.utf16(), 2 * ph.length() + 2);
171
                Py_SetPythonHome((const wchar_t*) pythonHome.constData());
14171 jghali 172
        }
173
#endif
1269 cbradney 174
 
5781 cbradney 175
        scripterCore = new ScripterCore(ScCore->primaryMainWindow());
3207 craig 176
        Q_CHECK_PTR(scripterCore);
23278 jghali 177
 
178
        PyImport_AppendInittab("scribus", &PyInit_scribus);
179
        Py_Initialize();
180
 
181
        //initscribus(ScCore->primaryMainWindow());
182
 
4119 craig 183
#ifdef HAVE_SCRIPTER2
184
        scripter2_init();
185
#endif
2706 craig 186
        scripterCore->setupMainInterpreter();
1752 craig 187
        scripterCore->initExtensionScripts();
3207 craig 188
        return true;
1269 cbradney 189
}
190
 
3207 craig 191
bool ScriptPlugin::cleanupPlugin()
1269 cbradney 192
{
1718 craig 193
        if (scripterCore)
10222 jghali 194
        {
1718 craig 195
                delete scripterCore;
22517 craig 196
                scripterCore = nullptr;
10222 jghali 197
        }
1269 cbradney 198
        Py_Finalize();
3207 craig 199
        return true;
1269 cbradney 200
}
201
 
23116 craig 202
bool ScriptPlugin::newPrefsPanelWidget(QWidget* parent, Prefs_Pane*& panel)
14629 cbradney 203
{
204
        panel = new Prefs_Scripter(parent);
205
        Q_CHECK_PTR(panel);
16728 jghali 206
        connect(panel, SIGNAL(prefsChanged()), scripterCore, SLOT(updateSyntaxHighlighter()));
14629 cbradney 207
        return true;
208
}
209
 
3207 craig 210
/*  TEMPORARILY DISABLED
211
void run()
1269 cbradney 212
{
1693 craig 213
        QString pfad = ScPaths::instance().docDir();
1269 cbradney 214
        QString pfad2;
16577 craig 215
        pfad2 = QDir::toNativeSeparators(pfad + "en/Scripter/index.html");
5781 cbradney 216
        HelpBrowser *dia = new HelpBrowser(0, QObject::tr("Online Reference"), ScCore->primaryMainWindow()->getGuiLanguage(), "scripter");
1269 cbradney 217
        dia->show();
218
}
3207 craig 219
*/
1269 cbradney 220
 
221
 
82 Franz 222
/****************************************************************************************/
223
/*                                                                                      */
650 fschmid 224
/*   Definitions of the Python commands                                                 */
82 Franz 225
/*                                                                                      */
226
/****************************************************************************************/
227
 
11955 subik 228
/*static */PyObject *scribus_retval(PyObject* /*self*/, PyObject* args)
82 Franz 229
{
22517 craig 230
        char *Name = nullptr;
23278 jghali 231
        if (!PyArg_ParseTuple(args, (char*) "s", &Name))
22517 craig 232
                return nullptr;
899 cbradney 233
        // Because sysdefaultencoding is not utf-8, Python is returning utf-8 encoded
234
        // 8-bit char* strings. Make sure Qt understands that the input is utf-8 not
235
        // the default local encoding (usually latin-1) by using QString::fromUtf8()
5051 subik 236
        /*RetString = QString::fromUtf8(Name);
237
        RetVal = retV;*/
238
        scripterCore->returnString = QString::fromUtf8(Name);
23278 jghali 239
        return PyLong_FromLong(0L);
82 Franz 240
}
241
 
11955 subik 242
/*static */PyObject *scribus_getval(PyObject* /*self*/)
82 Franz 243
{
23278 jghali 244
        return PyUnicode_FromString(scripterCore->inValue.toUtf8().data());
82 Franz 245
}
246
 
5051 subik 247
/*! \brief Translate a docstring. Small helper function for use with the
853 subik 248
 * PyMethodDef struct.
249
 */
250
char* tr(const char* docstringConstant)
251
{
899 cbradney 252
        // Alas, there's a lot of wasteful string copying going on
253
        // here.
254
        QString translated = QObject::tr(docstringConstant, "scripter docstring");
2071 subik 255
        // pv - hack for ugly formating in console removing
256
        translated.replace("\n\n", "<P>");
257
        translated.replace('\n', " ");
258
        translated.replace("<P>", "\n\n");
899 cbradney 259
        /*
260
         * Python doesn't support 'unicode' object docstrings in the PyMethodDef,
261
         * and has no way to specify what encoding docstrings are in. The passed C
262
         * strings passed are made into 'str' objects as-is. These are interpreted
263
         * as being in the Python sysdefaultencoding, usually 'ascii', when used.
264
         * We now set systemdefaultencoding to 'utf-8' ...  so we're going to pass
265
         * Python an 8-bit utf-8 encoded string in a char* .  With
266
         * sysdefaultencoding set correctly, Python will interpret it correctly and
267
         * we'll have our unicode docstrings. It's not as ugly a hack as it sounds,
268
         * you just have to remember that C and Python strings can both be
269
         * considered 8-bit strings of binary data that can be later interpreted as
270
         * a text string in a particular text encoding.
271
         */
272
        //QCString utfTranslated = translated.utf8();
9535 fschmid 273
        QByteArray trch = translated.toUtf8();
1559 craig 274
        char* utfstr = strdup(trch.data());
275
        if (!utfstr)
276
                // Complain, but then return NULL anyway. Python will treat NULL as
277
                // "no value" so that's fine.
278
                qDebug("scriptplugin.cpp:tr() - strdup() failure");
279
        return utfstr;
853 subik 280
}
281
 
899 cbradney 282
/* Now we're using the more pythonic convention for names:
283
 * class - ClassName
284
 * procedure/function/method - procedureName
285
 * etc. */
853 subik 286
PyMethodDef scribus_methods[] = {
421 Franz 287
        // 2004/10/03 pv - aliases with common Python syntax - ClassName methodName
655 fschmid 288
        // 2004-11-06 cr - move aliasing to dynamically generated wrapper functions, sort methoddef
19563 craig 289
        {const_cast<char*>("applyMasterPage"), scribus_applymasterpage, METH_VARARGS, tr(scribus_applymasterpage__doc__)},
934 subik 290
        {const_cast<char*>("changeColor"), scribus_setcolor, METH_VARARGS, tr(scribus_setcolor__doc__)},
22212 jghali 291
        {const_cast<char*>("changeColorLab"), scribus_setcolorlab, METH_VARARGS, tr(scribus_setcolorlab__doc__) },
14804 jghali 292
        {const_cast<char*>("changeColorRGB"), scribus_setcolorrgb, METH_VARARGS, tr(scribus_setcolorrgb__doc__)},
22212 jghali 293
        {const_cast<char*>("changeColorRGBFloat"), scribus_setcolorrgbfloat, METH_VARARGS, tr(scribus_setcolorrgbfloat__doc__)},
14804 jghali 294
        {const_cast<char*>("changeColorCMYK"), scribus_setcolorcmyk, METH_VARARGS, tr(scribus_setcolorcmyk__doc__)},
22212 jghali 295
        {const_cast<char*>("changeColorCMYKFloat"), scribus_setcolorcmykfloat, METH_VARARGS, tr(scribus_setcolorcmykfloat__doc__)},
934 subik 296
        {const_cast<char*>("closeDoc"), (PyCFunction)scribus_closedoc, METH_NOARGS, tr(scribus_closedoc__doc__)},
4062 craig 297
        {const_cast<char*>("closeMasterPage"), (PyCFunction)scribus_closemasterpage, METH_NOARGS, tr(scribus_closemasterpage__doc__)},
934 subik 298
        {const_cast<char*>("createBezierLine"), scribus_bezierline, METH_VARARGS, tr(scribus_bezierline__doc__)},
299
        {const_cast<char*>("createEllipse"), scribus_newellipse, METH_VARARGS, tr(scribus_newellipse__doc__)},
300
        {const_cast<char*>("createImage"), scribus_newimage, METH_VARARGS, tr(scribus_newimage__doc__)},
301
        {const_cast<char*>("createLayer"), scribus_createlayer, METH_VARARGS, tr(scribus_createlayer__doc__)},
302
        {const_cast<char*>("createLine"), scribus_newline, METH_VARARGS, tr(scribus_newline__doc__)},
4062 craig 303
        {const_cast<char*>("createMasterPage"), scribus_createmasterpage, METH_VARARGS, tr(scribus_createmasterpage__doc__)},
934 subik 304
        {const_cast<char*>("createPathText"), scribus_pathtext, METH_VARARGS, tr(scribus_pathtext__doc__)},
305
        {const_cast<char*>("createPolygon"), scribus_polygon, METH_VARARGS, tr(scribus_polygon__doc__)},
306
        {const_cast<char*>("createPolyLine"), scribus_polyline, METH_VARARGS, tr(scribus_polyline__doc__)},
307
        {const_cast<char*>("createRect"), scribus_newrect, METH_VARARGS, tr(scribus_newrect__doc__)},
23433 jghali 308
        {const_cast<char*>("createTable"), scribus_newtable, METH_VARARGS, tr(scribus_newtable__doc__)},
934 subik 309
        {const_cast<char*>("createText"), scribus_newtext, METH_VARARGS, tr(scribus_newtext__doc__)},
23278 jghali 310
        {const_cast<char*>("createParagraphStyle"), (PyCFunction)scribus_createparagraphstyle, METH_VARARGS|METH_KEYWORDS, tr(scribus_createparagraphstyle__doc__)},
311
        {const_cast<char*>("createCharStyle"), (PyCFunction)scribus_createcharstyle, METH_VARARGS|METH_KEYWORDS, tr(scribus_createcharstyle__doc__)},
22205 jghali 312
        {const_cast<char*>("createCustomLineStyle"), scribus_createcustomlinestyle, METH_VARARGS, tr(scribus_createcustomlinestyle__doc__)},
23385 jghali 313
        {const_cast<char*>("currentPage"), (PyCFunction)scribus_currentpage, METH_NOARGS, tr(scribus_currentpage__doc__)},
934 subik 314
        {const_cast<char*>("defineColor"), scribus_newcolor, METH_VARARGS, tr(scribus_newcolor__doc__)},
22212 jghali 315
        {const_cast<char*>("defineColorLab"), scribus_newcolorlab, METH_VARARGS, tr(scribus_newcolorlab__doc__) },
14804 jghali 316
        {const_cast<char*>("defineColorRGB"), scribus_newcolorrgb, METH_VARARGS, tr(scribus_newcolorrgb__doc__)},
22212 jghali 317
        {const_cast<char*>("defineColorRGBFloat"), scribus_newcolorrgb, METH_VARARGS, tr(scribus_newcolorrgbfloat__doc__)},
14804 jghali 318
        {const_cast<char*>("defineColorCMYK"), scribus_newcolorcmyk, METH_VARARGS, tr(scribus_newcolorcmyk__doc__)},
22212 jghali 319
        {const_cast<char*>("defineColorCMYKFloat"), scribus_newcolorcmykfloat, METH_VARARGS, tr(scribus_newcolorcmykfloat__doc__)},
23433 jghali 320
        {const_cast<char*>("dehyphenateText"), scribus_dehyphenatetext, METH_VARARGS, tr(scribus_dehyphenatetext__doc__)},
934 subik 321
        {const_cast<char*>("deleteColor"), scribus_delcolor, METH_VARARGS, tr(scribus_delcolor__doc__)},
322
        {const_cast<char*>("deleteLayer"), scribus_removelayer, METH_VARARGS, tr(scribus_removelayer__doc__)},
4064 craig 323
        {const_cast<char*>("deleteMasterPage"), scribus_deletemasterpage, METH_VARARGS, tr(scribus_deletemasterpage__doc__)},
934 subik 324
        {const_cast<char*>("deleteObject"), scribus_deleteobj, METH_VARARGS, tr(scribus_deleteobj__doc__)},
325
        {const_cast<char*>("deletePage"), scribus_deletepage, METH_VARARGS, tr(scribus_deletepage__doc__)},
326
        {const_cast<char*>("deleteText"), scribus_deletetext, METH_VARARGS, tr(scribus_deletetext__doc__)},
327
        {const_cast<char*>("deselectAll"), (PyCFunction)scribus_deselect, METH_NOARGS, tr(scribus_deselect__doc__)},
328
        {const_cast<char*>("docChanged"), scribus_docchanged, METH_VARARGS, tr(scribus_docchanged__doc__)},
4062 craig 329
        {const_cast<char*>("editMasterPage"), scribus_editmasterpage, METH_VARARGS, tr(scribus_editmasterpage__doc__)},
23427 jghali 330
        {const_cast<char*>("fileDialog"), (PyCFunction)scribus_filedialog, METH_VARARGS|METH_KEYWORDS, tr(scribus_filedialog__doc__)},
14947 jghali 331
        {const_cast<char*>("fileQuit"), scribus_filequit, METH_VARARGS, tr(scribus_filequit__doc__)},
15528 craig 332
        {const_cast<char*>("flipObject"), scribus_flipobject, METH_VARARGS, tr(scribus_flipobject__doc__)},
934 subik 333
        {const_cast<char*>("getActiveLayer"), (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
22064 jghali 334
        {const_cast<char*>("getAllObjects"), (PyCFunction)scribus_getallobj, METH_VARARGS|METH_KEYWORDS, tr(scribus_getallobj__doc__)},
23694 jghali 335
        {const_cast<char*>("getAllStyles"), (PyCFunction)scribus_getparagraphstyles, METH_NOARGS, tr(scribus_getallstyles__doc__)}, //Deprecated
23622 jghali 336
        {const_cast<char*>("getAllText"), scribus_getalltext, METH_VARARGS, tr(scribus_getalltext__doc__)},
16856 craig 337
        {const_cast<char*>("getCellStyle"), scribus_getcellstyle, METH_VARARGS, tr(scribus_getcellstyle__doc__)},
338
        {const_cast<char*>("getCellColumnSpan"), scribus_getcellcolumnspan, METH_VARARGS, tr(scribus_getcellcolumnspan__doc__)},
339
        {const_cast<char*>("getCellRowSpan"), scribus_getcellrowspan, METH_VARARGS, tr(scribus_getcellrowspan__doc__)},
340
        {const_cast<char*>("getCellFillColor"), scribus_getcellfillcolor, METH_VARARGS, tr(scribus_getcellfillcolor__doc__)},
23687 jghali 341
        {const_cast<char*>("getCharacterStyle"), scribus_getcharacterstyle, METH_VARARGS, tr(scribus_getcharacterstyle__doc__) },
23686 jghali 342
        {const_cast<char*>("getCharStyles"), (PyCFunction)scribus_getcharstylenames, METH_NOARGS, tr(scribus_getcharstylenames__doc__)},
934 subik 343
        {const_cast<char*>("getColorNames"), (PyCFunction)scribus_colornames, METH_NOARGS, tr(scribus_colornames__doc__)},
344
        {const_cast<char*>("getColor"), scribus_getcolor, METH_VARARGS, tr(scribus_getcolor__doc__)},
22212 jghali 345
        {const_cast<char*>("getColorFloat"), scribus_getcolorfloat, METH_VARARGS, tr(scribus_getcolorfloat__doc__)},
1517 craig 346
        {const_cast<char*>("getColorAsRGB"), scribus_getcolorasrgb, METH_VARARGS, tr(scribus_getcolorasrgb__doc__)},
22212 jghali 347
        {const_cast<char*>("getColorAsRGBFloat"), scribus_getcolorasrgbfloat, METH_VARARGS, tr(scribus_getcolorasrgbfloat__doc__)},
13057 subik 348
        {const_cast<char*>("isSpotColor"), scribus_isspotcolor, METH_VARARGS, tr(scribus_isspotcolor__doc__)},
934 subik 349
        {const_cast<char*>("getColumnGap"), scribus_getcolumngap, METH_VARARGS, tr(scribus_getcolumngap__doc__)},
350
        {const_cast<char*>("getColumns"), scribus_getcolumns, METH_VARARGS, tr(scribus_getcolumns__doc__)},
351
        {const_cast<char*>("getCornerRadius"), scribus_getcornerrad, METH_VARARGS, tr(scribus_getcornerrad__doc__)},
22205 jghali 352
        {const_cast<char*>("getCustomLineStyle"), scribus_getcustomlinestyle, METH_VARARGS, tr(scribus_getcustomlinestyle__doc__)},
23433 jghali 353
        {const_cast<char*>("getDocName"), (PyCFunction)scribus_getdocname, METH_NOARGS, tr(scribus_getdocname__doc__)},
934 subik 354
        {const_cast<char*>("getFillColor"), scribus_getfillcolor, METH_VARARGS, tr(scribus_getfillcolor__doc__)},
23433 jghali 355
        {const_cast<char*>("getFillBlendmode"), scribus_getfillblend, METH_VARARGS, tr(scribus_getfillblend__doc__)},
934 subik 356
        {const_cast<char*>("getFillShade"), scribus_getfillshade, METH_VARARGS, tr(scribus_getfillshade__doc__)},
5887 fschmid 357
        {const_cast<char*>("getFillTransparency"), scribus_getfilltrans, METH_VARARGS, tr(scribus_getfilltrans__doc__)},
23433 jghali 358
        {const_cast<char*>("getFont"), scribus_getfont, METH_VARARGS, tr(scribus_getfont__doc__)},
359
        {const_cast<char*>("getFontFeatures"), scribus_getfontfeatures, METH_VARARGS, tr(scribus_getfontfeatures__doc__)},
934 subik 360
        {const_cast<char*>("getFontNames"), (PyCFunction)scribus_fontnames, METH_NOARGS, tr(scribus_fontnames__doc__)},
361
        {const_cast<char*>("getFontSize"), scribus_getfontsize, METH_VARARGS, tr(scribus_getfontsize__doc__)},
23647 jghali 362
        {const_cast<char*>("getFrameText"), scribus_getframetext, METH_VARARGS, tr(scribus_getframetext__doc__)},
934 subik 363
        {const_cast<char*>("getGuiLanguage"), (PyCFunction)scribus_getlanguage, METH_NOARGS, tr(scribus_getlanguage__doc__)},
364
        {const_cast<char*>("getHGuides"), (PyCFunction)scribus_getHguides, METH_NOARGS, tr(scribus_getHguides__doc__)},
22775 jghali 365
        {const_cast<char*>("getImageColorSpace"), scribus_getimagecolorspace, METH_VARARGS, tr(scribus_getimagecolorspace__doc__) },
21512 gpittman 366
        {const_cast<char*>("getImageFile"), scribus_getimagefile, METH_VARARGS, tr(scribus_getimagefile__doc__)},
23385 jghali 367
        {const_cast<char*>("getImageOffset"), scribus_getimageoffset, METH_VARARGS, tr(scribus_getimageoffset__doc__)},
368
        {const_cast<char*>("getImageScale"), scribus_getimagescale, METH_VARARGS, tr(scribus_getimagescale__doc__)},
934 subik 369
        {const_cast<char*>("getLayers"), (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__doc__)},
23427 jghali 370
        {const_cast<char*>("getLayerBlendmode"), scribus_getlayerblendmode, METH_VARARGS, tr(scribus_getlayerblendmode__doc__)},
371
        {const_cast<char*>("getLayerTransparency"), scribus_getlayertransparency, METH_VARARGS, tr(scribus_getlayertransparency__doc__)},
15494 craig 372
        {const_cast<char*>("getLineCap"), scribus_getlinecap, METH_VARARGS, tr(scribus_getlinecap__doc__)},
934 subik 373
        {const_cast<char*>("getLineColor"), scribus_getlinecolor, METH_VARARGS, tr(scribus_getlinecolor__doc__)},
11528 jghali 374
        {const_cast<char*>("getLineShade"), scribus_getlineshade, METH_VARARGS, tr(scribus_getlineshade__doc__)},
375
        {const_cast<char*>("getLineBlendmode"), scribus_getlineblend, METH_VARARGS, tr(scribus_getlineblend__doc__)},
376
        {const_cast<char*>("getLineTransparency"), scribus_getlinetrans, METH_VARARGS, tr(scribus_getlinetrans__doc__)},
934 subik 377
        {const_cast<char*>("getLineJoin"), scribus_getlinejoin, METH_VARARGS, tr(scribus_getlinejoin__doc__)},
378
        {const_cast<char*>("getLineSpacing"), scribus_getlinespace, METH_VARARGS, tr(scribus_getlinespace__doc__)},
379
        {const_cast<char*>("getLineStyle"), scribus_getlinestyle, METH_VARARGS, tr(scribus_getlinestyle__doc__)},
23695 jghali 380
        {const_cast<char*>("getLineStyles"), (PyCFunction)scribus_getlinestyles, METH_VARARGS, tr(scribus_getlinestyles__doc__)},
934 subik 381
        {const_cast<char*>("getLineWidth"), scribus_getlinewidth, METH_VARARGS, tr(scribus_getlinewidth__doc__)},
21268 craig 382
        {const_cast<char*>("getMasterPage"), scribus_getmasterpage, METH_VARARGS, tr(scribus_getmasterpage__doc__)},
934 subik 383
        {const_cast<char*>("getPageItems"), (PyCFunction)scribus_getpageitems, METH_NOARGS, tr(scribus_getpageitems__doc__)},
384
        {const_cast<char*>("getPageMargins"), (PyCFunction)scribus_getpagemargins, METH_NOARGS, tr(scribus_getpagemargins__doc__)},
23385 jghali 385
        {const_cast<char*>("getPageType"), (PyCFunction)scribus_getpagetype, METH_VARARGS, tr(scribus_getpagetype__doc__)},
14142 cbradney 386
        {const_cast<char*>("getPageSize"), (PyCFunction)scribus_pagedimension, METH_NOARGS, tr(scribus_pagedimension__doc__)},
23385 jghali 387
        {const_cast<char*>("getPageNSize"), scribus_getpagensize, METH_VARARGS, tr(scribus_getpagensize__doc__)},
388
        {const_cast<char*>("getPageNMargins"), scribus_getpagenmargins, METH_VARARGS, tr(scribus_getpagenmargins__doc__)},
23686 jghali 389
        {const_cast<char*>("getParagraphStyle"), scribus_getparagraphstyle, METH_VARARGS, tr(scribus_getparagraphstyle__doc__) },
23694 jghali 390
        {const_cast<char*>("getParagraphStyles"), (PyCFunction)scribus_getparagraphstyles, METH_NOARGS, tr(scribus_getparagraphstyles__doc__)},
23385 jghali 391
        {const_cast<char*>("getPosition"), scribus_getposition, METH_VARARGS, tr(scribus_getposition__doc__)},
934 subik 392
        {const_cast<char*>("getRotation"), scribus_getrotation, METH_VARARGS, tr(scribus_getrotation__doc__)},
14940 jghali 393
        {const_cast<char*>("getObjectType"), scribus_getobjecttype, METH_VARARGS, tr(scribus_getobjecttype__doc__)},
21858 jghali 394
        {const_cast<char*>("getObjectAttributes"), scribus_getobjectattributes, METH_VARARGS, tr(scribus_getobjectattributes__doc__)},
934 subik 395
        {const_cast<char*>("getSelectedObject"), scribus_getselobjnam, METH_VARARGS, tr(scribus_getselobjnam__doc__)},
396
        {const_cast<char*>("getSize"), scribus_getsize, METH_VARARGS, tr(scribus_getsize__doc__)},
23686 jghali 397
        {const_cast<char*>("getStyle"), scribus_getparagraphstyle, METH_VARARGS, tr(scribus_getstyle__doc__) }, // Deprecated
16856 craig 398
        {const_cast<char*>("getTableRows"), scribus_gettablerows, METH_VARARGS, tr(scribus_gettablerows__doc__)},
399
        {const_cast<char*>("getTableRowHeight"), scribus_gettablerowheight, METH_VARARGS, tr(scribus_gettablerowheight__doc__)},
400
        {const_cast<char*>("getTableColumns"), scribus_gettablecolumns, METH_VARARGS, tr(scribus_gettablecolumns__doc__)},
401
        {const_cast<char*>("getTableColumnWidth"), scribus_gettablecolumnwidth, METH_VARARGS, tr(scribus_gettablecolumnwidth__doc__)},
402
        {const_cast<char*>("getTableStyle"), scribus_gettablestyle, METH_VARARGS, tr(scribus_gettablestyle__doc__)},
403
        {const_cast<char*>("getTableFillColor"), scribus_gettablefillcolor, METH_VARARGS, tr(scribus_gettablefillcolor__doc__)},
23647 jghali 404
        {const_cast<char*>("getText"), scribus_getframetext, METH_VARARGS, tr(scribus_gettext__doc__)}, // Deprecated
22784 jghali 405
        {const_cast<char*>("getTextColor"), scribus_gettextcolor, METH_VARARGS, tr(scribus_gettextcolor__doc__)},
23647 jghali 406
        {const_cast<char*>("getTextDistances"), scribus_gettextdistances, METH_VARARGS, tr(scribus_gettextdistances__doc__)},
23691 jghali 407
        {const_cast<char*>("getTextFlowMode"), scribus_gettextflowmode, METH_VARARGS, tr(scribus_gettextflowmode__doc__)},
23622 jghali 408
        {const_cast<char*>("getTextLength"), scribus_gettextlength, METH_VARARGS, tr(scribus_gettextlength__doc__)},
6298 fschmid 409
        {const_cast<char*>("getTextLines"), scribus_gettextlines, METH_VARARGS, tr(scribus_gettextlines__doc__)},
22784 jghali 410
        {const_cast<char*>("getTextShade"), scribus_gettextshade, METH_VARARGS, tr(scribus_gettextshade__doc__)},
22731 jghali 411
        {const_cast<char*>("getTextVerticalAlignment"), scribus_gettextverticalalignment, METH_VARARGS, tr(scribus_gettextverticalalignment__doc__)},
934 subik 412
        {const_cast<char*>("getUnit"), (PyCFunction)scribus_getunit, METH_NOARGS, tr(scribus_getunit__doc__)},
413
        {const_cast<char*>("getVGuides"), (PyCFunction)scribus_getVguides, METH_NOARGS, tr(scribus_getVguides__doc__)},
414
        {const_cast<char*>("getXFontNames"), (PyCFunction)scribus_xfontnames, METH_NOARGS, tr(scribus_xfontnames__doc__)},
415
        {const_cast<char*>("gotoPage"), scribus_gotopage, METH_VARARGS, tr(scribus_gotopage__doc__)},
14714 jghali 416
        {const_cast<char*>("groupObjects"), (PyCFunction)scribus_groupobj, METH_VARARGS, tr(scribus_groupobj__doc__)},
934 subik 417
        {const_cast<char*>("haveDoc"), (PyCFunction)scribus_havedoc, METH_NOARGS, tr(scribus_havedoc__doc__)},
23433 jghali 418
        {const_cast<char*>("hyphenateText"), scribus_hyphenatetext, METH_VARARGS, tr(scribus_hyphenatetext__doc__)},
22850 jghali 419
        {const_cast<char*>("importPage"), scribus_importpage, METH_VARARGS, tr(scribus_importpage__doc__)},
16856 craig 420
        {const_cast<char*>("insertTableRows"), scribus_inserttablerows, METH_VARARGS, tr(scribus_inserttablerows__doc__)},
421
        {const_cast<char*>("insertTableColumns"), scribus_inserttablecolumns, METH_VARARGS, tr(scribus_inserttablecolumns__doc__)},
934 subik 422
        {const_cast<char*>("insertText"), scribus_inserttext, METH_VARARGS, tr(scribus_inserttext__doc__)},
17795 jghali 423
        {const_cast<char*>("insertHtmlText"), scribus_inserthtmltext, METH_VARARGS, tr(scribus_inserthtmltext__doc__)},
23427 jghali 424
        {const_cast<char*>("isLayerFlow"), scribus_islayerflow, METH_VARARGS, tr(scribus_islayerflow__doc__)},
425
        {const_cast<char*>("isLayerOutlined"), scribus_islayeroutlined, METH_VARARGS, tr(scribus_islayeroutlined__doc__)},
426
        {const_cast<char*>("isLayerLocked"), scribus_islayerlocked, METH_VARARGS, tr(scribus_islayerlocked__doc__)},
427
        {const_cast<char*>("isLayerPrintable"), scribus_islayerprintable, METH_VARARGS, tr(scribus_islayerprintable__doc__)},
428
        {const_cast<char*>("isLayerVisible"), scribus_islayervisible, METH_VARARGS, tr(scribus_islayervisible__doc__)},
934 subik 429
        {const_cast<char*>("isLocked"), scribus_islocked, METH_VARARGS, tr(scribus_islocked__doc__)},
23332 jghali 430
        {const_cast<char*>("layoutText"), scribus_layouttext, METH_VARARGS, tr(scribus_layouttext__doc__)},
23339 jghali 431
        {const_cast<char*>("layoutTextChain"), scribus_layouttextchain, METH_VARARGS, tr(scribus_layouttextchain__doc__)},
934 subik 432
        {const_cast<char*>("linkTextFrames"), scribus_linktextframes, METH_VARARGS, tr(scribus_linktextframes__doc__)},
433
        {const_cast<char*>("loadImage"), scribus_loadimage, METH_VARARGS, tr(scribus_loadimage__doc__)},
434
        {const_cast<char*>("loadStylesFromFile"), scribus_loadstylesfromfile, METH_VARARGS, tr(scribus_loadstylesfromfile__doc__)},
435
        {const_cast<char*>("lockObject"), scribus_lockobject, METH_VARARGS, tr(scribus_lockobject__doc__)},
4062 craig 436
        {const_cast<char*>("masterPageNames"), (PyCFunction)scribus_masterpagenames, METH_NOARGS, tr(scribus_masterpagenames__doc__)},
16856 craig 437
        {const_cast<char*>("mergeTableCells"), scribus_mergetablecells, METH_VARARGS, tr(scribus_mergetablecells__doc__)},
934 subik 438
        {const_cast<char*>("messagebarText"), scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
23427 jghali 439
        {const_cast<char*>("messageBox"), (PyCFunction)scribus_messagebox, METH_VARARGS|METH_KEYWORDS, tr(scribus_messagebox__doc__)},
934 subik 440
        {const_cast<char*>("moveObjectAbs"), scribus_moveobjabs, METH_VARARGS, tr(scribus_moveobjabs__doc__)},
441
        {const_cast<char*>("moveObject"), scribus_moveobjrel, METH_VARARGS, tr(scribus_moveobjrel__doc__)},
22654 jghali 442
        {const_cast<char*>("moveSelectionToBack"), (PyCFunction)scribus_moveselectiontoback, METH_NOARGS, tr(scribus_moveselectiontoback__doc__) },
443
        {const_cast<char*>("moveSelectionToFront"), (PyCFunction)scribus_moveselectiontofront, METH_NOARGS, tr(scribus_moveselectiontofront__doc__) },
23427 jghali 444
        {const_cast<char*>("newDocDialog"), (PyCFunction)scribus_newdocdialog, METH_NOARGS, tr(scribus_newdocdialog__doc__)},
934 subik 445
        {const_cast<char*>("newDoc"), scribus_newdoc, METH_VARARGS, tr(scribus_newdoc__doc__)},
3647 subik 446
        {const_cast<char*>("newDocument"), scribus_newdocument, METH_VARARGS, tr(scribus_newdocument__doc__)},
934 subik 447
        {const_cast<char*>("newPage"), scribus_newpage, METH_VARARGS, tr(scribus_newpage__doc__)},
3017 subik 448
        {const_cast<char*>("newStyleDialog"), scribus_newstyledialog, METH_NOARGS, tr(scribus_newstyledialog__doc__)},
934 subik 449
        {const_cast<char*>("objectExists"),scribus_objectexists, METH_VARARGS, tr(scribus_objectexists__doc__)},
450
        {const_cast<char*>("openDoc"), scribus_opendoc, METH_VARARGS, tr(scribus_opendoc__doc__)},
23430 jghali 451
        {const_cast<char*>("outlineText"), scribus_outlinetext, METH_VARARGS, tr(scribus_outlinetext__doc__)},
934 subik 452
        {const_cast<char*>("pageCount"), (PyCFunction)scribus_pagecount, METH_NOARGS, tr(scribus_pagecount__doc__)},
7440 subik 453
        {const_cast<char*>("pageDimension"), (PyCFunction)scribus_pagedimension, METH_NOARGS, "Obsolete function. Don't use it."},
22850 jghali 454
        {const_cast<char*>("placeEPS"), scribus_placevec, METH_VARARGS, tr(scribus_placeeps__doc__)},
455
        {const_cast<char*>("placeODG"), scribus_placevec, METH_VARARGS, tr(scribus_placeodg__doc__)},
456
        {const_cast<char*>("placeSVG"), scribus_placevec, METH_VARARGS, tr(scribus_placesvg__doc__)},
457
        {const_cast<char*>("placeSXD"), scribus_placevec, METH_VARARGS, tr(scribus_placesxd__doc__)},
458
        {const_cast<char*>("placeVectorFile"), scribus_placevec, METH_VARARGS, tr(scribus_placevec__doc__)},
934 subik 459
        {const_cast<char*>("progressReset"), (PyCFunction)scribus_progressreset, METH_NOARGS, tr(scribus_progressreset__doc__)},
460
        {const_cast<char*>("progressSet"), scribus_progresssetprogress, METH_VARARGS, tr(scribus_progresssetprogress__doc__)},
461
        {const_cast<char*>("progressTotal"), scribus_progresssettotalsteps, METH_VARARGS, tr(scribus_progresssettotalsteps__doc__)},
19459 jghali 462
        {const_cast<char*>("readPDFOptions"), (PyCFunction)scribus_readpdfoptions, METH_VARARGS, tr(scribus_readpdfoptions__doc__)},
934 subik 463
        {const_cast<char*>("redrawAll"), (PyCFunction)scribus_redraw, METH_NOARGS, tr(scribus_redraw__doc__)},
16856 craig 464
        {const_cast<char*>("removeTableRows"), scribus_removetablerows, METH_VARARGS, tr(scribus_removetablerows__doc__)},
465
        {const_cast<char*>("removeTableColumns"), scribus_removetablecolumns, METH_VARARGS, tr(scribus_removetablecolumns__doc__)},
23278 jghali 466
        {const_cast<char*>("renderFont"), (PyCFunction)scribus_renderfont, METH_VARARGS|METH_KEYWORDS, tr(scribus_renderfont__doc__)},
934 subik 467
        {const_cast<char*>("replaceColor"), scribus_replcolor, METH_VARARGS, tr(scribus_replcolor__doc__)},
16856 craig 468
        {const_cast<char*>("resizeTableColumn"), scribus_resizetablecolumn, METH_VARARGS, tr(scribus_resizetablecolumn__doc__)},
469
        {const_cast<char*>("resizeTableRow"), scribus_resizetablerow, METH_VARARGS, tr(scribus_resizetablerow__doc__)},
23380 jghali 470
        {const_cast<char*>("revertDoc"), (PyCFunction)scribus_revertdoc, METH_NOARGS, tr(scribus_revertdoc__doc__)},
934 subik 471
        {const_cast<char*>("rotateObjectAbs"), scribus_rotobjabs, METH_VARARGS, tr(scribus_rotobjabs__doc__)},
472
        {const_cast<char*>("rotateObject"), scribus_rotobjrel, METH_VARARGS, tr(scribus_rotobjrel__doc__)},
23380 jghali 473
        {const_cast<char*>("saveDoc"), (PyCFunction)scribus_savedoc, METH_NOARGS, tr(scribus_savedoc__doc__)},
934 subik 474
        {const_cast<char*>("saveDocAs"), scribus_savedocas, METH_VARARGS, tr(scribus_savedocas__doc__)},
475
        {const_cast<char*>("savePageAsEPS"), scribus_savepageeps, METH_VARARGS, tr(scribus_savepageeps__doc__)},
19459 jghali 476
        {const_cast<char*>("savePDFOptions"), (PyCFunction)scribus_savepdfoptions, METH_VARARGS, tr(scribus_savepdfoptions__doc__)},
934 subik 477
        {const_cast<char*>("scaleGroup"), scribus_scalegroup, METH_VARARGS, tr(scribus_scalegroup__doc__)},
478
        {const_cast<char*>("scaleImage"), scribus_scaleimage, METH_VARARGS, tr(scribus_scaleimage__doc__)},
14822 cbradney 479
        {const_cast<char*>("setImageBrightness"), scribus_setimagebrightness, METH_VARARGS, tr(scribus_setimagebrightness__doc__)},
480
        {const_cast<char*>("setImageGrayscale"), scribus_setimagegrayscale, METH_VARARGS, tr(scribus_setimagegrayscale__doc__)},
13077 jghali 481
        {const_cast<char*>("setImageScale"), scribus_setimagescale, METH_VARARGS, tr(scribus_setimagescale__doc__)},
14822 cbradney 482
        {const_cast<char*>("setImageOffset"), scribus_setimageoffset, METH_VARARGS, tr(scribus_setimageoffset__doc__)},
934 subik 483
        {const_cast<char*>("selectionCount"), (PyCFunction)scribus_selcount, METH_NOARGS, tr(scribus_selcount__doc__)},
484
        {const_cast<char*>("selectObject"), scribus_selectobj, METH_VARARGS, tr(scribus_selectobj__doc__)},
485
        {const_cast<char*>("selectText"), scribus_selecttext, METH_VARARGS, tr(scribus_selecttext__doc__)},
486
        {const_cast<char*>("sentToLayer"), scribus_senttolayer, METH_VARARGS, tr(scribus_senttolayer__doc__)},
23427 jghali 487
        {const_cast<char*>("setActiveLayer"), scribus_setactivelayer, METH_VARARGS, tr(scribus_setactivelayer__doc__)},
1534 subik 488
        {const_cast<char*>("setPDFBookmark"), scribus_setpdfbookmark, METH_VARARGS, tr(scribus_setpdfbookmark__doc__)},
489
        {const_cast<char*>("isPDFBookmark"), scribus_ispdfbookmark, METH_VARARGS, tr(scribus_ispdfbookmark__doc__)},
12332 jghali 490
        {const_cast<char*>("setTextDistances"), scribus_settextdistances, METH_VARARGS, tr(scribus_settextdistances__doc__)},
16856 craig 491
        {const_cast<char*>("setCellStyle"), scribus_setcellstyle, METH_VARARGS, tr(scribus_setcellstyle__doc__)},
492
        {const_cast<char*>("setCellText"), scribus_setcelltext, METH_VARARGS, tr(scribus_setcelltext__doc__)},
493
        {const_cast<char*>("setCellFillColor"), scribus_setcellfillcolor, METH_VARARGS, tr(scribus_setcellfillcolor__doc__)},
494
        {const_cast<char*>("setCellLeftBorder"), scribus_setcellleftborder, METH_VARARGS, tr(scribus_setcellleftborder__doc__)},
495
        {const_cast<char*>("setCellLeftPadding"), scribus_setcellleftpadding, METH_VARARGS, tr(scribus_setcellleftpadding__doc__)},
496
        {const_cast<char*>("setCellRightBorder"), scribus_setcellrightborder, METH_VARARGS, tr(scribus_setcellrightborder__doc__)},
497
        {const_cast<char*>("setCellRightPadding"), scribus_setcellrightpadding, METH_VARARGS, tr(scribus_setcellrightpadding__doc__)},
498
        {const_cast<char*>("setCellTopBorder"), scribus_setcelltopborder, METH_VARARGS, tr(scribus_setcelltopborder__doc__)},
499
        {const_cast<char*>("setCellTopPadding"), scribus_setcelltoppadding, METH_VARARGS, tr(scribus_setcelltoppadding__doc__)},
500
        {const_cast<char*>("setCellBottomBorder"), scribus_setcellbottomborder, METH_VARARGS, tr(scribus_setcellbottomborder__doc__)},
501
        {const_cast<char*>("setCellBottomPadding"), scribus_setcellbottompadding, METH_VARARGS, tr(scribus_setcellbottompadding__doc__)},
934 subik 502
        {const_cast<char*>("setColumnGap"), scribus_setcolumngap, METH_VARARGS, tr(scribus_setcolumngap__doc__)},
503
        {const_cast<char*>("setColumns"), scribus_setcolumns, METH_VARARGS, tr(scribus_setcolumns__doc__)},
23427 jghali 504
        {const_cast<char*>("setCornerRadius"), scribus_setcornerradius, METH_VARARGS, tr(scribus_setcornerradius__doc__)},
934 subik 505
        {const_cast<char*>("setCursor"), scribus_setcursor, METH_VARARGS, tr(scribus_setcursor__doc__)},
22205 jghali 506
        {const_cast<char*>("setCustomLineStyle"), scribus_setcustomlinestyle, METH_VARARGS, tr(scribus_setcustomlinestyle__doc__)},
934 subik 507
        {const_cast<char*>("setDocType"), scribus_setdoctype, METH_VARARGS, tr(scribus_setdoctype__doc__)},
508
        {const_cast<char*>("setFillColor"), scribus_setfillcolor, METH_VARARGS, tr(scribus_setfillcolor__doc__)},
5887 fschmid 509
        {const_cast<char*>("setFillTransparency"), scribus_setfilltrans, METH_VARARGS, tr(scribus_setfilltrans__doc__)},
510
        {const_cast<char*>("setFillBlendmode"), scribus_setfillblend, METH_VARARGS, tr(scribus_setfillblend__doc__)},
934 subik 511
        {const_cast<char*>("setFillShade"), scribus_setfillshade, METH_VARARGS, tr(scribus_setfillshade__doc__)},
512
        {const_cast<char*>("setFont"), scribus_setfont, METH_VARARGS, tr(scribus_setfont__doc__)},
21563 jghali 513
        {const_cast<char*>("setFontFeatures"), scribus_setfontfeatures, METH_VARARGS, tr(scribus_setfontfeatures__doc__)},
934 subik 514
        {const_cast<char*>("setFontSize"), scribus_setfontsize, METH_VARARGS, tr(scribus_setfontsize__doc__)},
515
        {const_cast<char*>("setGradientFill"), scribus_setgradfill, METH_VARARGS, tr(scribus_setgradfill__doc__)},
13182 jghali 516
        {const_cast<char*>("setGradientStop"), scribus_setgradstop, METH_VARARGS, tr(scribus_setgradstop__doc__)},
934 subik 517
        {const_cast<char*>("setHGuides"), scribus_setHguides, METH_VARARGS, tr(scribus_setHguides__doc__)},
518
        {const_cast<char*>("setInfo"), scribus_setinfo, METH_VARARGS, tr(scribus_setinfo__doc__)},
23427 jghali 519
        {const_cast<char*>("setLayerBlendmode"), scribus_setlayerblendmode, METH_VARARGS, tr(scribus_setlayerblendmode__doc__)},
520
        {const_cast<char*>("setLayerFlow"), scribus_setlayerflow, METH_VARARGS, tr(scribus_setlayerflow__doc__)},
521
        {const_cast<char*>("setLayerLocked"), scribus_setlayerlocked, METH_VARARGS, tr(scribus_setlayerlocked__doc__)},
522
        {const_cast<char*>("setLayerOutlined"), scribus_setlayeroutlined, METH_VARARGS, tr(scribus_setlayeroutlined__doc__)},
523
        {const_cast<char*>("setLayerPrintable"), scribus_setlayerprintable, METH_VARARGS, tr(scribus_setlayerprintable__doc__)},
524
        {const_cast<char*>("setLayerTransparency"), scribus_setlayertransparency, METH_VARARGS, tr(scribus_setlayertransparency__doc__)},
525
        {const_cast<char*>("setLayerVisible"), scribus_setlayervisible, METH_VARARGS, tr(scribus_setlayervisible__doc__)},
15494 craig 526
        {const_cast<char*>("setLineCap"), scribus_setlinecap, METH_VARARGS, tr(scribus_setlinecap__doc__)},
934 subik 527
        {const_cast<char*>("setLineColor"), scribus_setlinecolor, METH_VARARGS, tr(scribus_setlinecolor__doc__)},
5887 fschmid 528
        {const_cast<char*>("setLineTransparency"), scribus_setlinetrans, METH_VARARGS, tr(scribus_setlinetrans__doc__)},
529
        {const_cast<char*>("setLineBlendmode"), scribus_setlineblend, METH_VARARGS, tr(scribus_setlineblend__doc__)},
934 subik 530
        {const_cast<char*>("setLineJoin"), scribus_setlinejoin, METH_VARARGS, tr(scribus_setlinejoin__doc__)},
531
        {const_cast<char*>("setLineShade"), scribus_setlineshade, METH_VARARGS, tr(scribus_setlineshade__doc__)},
532
        {const_cast<char*>("setLineSpacing"), scribus_setlinespace, METH_VARARGS, tr(scribus_setlinespace__doc__)},
14427 jghali 533
        {const_cast<char*>("setLineSpacingMode"), scribus_setlinespacemode, METH_VARARGS, tr(scribus_setlinespacemode__doc__)},
934 subik 534
        {const_cast<char*>("setLineStyle"), scribus_setlinestyle, METH_VARARGS, tr(scribus_setlinestyle__doc__)},
535
        {const_cast<char*>("setLineWidth"), scribus_setlinewidth, METH_VARARGS, tr(scribus_setlinewidth__doc__)},
23599 craig 536
        {const_cast<char*>("setBleeds"), scribus_setbleeds, METH_VARARGS, tr(scribus_setbleeds__doc__)},
934 subik 537
        {const_cast<char*>("setMargins"), scribus_setmargins, METH_VARARGS, tr(scribus_setmargins__doc__)},
14427 jghali 538
        {const_cast<char*>("setBaseLine"), scribus_setbaseline, METH_VARARGS, tr(scribus_setbaseline__doc__)},
23369 jghali 539
        {const_cast<char*>("setItemName"), scribus_setitemname, METH_VARARGS, tr(scribus_setitemname__doc__)},
934 subik 540
        {const_cast<char*>("setMultiLine"), scribus_setmultiline, METH_VARARGS, tr(scribus_setmultiline__doc__)},
23369 jghali 541
        {const_cast<char*>("setNewName"), scribus_setitemname, METH_VARARGS, tr(scribus_setitemname__doc__)}, // Deprecated, was in fact never documented
21858 jghali 542
        {const_cast<char*>("setObjectAttributes"), scribus_setobjectattributes, METH_VARARGS, tr(scribus_setobjectattributes__doc__)},
934 subik 543
        {const_cast<char*>("setRedraw"), scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)},
22654 jghali 544
        {const_cast<char*>("scrollDocument"), scribus_scrolldocument, METH_VARARGS, tr(scribus_scrolldocument__doc__) },
22540 jghali 545
        {const_cast<char*>("setScaleFrameToImage"), (PyCFunction)scribus_setscaleframetoimage, METH_VARARGS, tr(scribus_setscaleframetoimage__doc__)},
23278 jghali 546
        {const_cast<char*>("setScaleImageToFrame"), (PyCFunction)scribus_setscaleimagetoframe, METH_VARARGS|METH_KEYWORDS, tr(scribus_setscaleimagetoframe__doc__)},
23686 jghali 547
        {const_cast<char*>("setStyle"), scribus_setparagraphstyle, METH_VARARGS, tr(scribus_setstyle__doc__)}, // Deprecated
22113 jghali 548
        {const_cast<char*>("setCharacterStyle"), scribus_setcharstyle, METH_VARARGS, tr(scribus_setcharstyle__doc__) },
23686 jghali 549
        {const_cast<char*>("setParagraphStyle"), scribus_setparagraphstyle, METH_VARARGS, tr(scribus_setparagraphstyle__doc__)},
23433 jghali 550
        {const_cast<char*>("setSpotColor"), scribus_setspotcolor, METH_VARARGS, tr(scribus_setspotcolor__doc__)},
16856 craig 551
        {const_cast<char*>("setTableStyle"), scribus_settablestyle, METH_VARARGS, tr(scribus_settablestyle__doc__)},
552
        {const_cast<char*>("setTableLeftBorder"), scribus_settableleftborder, METH_VARARGS, tr(scribus_settableleftborder__doc__)},
553
        {const_cast<char*>("setTableRightBorder"), scribus_settablerightborder, METH_VARARGS, tr(scribus_settablerightborder__doc__)},
554
        {const_cast<char*>("setTableTopBorder"), scribus_settabletopborder, METH_VARARGS, tr(scribus_settabletopborder__doc__)},
555
        {const_cast<char*>("setTableBottomBorder"), scribus_settablebottomborder, METH_VARARGS, tr(scribus_settablebottomborder__doc__)},
556
        {const_cast<char*>("setTableFillColor"), scribus_settablefillcolor, METH_VARARGS, tr(scribus_settablefillcolor__doc__)},
23622 jghali 557
        {const_cast<char*>("setText"), scribus_settext, METH_VARARGS, tr(scribus_settext__doc__)},
22731 jghali 558
        {const_cast<char*>("setTextAlignment"), scribus_setalignment, METH_VARARGS, tr(scribus_setalign__doc__)},
21563 jghali 559
        {const_cast<char*>("setTextDirection"), scribus_setdirection, METH_VARARGS, tr(scribus_setdirection__doc__)},
934 subik 560
        {const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)},
23690 jghali 561
        {const_cast<char*>("setTextFlowMode"), scribus_settextflowmode, METH_VARARGS, tr(scribus_settextflowmode__doc__)},
13199 jghali 562
        {const_cast<char*>("setTextScalingH"), scribus_settextscalingh, METH_VARARGS, tr(scribus_settextscalingh__doc__)},
563
        {const_cast<char*>("setTextScalingV"), scribus_settextscalingv, METH_VARARGS, tr(scribus_settextscalingv__doc__)},
934 subik 564
        {const_cast<char*>("setTextShade"), scribus_settextshade, METH_VARARGS, tr(scribus_settextshade__doc__)},
565
        {const_cast<char*>("setTextStroke"), scribus_settextstroke, METH_VARARGS, tr(scribus_settextstroke__doc__)},
22731 jghali 566
        {const_cast<char*>("setTextVerticalAlignment"), scribus_settextverticalalignment, METH_VARARGS, tr(scribus_settextverticalalignment__doc__)},
934 subik 567
        {const_cast<char*>("setUnit"), scribus_setunit, METH_VARARGS, tr(scribus_setunit__doc__)},
568
        {const_cast<char*>("setVGuides"), scribus_setVguides, METH_VARARGS, tr(scribus_setVguides__doc__)},
569
        {const_cast<char*>("sizeObject"), scribus_sizeobjabs, METH_VARARGS, tr(scribus_sizeobjabs__doc__)},
570
        {const_cast<char*>("statusMessage"), scribus_messagebartext, METH_VARARGS, tr(scribus_messagebartext__doc__)},
23690 jghali 571
        {const_cast<char*>("textFlowMode"), scribus_settextflowmode, METH_VARARGS, tr(scribus_textflowmode__doc__)}, // Deprecated
23278 jghali 572
        {const_cast<char*>("textOverflows"), (PyCFunction)scribus_istextoverflowing, METH_VARARGS|METH_KEYWORDS, tr(scribus_istextoverflowing__doc__) },
23430 jghali 573
        {const_cast<char*>("traceText"), scribus_outlinetext, METH_VARARGS, tr(scribus_tracetext__doc__)},
23438 jghali 574
        {const_cast<char*>("unGroupObject"), scribus_ungroupobj, METH_VARARGS, tr(scribus_ungroupobj__doc__)}, // Deprecated, now alias for unGroupObjects()
575
        {const_cast<char*>("unGroupObjects"), scribus_ungroupobj, METH_VARARGS, tr(scribus_ungroupobj__doc__)},
934 subik 576
        {const_cast<char*>("unlinkTextFrames"), scribus_unlinktextframes, METH_VARARGS, tr(scribus_unlinktextframes__doc__)},
23427 jghali 577
        {const_cast<char*>("valueDialog"), scribus_valuedialog, METH_VARARGS, tr(scribus_valuedialog__doc__)},
3926 subik 578
        {const_cast<char*>("zoomDocument"), scribus_zoomdocument, METH_VARARGS, tr(scribus_zoomdocument__doc__)},
1425 subik 579
        // Property magic
23278 jghali 580
        {const_cast<char*>("getPropertyCType"), (PyCFunction)scribus_propertyctype, METH_VARARGS|METH_KEYWORDS, tr(scribus_propertyctype__doc__)},
581
        {const_cast<char*>("getPropertyNames"), (PyCFunction)scribus_getpropertynames, METH_VARARGS|METH_KEYWORDS, tr(scribus_getpropertynames__doc__)},
582
        {const_cast<char*>("getProperty"), (PyCFunction)scribus_getproperty, METH_VARARGS|METH_KEYWORDS, tr(scribus_getproperty__doc__)},
583
        {const_cast<char*>("setProperty"), (PyCFunction)scribus_setproperty, METH_VARARGS|METH_KEYWORDS, tr(scribus_setproperty__doc__)},
584
//      {const_cast<char*>("getChildren"), (PyCFunction)scribus_getchildren, METH_VARARGS|METH_KEYWORDS, tr(scribus_getchildren__doc__)},
585
//      {const_cast<char*>("getChild"), (PyCFunction)scribus_getchild, METH_VARARGS|METH_KEYWORDS, tr(scribus_getchild__doc__)},
5997 subik 586
        // by Christian Hausknecht
587
        {const_cast<char*>("duplicateObject"), scribus_duplicateobject, METH_VARARGS, tr(scribus_duplicateobject__doc__)},
19332 gpittman 588
        {const_cast<char*>("copyObject"), scribus_copyobject, METH_VARARGS, tr(scribus_copyobject__doc__)},
589
        {const_cast<char*>("pasteObject"), scribus_pasteobject, METH_VARARGS, tr(scribus_pasteobject__doc__)},
22774 jghali 590
        // by Tj (hacker@iam.tj>
591
        {const_cast<char*>("combinePolygons"), (PyCFunction)scribus_combinepolygons, METH_NOARGS, tr(scribus_combinepolygons__doc__)},
1425 subik 592
        // Internal methods - Not for public use
5051 subik 593
        {const_cast<char*>("retval"), (PyCFunction)scribus_retval, METH_VARARGS, const_cast<char*>("Scribus internal.")},
934 subik 594
        {const_cast<char*>("getval"), (PyCFunction)scribus_getval, METH_NOARGS, const_cast<char*>("Scribus internal.")},
22049 jghali 595
        {const_cast<char*>("setLinkAnnotation"), scribus_setlinkannotation, METH_VARARGS,tr(scribus_setlinkannotation__doc__)},
596
        {const_cast<char*>("setFileAnnotation"), (PyCFunction)scribus_setfileannotation, METH_VARARGS|METH_KEYWORDS,tr(scribus_setfileannotation__doc__)},
597
        {const_cast<char*>("setURIAnnotation"), scribus_seturiannotation, METH_VARARGS,tr(scribus_seturiannotation__doc__)},
598
        {const_cast<char*>("setTextAnnotation"), scribus_settextannotation, METH_VARARGS,tr(scribus_settextannotation__doc__)},
599
        {const_cast<char*>("createPdfAnnotation"), scribus_createpdfannotation, METH_VARARGS,tr(scribus_createpdfannotation__doc__)},
600
        {const_cast<char*>("isAnnotated"),(PyCFunction)scribus_isannotated, METH_VARARGS|METH_KEYWORDS,tr(scribus_isannotated__doc__)},
22772 jghali 601
        {const_cast<char*>("setJSActionScript"), scribus_setjsactionscript, METH_VARARGS,tr(scribus_setjsactionscript__doc__)},
602
        {const_cast<char*>("getJSActionScript"), scribus_getjsactionscript, METH_VARARGS,tr(scribus_getjsactionscript__doc__)},
22606 craig 603
        {nullptr, (PyCFunction)(nullptr), 0, nullptr} /* sentinel */
82 Franz 604
};
605
 
23278 jghali 606
struct scribus_module_state
607
{
608
    PyObject *error;
609
};
610
#define GETSTATE(m) ((struct scribus_module_state*) PyModule_GetState(m))
611
 
612
static int scribus_extension_traverse(PyObject *m, visitproc visit, void *arg)
613
{
614
        Py_VISIT(GETSTATE(m)->error);
615
        return 0;
616
}
617
 
618
static int scribus_extension_clear(PyObject *m)
619
{
620
        Py_CLEAR(GETSTATE(m)->error);
621
        return 0;
622
}
623
 
624
static struct PyModuleDef scribus_module_def = {
625
        PyModuleDef_HEAD_INIT,
626
        "scribus",
627
        NULL,
628
        sizeof(struct scribus_module_state),
629
        scribus_methods,
630
        NULL,
631
        scribus_extension_traverse,
632
        scribus_extension_clear,
633
        NULL
634
};
635
 
2428 craig 636
void initscribus_failed(const char* fileName, int lineNo)
637
{
638
        qDebug("Scripter setup failed (%s:%i)", fileName, lineNo);
639
        if (PyErr_Occurred())
640
                PyErr_Print();
641
}
642
 
23278 jghali 643
PyObject* PyInit_scribus(void)
82 Franz 644
{
23278 jghali 645
        ScribusMainWindow* mainWin = ScCore->primaryMainWindow();
1747 craig 646
        if (!scripterCore)
647
        {
648
                qWarning("scriptplugin: Tried to init scribus module, but no scripter core. Aborting.");
23278 jghali 649
                return nullptr;
1747 craig 650
        }
23278 jghali 651
 
652
        int result;
82 Franz 653
        PyObject *m, *d;
11955 subik 654
 
411 Franz 655
        PyType_Ready(&Printer_Type);
418 Franz 656
        PyType_Ready(&PDFfile_Type);
1407 subik 657
        PyType_Ready(&ImageExport_Type);
23278 jghali 658
 
659
        m = PyModule_Create(&scribus_module_def);
660
 
411 Franz 661
        Py_INCREF(&Printer_Type);
23278 jghali 662
        result = PyModule_AddObject(m, (char*) "Printer", (PyObject *) &Printer_Type);
663
        if (result != 0)
664
                qDebug("scriptplugin: Could not create scribus.Printer module");
418 Franz 665
        Py_INCREF(&PDFfile_Type);
23278 jghali 666
        result = PyModule_AddObject(m, (char*) "PDFfile", (PyObject *) &PDFfile_Type);
667
        if (result != 0)
668
                qDebug("scriptplugin: Could not create scribus.PDFfile module");
1407 subik 669
        Py_INCREF(&ImageExport_Type);
23278 jghali 670
        PyModule_AddObject(m, (char*) "ImageExport", (PyObject *) &ImageExport_Type);
671
        if (result != 0)
672
                qDebug("scriptplugin: Could not create scribus.ImageExport module");
82 Franz 673
        d = PyModule_GetDict(m);
647 fschmid 674
 
675
        // Set up the module exceptions
676
        // common exc.
23278 jghali 677
        ScribusException = PyErr_NewException((char*) "scribus.ScribusException", nullptr, nullptr);
647 fschmid 678
        Py_INCREF(ScribusException);
23278 jghali 679
        PyModule_AddObject(m, (char*) "ScribusException", ScribusException);
647 fschmid 680
        // no doc open
23278 jghali 681
        NoDocOpenError = PyErr_NewException((char*) "scribus.NoDocOpenError", ScribusException, nullptr);
647 fschmid 682
        Py_INCREF(NoDocOpenError);
23278 jghali 683
        PyModule_AddObject(m, (char*) "NoDocOpenError", NoDocOpenError);
853 subik 684
        // wrong type of frame for operation
23278 jghali 685
        WrongFrameTypeError = PyErr_NewException((char*) "scribus.WrongFrameTypeError", ScribusException, nullptr);
853 subik 686
        Py_INCREF(WrongFrameTypeError);
23278 jghali 687
        PyModule_AddObject(m, (char*) "WrongFrameTypeError", WrongFrameTypeError);
853 subik 688
        // Couldn't find named object, or no named object and no selection
23278 jghali 689
        NoValidObjectError = PyErr_NewException((char*) "scribus.NoValidObjectError", ScribusException, nullptr);
853 subik 690
        Py_INCREF(NoValidObjectError);
23278 jghali 691
        PyModule_AddObject(m, (char*) "NoValidObjectError", NoValidObjectError);
899 cbradney 692
        // Couldn't find the specified resource - font, color, etc.
23278 jghali 693
        NotFoundError = PyErr_NewException((char*) "scribus.NotFoundError", ScribusException, nullptr);
899 cbradney 694
        Py_INCREF(NotFoundError);
23278 jghali 695
        PyModule_AddObject(m, (char*) "NotFoundError", NotFoundError);
899 cbradney 696
        // Tried to create an object with the same name as one that already exists
23278 jghali 697
        NameExistsError = PyErr_NewException((char*) "scribus.NameExistsError", ScribusException, nullptr);
899 cbradney 698
        Py_INCREF(NameExistsError);
23278 jghali 699
        PyModule_AddObject(m, (char*) "NameExistsError", NameExistsError);
647 fschmid 700
        // Done with exception setup
701
 
421 Franz 702
        // CONSTANTS
23278 jghali 703
        PyDict_SetItemString(d, const_cast<char*>("UNIT_POINTS"), PyLong_FromLong(unitIndexFromString("pt")));
704
        PyDict_SetItemString(d, const_cast<char*>("UNIT_MILLIMETERS"), PyLong_FromLong(unitIndexFromString("mm")));
705
        PyDict_SetItemString(d, const_cast<char*>("UNIT_INCHES"), PyLong_FromLong(unitIndexFromString("in")));
706
        PyDict_SetItemString(d, const_cast<char*>("UNIT_PICAS"), PyLong_FromLong(unitIndexFromString("p")));
707
        PyDict_SetItemString(d, const_cast<char*>("UNIT_CENTIMETRES"), PyLong_FromLong(unitIndexFromString("cm")));
708
        PyDict_SetItemString(d, const_cast<char*>("UNIT_CICERO"), PyLong_FromLong(unitIndexFromString("c")));
709
        PyDict_SetItemString(d, const_cast<char*>("UNIT_PT"), PyLong_FromLong(unitIndexFromString("pt")));
710
        PyDict_SetItemString(d, const_cast<char*>("UNIT_MM"), PyLong_FromLong(unitIndexFromString("mm")));
711
        PyDict_SetItemString(d, const_cast<char*>("UNIT_IN"), PyLong_FromLong(unitIndexFromString("in")));
712
        PyDict_SetItemString(d, const_cast<char*>("UNIT_P"), PyLong_FromLong(unitIndexFromString("p")));
713
        PyDict_SetItemString(d, const_cast<char*>("UNIT_CM"), PyLong_FromLong(unitIndexFromString("cm")));
714
        PyDict_SetItemString(d, const_cast<char*>("UNIT_C"), PyLong_FromLong(unitIndexFromString("c")));
3071 subik 715
        PyDict_SetItemString(d, const_cast<char*>("PORTRAIT"), Py_BuildValue(const_cast<char*>("i"), portraitPage));
716
        PyDict_SetItemString(d, const_cast<char*>("LANDSCAPE"), Py_BuildValue(const_cast<char*>("i"), landscapePage));
934 subik 717
        PyDict_SetItemString(d, const_cast<char*>("NOFACINGPAGES"), Py_BuildValue(const_cast<char*>("i"), 0));
718
        PyDict_SetItemString(d, const_cast<char*>("FACINGPAGES"),  Py_BuildValue(const_cast<char*>("i"), 1));
3439 subik 719
        PyDict_SetItemString(d, const_cast<char*>("FIRSTPAGERIGHT"), Py_BuildValue(const_cast<char*>("i"), 1));
720
        PyDict_SetItemString(d, const_cast<char*>("FIRSTPAGELEFT"), Py_BuildValue(const_cast<char*>("i"), 0));
934 subik 721
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_LEFT"), Py_BuildValue(const_cast<char*>("i"), 0));
722
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_RIGHT"), Py_BuildValue(const_cast<char*>("i"), 2));
723
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_CENTERED"), Py_BuildValue(const_cast<char*>("i"), 1));
17686 jghali 724
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_BLOCK"), Py_BuildValue(const_cast<char*>("i"), 3));
934 subik 725
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_FORCED"), Py_BuildValue(const_cast<char*>("i"), 4));
22731 jghali 726
        PyDict_SetItemString(d, const_cast<char*>("ALIGNV_TOP"), Py_BuildValue(const_cast<char*>("i"), 0));
727
        PyDict_SetItemString(d, const_cast<char*>("ALIGNV_CENTERED"), Py_BuildValue(const_cast<char*>("i"), 1));
728
        PyDict_SetItemString(d, const_cast<char*>("ALIGNV_BOTTOM"), Py_BuildValue(const_cast<char*>("i"), 2));
21563 jghali 729
        PyDict_SetItemString(d, const_cast<char*>("DIRECTION_LTR"), Py_BuildValue(const_cast<char*>("i"), 0));
730
        PyDict_SetItemString(d, const_cast<char*>("DIRECTION_RTL"), Py_BuildValue(const_cast<char*>("i"), 1));
934 subik 731
        PyDict_SetItemString(d, const_cast<char*>("FILL_NOG"), Py_BuildValue(const_cast<char*>("i"), 0));
732
        PyDict_SetItemString(d, const_cast<char*>("FILL_HORIZONTALG"), Py_BuildValue(const_cast<char*>("i"), 1));
733
        PyDict_SetItemString(d, const_cast<char*>("FILL_VERTICALG"), Py_BuildValue(const_cast<char*>("i"), 2));
734
        PyDict_SetItemString(d, const_cast<char*>("FILL_DIAGONALG"), Py_BuildValue(const_cast<char*>("i"), 3));
735
        PyDict_SetItemString(d, const_cast<char*>("FILL_CROSSDIAGONALG"), Py_BuildValue(const_cast<char*>("i"), 4));
736
        PyDict_SetItemString(d, const_cast<char*>("FILL_RADIALG"), Py_BuildValue(const_cast<char*>("i"), 5));
737
        PyDict_SetItemString(d, const_cast<char*>("LINE_SOLID"), Py_BuildValue(const_cast<char*>("i"), Qt::SolidLine));
738
        PyDict_SetItemString(d, const_cast<char*>("LINE_DASH"), Py_BuildValue(const_cast<char*>("i"), Qt::DashLine));
739
        PyDict_SetItemString(d, const_cast<char*>("LINE_DOT"), Py_BuildValue(const_cast<char*>("i"), Qt::DotLine));
740
        PyDict_SetItemString(d, const_cast<char*>("LINE_DASHDOT"), Py_BuildValue(const_cast<char*>("i"), Qt::DashDotLine));
741
        PyDict_SetItemString(d, const_cast<char*>("LINE_DASHDOTDOT"), Py_BuildValue(const_cast<char*>("i"), Qt::DashDotDotLine));
742
        PyDict_SetItemString(d, const_cast<char*>("JOIN_MITTER"), Py_BuildValue(const_cast<char*>("i"), Qt::MiterJoin));
743
        PyDict_SetItemString(d, const_cast<char*>("JOIN_BEVEL"), Py_BuildValue(const_cast<char*>("i"), Qt::BevelJoin));
744
        PyDict_SetItemString(d, const_cast<char*>("JOIN_ROUND"), Py_BuildValue(const_cast<char*>("i"), Qt::RoundJoin));
745
        PyDict_SetItemString(d, const_cast<char*>("CAP_FLAT"), Py_BuildValue(const_cast<char*>("i"), Qt::FlatCap));
746
        PyDict_SetItemString(d, const_cast<char*>("CAP_SQUARE"), Py_BuildValue(const_cast<char*>("i"), Qt::SquareCap));
747
        PyDict_SetItemString(d, const_cast<char*>("CAP_ROUND"), Py_BuildValue(const_cast<char*>("i"), Qt::RoundCap));
748
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_NONE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::NoButton));
749
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_OK"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Ok));
750
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_CANCEL"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Cancel));
751
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_YES"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Yes));
752
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_NO"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::No));
753
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_ABORT"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Abort));
754
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_RETRY"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Retry));
755
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_IGNORE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Ignore));
20077 craig 756
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_DEFAULT"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Default));
23467 jghali 757
        PyDict_SetItemString(d, const_cast<char*>("BUTTON_ESCAPE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Escape));
934 subik 758
        PyDict_SetItemString(d, const_cast<char*>("ICON_NONE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::NoIcon));
759
        PyDict_SetItemString(d, const_cast<char*>("ICON_INFORMATION"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Information));
760
        PyDict_SetItemString(d, const_cast<char*>("ICON_WARNING"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Warning));
761
        PyDict_SetItemString(d, const_cast<char*>("ICON_CRITICAL"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Critical));
762
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A0"), Py_BuildValue(const_cast<char*>("(ff)"), 2380.0, 3368.0));
763
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A1"), Py_BuildValue(const_cast<char*>("(ff)"), 1684.0, 2380.0));
764
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A2"), Py_BuildValue(const_cast<char*>("(ff)"), 1190.0, 1684.0));
765
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A3"), Py_BuildValue(const_cast<char*>("(ff)"), 842.0, 1190.0));
766
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A4"), Py_BuildValue(const_cast<char*>("(ff)"), 595.0, 842.0));
767
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A5"), Py_BuildValue(const_cast<char*>("(ff)"), 421.0, 595.0));
768
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A6"), Py_BuildValue(const_cast<char*>("(ff)"), 297.0, 421.0));
769
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A7"), Py_BuildValue(const_cast<char*>("(ff)"), 210.0, 297.0));
770
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A8"), Py_BuildValue(const_cast<char*>("(ff)"), 148.0, 210.0));
771
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A9"), Py_BuildValue(const_cast<char*>("(ff)"), 105.0, 148.0));
22407 gpittman 772
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A0_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 841.0, 1189.0));
773
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A1_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 594.0, 841.0));
774
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A2_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 420.0, 594.0));
775
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A3_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 297.0, 420.0));
776
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A4_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 210.0, 297.0));
777
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A5_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 148.0, 210.0));
778
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A6_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 105.0, 148.0));
779
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A7_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 74.0, 105.0));
780
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A8_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 52.0, 74.0));
781
        PyDict_SetItemString(d, const_cast<char*>("PAPER_A9_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 37.0, 52.0));
934 subik 782
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B0"), Py_BuildValue(const_cast<char*>("(ff)"), 2836.0, 4008.0));
783
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B1"), Py_BuildValue(const_cast<char*>("(ff)"), 2004.0, 2836.0));
784
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B2"), Py_BuildValue(const_cast<char*>("(ff)"), 1418.0, 2004.0));
785
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B3"), Py_BuildValue(const_cast<char*>("(ff)"), 1002.0, 1418.0));
786
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B4"), Py_BuildValue(const_cast<char*>("(ff)"), 709.0, 1002.0));
787
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B5"), Py_BuildValue(const_cast<char*>("(ff)"), 501.0, 709.0));
788
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B6"), Py_BuildValue(const_cast<char*>("(ff)"), 355.0, 501.0));
789
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B7"), Py_BuildValue(const_cast<char*>("(ff)"), 250.0, 355.0));
790
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B8"), Py_BuildValue(const_cast<char*>("(ff)"), 178.0, 250.0));
791
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B9"), Py_BuildValue(const_cast<char*>("(ff)"), 125.0, 178.0));
792
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B10"), Py_BuildValue(const_cast<char*>("(ff)"), 89.0, 125.0));
22407 gpittman 793
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B0_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 1000.0, 1414.0));
794
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B1_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 707.0, 1000.0));
795
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B2_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 500.0, 707.0));
796
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B3_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 353.0, 500.0));
797
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B4_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 250.0, 353.0));
798
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B5_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 176.0, 250.0));
799
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B6_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 125.0, 176.0));
800
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B7_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 88.0, 125.0));
801
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B8_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 62.0, 88.0));
802
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B9_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 44.0, 62.0));
803
        PyDict_SetItemString(d, const_cast<char*>("PAPER_B10_MM"), Py_BuildValue(const_cast<char*>("(ff)"), 31.0, 44.0));
934 subik 804
        PyDict_SetItemString(d, const_cast<char*>("PAPER_C5E"), Py_BuildValue(const_cast<char*>("(ff)"), 462.0, 649.0));
805
        PyDict_SetItemString(d, const_cast<char*>("PAPER_COMM10E"), Py_BuildValue(const_cast<char*>("(ff)"), 298.0, 683.0));
806
        PyDict_SetItemString(d, const_cast<char*>("PAPER_DLE"),  Py_BuildValue(const_cast<char*>("(ff)"), 312.0, 624.0));
807
        PyDict_SetItemString(d, const_cast<char*>("PAPER_EXECUTIVE"), Py_BuildValue(const_cast<char*>("(ff)"), 542.0, 720.0));
808
        PyDict_SetItemString(d, const_cast<char*>("PAPER_FOLIO"), Py_BuildValue(const_cast<char*>("(ff)"), 595.0, 935.0));
809
        PyDict_SetItemString(d, const_cast<char*>("PAPER_LEDGER"), Py_BuildValue(const_cast<char*>("(ff)"), 1224.0, 792.0));
810
        PyDict_SetItemString(d, const_cast<char*>("PAPER_LEGAL"), Py_BuildValue(const_cast<char*>("(ff)"), 612.0, 1008.0));
811
        PyDict_SetItemString(d, const_cast<char*>("PAPER_LETTER"), Py_BuildValue(const_cast<char*>("(ff)"), 612.0, 792.0));
812
        PyDict_SetItemString(d, const_cast<char*>("PAPER_TABLOID"), Py_BuildValue(const_cast<char*>("(ff)"), 792.0, 1224.0));
22775 jghali 813
        PyDict_SetItemString(d, const_cast<char*>("CSPACE_UNDEFINED"), Py_BuildValue(const_cast<char*>("i"), -1));
814
        PyDict_SetItemString(d, const_cast<char*>("CSPACE_RGB"), Py_BuildValue(const_cast<char*>("i"), 0));
815
        PyDict_SetItemString(d, const_cast<char*>("CSPACE_CMYK"), Py_BuildValue(const_cast<char*>("i"), 1));
816
        PyDict_SetItemString(d, const_cast<char*>("CSPACE_GRAY"), Py_BuildValue(const_cast<char*>("i"), 2));
817
        PyDict_SetItemString(d, const_cast<char*>("CSPACE_DUOTONE"), Py_BuildValue(const_cast<char*>("i"), 3));
818
        PyDict_SetItemString(d, const_cast<char*>("CSPACE_MONOCHROME"), Py_BuildValue(const_cast<char*>("i"), 4));
5887 fschmid 819
        PyDict_SetItemString(d, const_cast<char*>("NORMAL"), Py_BuildValue(const_cast<char*>("i"), 0));
820
        PyDict_SetItemString(d, const_cast<char*>("DARKEN"), Py_BuildValue(const_cast<char*>("i"), 1));
821
        PyDict_SetItemString(d, const_cast<char*>("LIGHTEN"), Py_BuildValue(const_cast<char*>("i"), 2));
822
        PyDict_SetItemString(d, const_cast<char*>("MULTIPLY"), Py_BuildValue(const_cast<char*>("i"), 3));
823
        PyDict_SetItemString(d, const_cast<char*>("SCREEN"), Py_BuildValue(const_cast<char*>("i"), 4));
824
        PyDict_SetItemString(d, const_cast<char*>("OVERLAY"), Py_BuildValue(const_cast<char*>("i"), 5));
825
        PyDict_SetItemString(d, const_cast<char*>("HARD_LIGHT"), Py_BuildValue(const_cast<char*>("i"), 6));
826
        PyDict_SetItemString(d, const_cast<char*>("SOFT_LIGHT"), Py_BuildValue(const_cast<char*>("i"), 7));
827
        PyDict_SetItemString(d, const_cast<char*>("DIFFERENCE"), Py_BuildValue(const_cast<char*>("i"), 8));
828
        PyDict_SetItemString(d, const_cast<char*>("EXCLUSION"), Py_BuildValue(const_cast<char*>("i"), 9));
829
        PyDict_SetItemString(d, const_cast<char*>("COLOR_DODGE"), Py_BuildValue(const_cast<char*>("i"), 10));
830
        PyDict_SetItemString(d, const_cast<char*>("COLOR_BURN"), Py_BuildValue(const_cast<char*>("i"), 11));
831
        PyDict_SetItemString(d, const_cast<char*>("HUE"), Py_BuildValue(const_cast<char*>("i"), 12));
832
        PyDict_SetItemString(d, const_cast<char*>("SATURATION"), Py_BuildValue(const_cast<char*>("i"), 13));
833
        PyDict_SetItemString(d, const_cast<char*>("COLOR"), Py_BuildValue(const_cast<char*>("i"), 14));
834
        PyDict_SetItemString(d, const_cast<char*>("LUMINOSITY"), Py_BuildValue(const_cast<char*>("i"), 15));
3647 subik 835
        // preset page layouts
836
        PyDict_SetItemString(d, const_cast<char*>("PAGE_1"), Py_BuildValue(const_cast<char*>("i"), 0));
837
        PyDict_SetItemString(d, const_cast<char*>("PAGE_2"), Py_BuildValue(const_cast<char*>("i"), 1));
838
        PyDict_SetItemString(d, const_cast<char*>("PAGE_3"), Py_BuildValue(const_cast<char*>("i"), 2));
839
        PyDict_SetItemString(d, const_cast<char*>("PAGE_4"), Py_BuildValue(const_cast<char*>("i"), 3));
23232 jghali 840
        // tab alignment
841
        PyDict_SetItemString(d, const_cast<char*>("TAB_LEFT"), Py_BuildValue(const_cast<char*>("i"), 0));
842
        PyDict_SetItemString(d, const_cast<char*>("TAB_RIGHT"), Py_BuildValue(const_cast<char*>("i"), 1));
843
        PyDict_SetItemString(d, const_cast<char*>("TAB_PERIOD"), Py_BuildValue(const_cast<char*>("i"), 2));
844
        PyDict_SetItemString(d, const_cast<char*>("TAB_COMMA"), Py_BuildValue(const_cast<char*>("i"), 3));
845
        PyDict_SetItemString(d, const_cast<char*>("TAB_CENTER"), Py_BuildValue(const_cast<char*>("i"), 4));
733 subik 846
 
2428 craig 847
        // Measurement units understood by Scribus's units.cpp functions are exported as constant conversion
848
        // factors to be used from Python.
19604 craig 849
        for (int i = 0; i <= unitGetMaxIndex()-2; ++i)
2428 craig 850
        {
851
                PyObject* value = PyFloat_FromDouble(unitGetRatioFromIndex(i));
852
                if (!value)
853
                {
854
                        initscribus_failed(__FILE__, __LINE__);
23278 jghali 855
                        return nullptr;
2428 craig 856
                }
857
                // `in' is a reserved word in Python so we must replace it
858
                PyObject* name;
19604 craig 859
                if (unitGetUntranslatedStrFromIndex(i) == "in")
23278 jghali 860
                        name = PyUnicode_FromString("inch");
2428 craig 861
                else
23278 jghali 862
                        name = PyUnicode_FromString(unitGetUntranslatedStrFromIndex(i).toUtf8().constData());
2428 craig 863
                if (!name)
864
                {
865
                        initscribus_failed(__FILE__, __LINE__);
23278 jghali 866
                        return nullptr;
2428 craig 867
                }
868
                if (PyDict_SetItem(d, name, value))
869
                {
870
                        initscribus_failed(__FILE__, __LINE__);
23278 jghali 871
                        return nullptr;
2428 craig 872
                }
873
        }
874
 
1043 subik 875
        // Export the Scribus version into the module namespace so scripts know what they're running in
23278 jghali 876
        PyDict_SetItemString(d, const_cast<char*>("scribus_version"), PyUnicode_FromString(const_cast<char*>(VERSION)));
1043 subik 877
        // Now build a version tuple like that provided by Python in sys.version_info
878
        // The tuple is of the form (major, minor, patchlevel, extraversion, reserved)
879
        QRegExp version_re("(\\d+)\\.(\\d+)\\.(\\d+)(.*)");
10598 cbradney 880
        int pos = version_re.indexIn(QString(VERSION));
1043 subik 881
        // We ignore errors, causing the scribus_version_info attribute to simply not be created.
882
        // This will make acceses raise AttrbuteError.
883
        if (pos > -1)
884
        {
885
                int majorVersion = version_re.cap(1).toInt();
886
                int minorVersion = version_re.cap(2).toInt();
887
                int patchVersion = version_re.cap(3).toInt();
888
                QString extraVersion = version_re.cap(4);
889
                PyObject* versionTuple = Py_BuildValue(const_cast<char*>("(iiisi)"),\
10493 fschmid 890
                                majorVersion, minorVersion, patchVersion, (const char*)extraVersion.toUtf8(), 0);
22517 craig 891
                if (versionTuple != nullptr)
1043 subik 892
                        PyDict_SetItemString(d, const_cast<char*>("scribus_version_info"), versionTuple);
893
                else
894
                        qDebug("Failed to build version tuple for version string '%s' in scripter", VERSION);
895
        }
896
        else
897
                qDebug("Couldn't parse version string '%s' in scripter", VERSION);
898
 
655 fschmid 899
        // Function aliases for compatibility
900
        // We need to import the __builtins__, warnings and exceptions modules to be able to run
901
        // the generated Python functions from inside the `scribus' module's context.
902
        // This code makes it possible to extend the `scribus' module by running Python code
903
        // from C in other ways too.
23278 jghali 904
        PyObject* builtinModule = PyImport_ImportModuleEx(const_cast<char*>("builtins"),
934 subik 905
                        d, d, Py_BuildValue(const_cast<char*>("[]")));
22517 craig 906
        if (builtinModule == nullptr)
655 fschmid 907
        {
23278 jghali 908
                qDebug("Failed to import builtins module. Something is probably broken with your Python.");
909
                return nullptr;
655 fschmid 910
        }
23278 jghali 911
        PyDict_SetItemString(d, const_cast<char*>("builtins"), builtinModule);
934 subik 912
        PyObject* warningsModule = PyImport_ImportModuleEx(const_cast<char*>("warnings"),
913
                        d, d, Py_BuildValue(const_cast<char*>("[]")));
22517 craig 914
        if (warningsModule == nullptr)
655 fschmid 915
        {
916
                qDebug("Failed to import warnings module. Something is probably broken with your Python.");
23278 jghali 917
                return nullptr;
655 fschmid 918
        }
934 subik 919
        PyDict_SetItemString(d, const_cast<char*>("warnings"), warningsModule);
853 subik 920
        // Create the module-level docstring. This can be a proper unicode string, unlike
921
        // the others, because we can just create a Unicode object and insert it in our
922
        // module dictionary.
923
        QString docstring = QObject::tr("Scribus Python interface module\n\
1345 subik 924
\n\
925
This module is the Python interface for Scribus. It provides functions\n\
926
to control scribus and to manipulate objects on the canvas. Each\n\
927
function is documented individually below.\n\
928
\n\
929
A few things are common across most of the interface.\n\
930
\n\
931
Most functions operate on frames. Frames are identified by their name,\n\
932
a string - they are not real Python objects. Many functions take an\n\
933
optional (non-keyword) parameter, a frame name.\n\
934
Many exceptions are also common across most functions. These are\n\
935
not currently documented in the docstring for each function.\n\
1559 craig 936
- Many functions will raise a NoDocOpenError if you try to use them\n\
1345 subik 937
without a document to operate on.\n\
1559 craig 938
- If you do not pass a frame name to a function that requires one,\n\
939
the function will use the currently selected frame, if any, or\n\
940
raise a NoValidObjectError if it can't find anything to operate\n\
1345 subik 941
on.\n\
942
- Many functions will raise WrongFrameTypeError if you try to use them\n\
943
on a frame type that they do not make sense with. For example, setting\n\
1525 cbradney 944
the text color on a graphics frame doesn't make sense, and will result\n\
1345 subik 945
in this exception being raised.\n\
946
- Errors resulting from calls to the underlying Python API will be\n\
947
passed through unaltered. As such, the list of exceptions thrown by\n\
948
any function as provided here and in its docstring is incomplete.\n\
949
\n\
950
Details of what exceptions each function may throw are provided on the\n\
1559 craig 951
function's documentation, though as with most Python code this list\n\
952
is not exhaustive due to exceptions from called functions.\n\
953
");
853 subik 954
 
23278 jghali 955
        PyObject* docStr = PyUnicode_FromString(docstring.toUtf8().data());
1559 craig 956
        if (!docStr)
957
                qDebug("Failed to create module-level docstring (couldn't make str)");
853 subik 958
        else
23278 jghali 959
                PyDict_SetItemString(d, const_cast<char*>("__doc__"), docStr);
1425 subik 960
 
961
        // Wrap up pointers to the the QApp and main window and push them out
962
        // to Python.
963
        wrappedQApp = wrapQObject(qApp);
964
        if (!wrappedQApp)
965
        {
966
                qDebug("Failed to wrap up QApp");
967
                PyErr_Print();
968
        }
969
        // Push it into the module dict, stealing a ref in the process
970
        PyDict_SetItemString(d, const_cast<char*>("qApp"), wrappedQApp);
971
        Py_DECREF(wrappedQApp);
22517 craig 972
        wrappedQApp = nullptr;
1425 subik 973
 
22884 jghali 974
        wrappedMainWindow = wrapQObject(mainWin);
1425 subik 975
        if (!wrappedMainWindow)
976
        {
22884 jghali 977
                qDebug("Failed to wrap up ScribusMainWindow");
1425 subik 978
                PyErr_Print();
979
        }
980
        // Push it into the module dict, stealing a ref in the process
981
        PyDict_SetItemString(d, const_cast<char*>("mainWindow"), wrappedMainWindow);
982
        Py_DECREF(wrappedMainWindow);
22517 craig 983
        wrappedMainWindow = nullptr;
23278 jghali 984
 
985
        return m;
82 Franz 986
}
987
 
6200 subik 988
/*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
989
with header files structure untouched (docstrings are kept near declarations)
990
PV */
991
void scriptplugindocwarnings()
992
{
22654 jghali 993
        QStringList s;
23378 craig 994
        s <<printer__doc__<<pdffile__doc__<<imgexp__doc__<<imgexp_dpi__doc__<<imgexp_scale__doc__ << imgexp_transparentBkgnd__doc__ <<imgexp_quality__doc__<<imgexp_filename__doc__<<imgexp_type__doc__<<imgexp_alltypes__doc__ << imgexp_save__doc__ << imgexp_saveas__doc__;
6200 subik 995
}