[scribus] Scribus 1.5.3 on Debian with Python 3

JLuc jluc at no-log.org
Wed Oct 25 06:54:06 UTC 2017


Le 24/10/2017 à 23:40, Jonas Bechtel a écrit :
> as the list has technically removed the attachment, I append the patch at the very end of this message. You find it as well on the hidden site http://jbechtel.de/site/dist/scribus-py3/

Hello Jonas

The best when you propose a patch is to create a report in the bug tracker
and upload it there so it can best reach core devs or future devs.
Could you do that ?
Please explain the purpose of your patch in the created report
and add some basic technical notes when possible.

JLuc

> 
> Answers to your mail are inline.
> 
> BR
>   Jonas
> 
> 
> On Tue, 24 Oct 2017 16:52:24 +0200, ale rimoldi <ale.comp_06 at xox.ch> wrote:
> 
>> hi jonas
>>
>> a late reply from my side...
>>
>> the port to python3 should already be in
>>
>> https://github.com/aoloe/scribus-plugin-scripter
>>
>> but it's not a huge thing...
>>
>> what i wonder: does your port run scripts?
> 
> What do you mean? I enter some python code in the console and it get's executed. This satisfies me so far as I wanted a proof-of-concept for Python 3 running with Scribus. The Function is illustrated on http://jbechtel.de/dist/scribus-py3 (I don't add an attachement here as the list will probably block it).
> 
> It doesn't work with the pdf export functions. I did not test / do not remember at which invokation stage the pdf export stucks
> It doesn't work to load an external file. (Displays an error but no error text)
> I did not test any window or so which is opened by the script as user interface.
> 
> Wait, I found a way to load external script files: Type the following into the console:
> # https://stackoverflow.com/questions/1027714/
> # ->
> # https://stackoverflow.com/a/31566843
> vars = globals();
> exec(open("test2.script").read(), vars)
> print (vars)
> 
> This doesn't forward the output of test2.script, but the script's execution leads to the desired effect on the document.
> 
> 
>> in my work i got stuck at getting the signals / slots cross the
>> boundaries between c++/qt5 and python/pyqt5.
>> (pyqt4 is using string for passing them around but pyqt5 wants real objects)
>>
>> a few people have tried to help out and/or audited the scribus scripter
>> and nobody could find a solution.
>>
>> since the scripter relies on a few technologies that are very little
>> documented / used and/or have been abandoned since about 10 years, i've
>> now tried to dig into a new library: modern, supported, with an active
>> community: pybind11.
> 
> I must admit I don't have any knowledge of the available python binding libs (and I probably won't get a depth insight soon).
> 
>>
>> i've been exploring it in my freetime and i like what i could achieve
>> with it!
>> (i was probably the first person trying to create a scripter engine with
>> pybind11... and i did need much support and a patch to the code to get
>> the code to work!)
>> i have a repository with all my tries and i'm currently cleaning it up
>> so that i can share my experience with the scribus and the pybind11
>> communities.
>>
>> after the clean up steps, there are three things to be done before
>> making my efforts public:
>>
>> - find out all the data structures to be tested in the scripter API, to
>> be sure that all needs of the scribus scripter are covered (work in
>> progress: i can already get values and objects to go back and forth
>> between c++ and python)
>>
>> - add the scripter to a sample qt5 application (work in progress: the
>> qt5 demo application can already launch a python3 script showing a pyqt5
>> dialog and gets back the value entered in the dialog...)
>>
>> - get the scripts to attach themselves to the navigation and the
>> keyboard shortcuts (probably without using signals and slots across the
>> c++/python boundaries.
>>
>>
>> i like the results i got so far.
>> it's far from being such a clever solution as the "scripter2" is, but i
>> hope the final result will be easier to understand and maintain!
>>
>> as soon as the repository is cleaned up (fix the old cmake files, make
>> sure all README are correct) i can share the url and help from people
>> with c++ skills is very welcome!
>> (and with a bit of luck, i will be cleaning up the repository later this
>> evening)
>>
> 
> I can
> - rewrite my WiScri environment to Python 3. (And make it more general; by now they only work with one document)
> - use this WiScri scripts for my diploma thesis and therefore find errors (and performance flaws)
> - look at the code and give hints where the errors come from
> 
> Unfortunately I cannot afford more time as there are many other things to do. So I won't provide code directly.
> 
>>
>> have fun
>> a.l.e
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> diff -r old/scribus-1.5.3/scribus/pluginmanager.cpp scribus-1.5.3/scribus/pluginmanager.cpp
> 187a188,189
>> 	// JONAS: debug message.
>> 	qDebug("Plugin-Verzeichnis: %s", ScPaths::instance().pluginDir().toLocal8Bit().data());
> 192a195,196
>> 		// JONAS: debug message.
>> 		qDebug("Zu ladendes Plugin: %s", dirList[dc].toLocal8Bit().data());
> 629c633,634
> < 	return (QDir::Files | QDir::Executable | QDir::NoSymLinks);
> ---
>> 	// JONAS: Allow SymLinks.
>> 	return (QDir::Files | QDir::Executable);
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdcell.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdcell.cpp
> 64c64
> < 	return PyString_FromString(table->cellAt(row, column).styleName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(table->cellAt(row, column).styleName().toUtf8());
> 156c156
> < 	return PyString_FromString(table->cellAt(row, column).fillColor().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(table->cellAt(row, column).fillColor().toUtf8());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdcolor.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdcolor.cpp
> 25c25
> < 		PyList_SetItem(l, cc, PyString_FromString(it.key().toUtf8()));
> ---
>> 		PyList_SetItem(l, cc, Legacy_PyString_FromString(it.key().toUtf8()));
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmddialog.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmddialog.cpp
> 71c71
> < 	return PyString_FromString(fName.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(fName.toUtf8());
> 123c123
> < 	return PyString_FromString(txt.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(txt.toUtf8());
> 146c146
> < 		return PyString_FromString(s.toUtf8());
> ---
>> 		return Legacy_PyString_FromString(s.toUtf8());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmddoc.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmddoc.cpp
> 200c200
> < 		return PyString_FromString("");
> ---
>> 		return Legacy_PyString_FromString("");
> 202c202
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->DocName.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->DocName.toUtf8());
> 321c321
> < 		PyList_SET_ITEM(names, n++, PyString_FromString(it.key().toUtf8().data()) );
> ---
>> 		PyList_SET_ITEM(names, n++, Legacy_PyString_FromString(it.key().toUtf8().data()) );
> 406c406
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->DocPages.at(e)->MPageNam.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->DocPages.at(e)->MPageNam.toUtf8());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdgetprop.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdgetprop.cpp
> 47c47
> < 	return PyString_FromString(result.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(result.toUtf8());
> 58c58
> < 	return i != NULL ? PyString_FromString(i->fillColor().toUtf8()) : NULL;
> ---
>> 	return i != NULL ? Legacy_PyString_FromString(i->fillColor().toUtf8()) : NULL;
> 99c99
> < 				return PyString_FromString(it->itemText.charStyle(b).fillColor().toUtf8());
> ---
>> 				return Legacy_PyString_FromString(it->itemText.charStyle(b).fillColor().toUtf8());
> 103c103
> < 		return PyString_FromString(it->lineColor().toUtf8());
> ---
>> 		return Legacy_PyString_FromString(it->lineColor().toUtf8());
> 239c239
> < 	return i != NULL ? PyString_FromString(i->Pfile.toUtf8()) : NULL;
> ---
>> 	return i != NULL ? Legacy_PyString_FromString(i->Pfile.toUtf8()) : NULL;
> 316c316
> < 					PyList_SetItem(l, counter2, PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().toUtf8()));
> ---
>> 					PyList_SetItem(l, counter2, Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().toUtf8()));
> 322c322
> < 				PyList_SetItem(l, counter2, PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().toUtf8()));
> ---
>> 				PyList_SetItem(l, counter2, Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(lam)->itemName().toUtf8()));
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdgetsetprop.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdgetsetprop.cpp
> 91c91
> < 	return PyString_FromString(type);
> ---
>> 	return Legacy_PyString_FromString(type);
> 101c101
> < 		if (PyList_Append(resultList, PyString_FromString((*it).toUtf8().data())) == -1)
> ---
>> 		if (PyList_Append(resultList, Legacy_PyString_FromString((*it).toUtf8().data())) == -1)
> 292c292
> < 		resultobj = PyString_FromString(prop.toByteArray().data());
> ---
>> 		resultobj = Legacy_PyString_FromString(prop.toByteArray().data());
> 294c294
> < 		resultobj = PyString_FromString(prop.toString().toUtf8().data());
> ---
>> 		resultobj = Legacy_PyString_FromString(prop.toString().toUtf8().data());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdmani.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdmani.cpp
> 409c409
> < 	return (group ? PyString_FromString(group->itemName().toUtf8()) : NULL);
> ---
>> 	return (group ? Legacy_PyString_FromString(group->itemName().toUtf8()) : NULL);
> 467c467
> < 		return PyString_FromString(ScCore->primaryMainWindow()->doc->m_Selection->itemAt(i)->itemName().toUtf8());
> ---
>> 		return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->m_Selection->itemAt(i)->itemName().toUtf8());
> 470c470
> < 		return PyString_FromString("");
> ---
>> 		return Legacy_PyString_FromString("");
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdmisc.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdmisc.cpp
> 52c52
> < 			PyList_SetItem(l, cc, PyString_FromString(it.currentKey().toUtf8()));
> ---
>> 			PyList_SetItem(l, cc, Legacy_PyString_FromString(it.currentKey().toUtf8()));
> 131c131
> < 		PyObject* stringPython = PyString_FromStringAndSize(buffer_string,bufferSize);
> ---
>> 		PyObject* stringPython = Legacy_PyString_FromStringAndSize(buffer_string,bufferSize);
> 160c160
> < 		PyList_SetItem(l, lam, PyString_FromString(ScCore->primaryMainWindow()->doc->Layers[lam].Name.toUtf8()));
> ---
>> 		PyList_SetItem(l, lam, Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Layers[lam].Name.toUtf8()));
> 193c193
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->activeLayerName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->activeLayerName().toUtf8());
> 764c764
> < 	return PyString_FromString(ScCore->getGuiLanguage().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->getGuiLanguage().toUtf8());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdobj.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdobj.cpp
> 46c46
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> 72c72
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> 97c97
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> 122c122
> < 	return PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->Items->at(i)->itemName().toUtf8());
> 158c158
> < 	return PyString_FromString(table->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(table->itemName().toUtf8());
> 218c218
> < 	return PyString_FromString(it->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(it->itemName().toUtf8());
> 295c295
> < 	return PyString_FromString(it->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(it->itemName().toUtf8());
> 377c377
> < 	return PyString_FromString(it->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(it->itemName().toUtf8());
> 468c468
> < 	return PyString_FromString(it->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(it->itemName().toUtf8());
> 509c509
> < 	return PyString_FromString(i->itemName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(i->itemName().toUtf8());
> 665c665
> < 		if (PyList_Append(styleList, PyString_FromString(ScCore->primaryMainWindow()->doc->paragraphStyles()[i].name().toUtf8())))
> ---
>> 		if (PyList_Append(styleList, Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->paragraphStyles()[i].name().toUtf8())))
> 682c682
> < 		if (PyList_Append(charStyleList, PyString_FromString(ScCore->primaryMainWindow()->doc->charStyles()[i].name().toUtf8())))
> ---
>> 		if (PyList_Append(charStyleList, Legacy_PyString_FromString(ScCore->primaryMainWindow()->doc->charStyles()[i].name().toUtf8())))
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdtable.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdtable.cpp
> 341c341
> < 	return PyString_FromString(table->styleName().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(table->styleName().toUtf8());
> 381c381
> < 	return PyString_FromString(table->fillColor().toUtf8());
> ---
>> 	return Legacy_PyString_FromString(table->fillColor().toUtf8());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdtext.cpp scribus-1.5.3/scribus/plugins/scriptplugin/cmdtext.cpp
> 94c94
> < 				return PyString_FromString(it->itemText.charStyle(b).font().scName().toUtf8());
> ---
>> 				return Legacy_PyString_FromString(it->itemText.charStyle(b).font().scName().toUtf8());
> 98c98
> < 		return PyString_FromString(it->currentCharStyle().font().scName().toUtf8());
> ---
>> 		return Legacy_PyString_FromString(it->currentCharStyle().font().scName().toUtf8());
> 174c174
> < 				return PyString_FromString(it->itemText.charStyle(b).fontFeatures().toUtf8());
> ---
>> 				return Legacy_PyString_FromString(it->itemText.charStyle(b).fontFeatures().toUtf8());
> 178c178
> < 		return PyString_FromString(it->currentCharStyle().fontFeatures().toUtf8());
> ---
>> 		return Legacy_PyString_FromString(it->currentCharStyle().fontFeatures().toUtf8());
> 267c267
> < 	return PyString_FromString(text.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(text.toUtf8());
> 300c300
> < 	return PyString_FromString(text.toUtf8());
> ---
>> 	return Legacy_PyString_FromString(text.toUtf8());
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/cmdvar.h scribus-1.5.3/scribus/plugins/scriptplugin/cmdvar.h
> 34a35,57
>>
>> // JONAS:
>> #define Legacy_PyString_FromString PyBytes_FromString
>> //#define PyString_FromStringAndSize PyBytes_FromStringAndSize
>> #define Legacy_PyString_FromStringAndSize PyBytes_FromStringAndSize
>> #define PyString_Check PyBytes_Check
>> // rather CheckExact?
>> #define PyString_Size PyBytes_Size
>> #define PyString_AsString PyBytes_AsString
>> #define PyInt_FromLong PyLong_FromLong
>> #define PyInt_Check PyLong_Check
>> #define PyInt_AsLong PyLong_AsLong
>> #define PyCObject_Check PyCapsule_CheckExact
>> #define PyCObject_AsVoidPtr(capsule) \
>> 		(PyCapsule_GetPointer(capsule, NULL))
>> #define PyCObject_FromVoidPtr(pointer, destructor) \
>> 		(PyCapsule_New(pointer, NULL, destructor))
>> // Hilfreich ist auch:
>> // https://docs.python.org/3/howto/cporting.html#cobject-replaced-with-capsule
>> // sowie weiterhin:
>> // https://docs.python.org/3/c-api/bytes.html u. a.
>>
>>
> 53a77
>> /*static*/ PyObject* PyInit_scribus(void);
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/objimageexport.cpp scribus-1.5.3/scribus/plugins/scriptplugin/objimageexport.cpp
> 19a20
>>
> 36c37,38
> < 	self->ob_type->tp_free((PyObject *)self);
> ---
>> 	Py_TYPE(self)->tp_free((PyObject *)self); // JONAS
>> 	//self->ob_base->tp_free((PyObject *)self);
> 47,48c49,50
> < 		self->name = PyString_FromString("ImageExport.png");
> < 		self->type = PyString_FromString("PNG");
> ---
>> 		self->name = Legacy_PyString_FromString("ImageExport.png");
>> 		self->type = Legacy_PyString_FromString("PNG");
> 122c124
> < 		PyList_SetItem(l, pos, PyString_FromString(QString((*it)).toLatin1().constData()));
> ---
>> 		PyList_SetItem(l, pos, Legacy_PyString_FromString(QString((*it)).toLatin1().constData()));
> 208c210
> < 	0,
> ---
>> 	// 0,		      // DELETED (Jonas)
> 254c256,259
> <
> ---
>> 	// Added in version 2.6:
>> 	0, //	 unsigned int tp_version_tag;
>> 	0, //	 destructor tp_finalize;
>> 	
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/objpdffile.cpp scribus-1.5.3/scribus/plugins/scriptplugin/objpdffile.cpp
> 138c138
> < 	self->ob_type->tp_free((PyObject *)self);
> ---
>> 	Py_TYPE(self)->tp_free((PyObject *)self);
> 153c153
> < 		self->file = PyString_FromString("");
> ---
>> 		self->file = Legacy_PyString_FromString("");
> 242c242
> < 		self->owner = PyString_FromString("");
> ---
>> 		self->owner = Legacy_PyString_FromString("");
> 248c248
> < 		self->user = PyString_FromString("");
> ---
>> 		self->user = Legacy_PyString_FromString("");
> 272c272
> < 		self->solidpr = PyString_FromString("");
> ---
>> 		self->solidpr = Legacy_PyString_FromString("");
> 277c277
> < 		self->imagepr = PyString_FromString("");
> ---
>> 		self->imagepr = Legacy_PyString_FromString("");
> 282c282
> < 		self->printprofc = PyString_FromString("");
> ---
>> 		self->printprofc = Legacy_PyString_FromString("");
> 287c287
> < 		self->info = PyString_FromString("");
> ---
>> 		self->info = Legacy_PyString_FromString("");
> 316c316
> < 		self->openAction = PyString_FromString("");
> ---
>> 		self->openAction = Legacy_PyString_FromString("");
> 342c342
> < 	file = PyString_FromString(tf.toLatin1());
> ---
>> 	file = Legacy_PyString_FromString(tf.toLatin1());
> 378c378
> < 		tmp = PyString_FromString(fontName.toLatin1());
> ---
>> 		tmp = Legacy_PyString_FromString(fontName.toLatin1());
> 404c404
> < 		tmp = PyString_FromString(pdfOptions.SubsetList[fe].toLatin1().data());
> ---
>> 		tmp = Legacy_PyString_FromString(pdfOptions.SubsetList[fe].toLatin1().data());
> 552c552
> < 	owner = PyString_FromString(pdfOptions.PassOwner.toLatin1());
> ---
>> 	owner = Legacy_PyString_FromString(pdfOptions.PassOwner.toLatin1());
> 562c562
> < 	user = PyString_FromString(pdfOptions.PassUser.toLatin1());
> ---
>> 	user = Legacy_PyString_FromString(pdfOptions.PassUser.toLatin1());
> 592c592
> < 	solidpr = PyString_FromString(tp.toLatin1());
> ---
>> 	solidpr = Legacy_PyString_FromString(tp.toLatin1());
> 604c604
> < 	imagepr = PyString_FromString(tp2.toLatin1());
> ---
>> 	imagepr = Legacy_PyString_FromString(tp2.toLatin1());
> 616c616
> < 	printprofc = PyString_FromString(tp3.toLatin1());
> ---
>> 	printprofc = Legacy_PyString_FromString(tp3.toLatin1());
> 626c626
> < 	info = PyString_FromString(tinfo.toLatin1());
> ---
>> 	info = Legacy_PyString_FromString(tinfo.toLatin1());
> 664c664
> < 	openAction = PyString_FromString(pdfOptions.openAction.toLatin1().data());
> ---
>> 	openAction = Legacy_PyString_FromString(pdfOptions.openAction.toLatin1().data());
> 1549c1549
> < 	0,		      //
> ---
>> 	// 0,		      // DELETED (Jonas)
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/objprinter.cpp scribus-1.5.3/scribus/plugins/scriptplugin/objprinter.cpp
> 62c62
> < 	self->ob_type->tp_free((PyObject *)self);
> ---
>> 	Py_TYPE(self)->tp_free((PyObject *)self);
> 82c82
> < 		self->printer = PyString_FromString("");
> ---
>> 		self->printer = Legacy_PyString_FromString("");
> 88c88
> < 		self->file = PyString_FromString("");
> ---
>> 		self->file = Legacy_PyString_FromString("");
> 94c94
> < 		self->cmd = PyString_FromString("");
> ---
>> 		self->cmd = Legacy_PyString_FromString("");
> 106c106
> < 		self->separation = PyString_FromString("No");
> ---
>> 		self->separation = Legacy_PyString_FromString("No");
> 147c147
> < 		PyObject *tmppr = PyString_FromString(prn.toLocal8Bit().constData());
> ---
>> 		PyObject *tmppr = Legacy_PyString_FromString(prn.toLocal8Bit().constData());
> 153c153
> < 	PyObject *tmp2 = PyString_FromString("File");
> ---
>> 	PyObject *tmp2 = Legacy_PyString_FromString("File");
> 158c158
> < 	printer = PyString_FromString("File");
> ---
>> 	printer = Legacy_PyString_FromString("File");
> 170c170
> < 	file = PyString_FromString(tf.toLatin1());
> ---
>> 	file = Legacy_PyString_FromString(tf.toLatin1());
> 180c180
> < 	cmd = PyString_FromString("");
> ---
>> 	cmd = Legacy_PyString_FromString("");
> 202c202
> < 	separation = PyString_FromString("No");
> ---
>> 	separation = Legacy_PyString_FromString("No");
> 517c517
> < 	0,			 //
> ---
>> 	// 0,		      // DELETED (Jonas)
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/scriptercore.cpp scribus-1.5.3/scribus/plugins/scriptplugin/scriptercore.cpp
> 269c269
> < 	char **comm = new char*[arguments.size()];
> ---
>> 	wchar_t **comm = new wchar_t*[arguments.size()];
> 273,275c273,280
> < 		comm[i] = new char[localStr.size() + 1]; //+1 to allow adding '\0'. may be useless, don't know how to check.
> < 		comm[i][localStr.size()] = 0;
> < 		strncpy(comm[i], localStr.data(), localStr.size());
> ---
>> 		char * tmp = new char[localStr.size() + 1];
>> 		tmp[localStr.size()] = 0;
>> 		strncpy(tmp, localStr.data(), localStr.size());
>> 		//comm[i] = new char[localStr.size() + 1]; //+1 to allow adding '\0'. may be useless, don't know how to check.
>> 		//comm[i][localStr.size()] = 0;
>> 		//strncpy(comm[i], localStr.data(), localStr.size());
>> 		comm[i] = Py_DecodeLocale(tmp, NULL);
>> 		delete[] tmp;
> 280c285,286
> < 		delete[] comm[i];
> ---
>> 		PyMem_RawFree(comm[i]);
>> 		//delete[] comm[i];
> 297c303
> < 		cm        += QString("import cStringIO\n");
> ---
>> 		cm        += QString("import io\n");
> 305c311
> < 		cm        += QString("sys.stdin = cStringIO.StringIO()\n");
> ---
>> 		cm        += QString("sys.stdin = io.StringIO()\n");
> 414,415c420,431
> < 				"    import cStringIO\n"
> < 				"    scribus._bu = cStringIO.StringIO()\n"
> ---
>> 				"    print('Started script console.')\n" // JONAS
>> 				"    #import scribus;\n"
>> 				"    #dir(scribus);\n"
>> 				"    #print(\"2\");\n"
>> 				"    #dir(\"scribus\");\n"
>> 				"    #print('3');\n"
>> 				"    #print('Selection Count result: {}.'.format(scribus.selectionCount()))\n"
>> 				"    #print('4');\n"
>> 				"    import io\n"
>> 				"    #print('5');\n"
>> 				"    scribus._bu = io.StringIO()\n"
>> 				"    #print('6');\n"
> 416a433
>> 				"    #print('7');\n"
> 417a435
>> 				"    #print('8');\n"
> 418a437
>> 				"    #print('9');\n"
> 419a439
>> 				"    #print('10');\n"
> 421a442
>> 				"    #print('11');\n"
> 422a444
>> 				"    #print('12');\n"
> 423a446
>> 				"    #print('13');\n"
> 424a448
>> 				"    #print('14');\n"
> 426c450
> < 				"    print 'Catched SystemExit - it is not good for Scribus'\n"
> ---
>> 				"    print ('Catched SystemExit - it is not good for Scribus')\n"
> 428c452,453
> < 				"    print 'Catched KeyboardInterrupt - it is not good for Scribus'\n"
> ---
>> 				"    print ('Catched KeyboardInterrupt - it is not good for Scribus')\n"
>> 				"#print('15');\n"
> 430a456,471
>> /*
>> """Scribus Python-Konsole
>>
>> This is a standard Python console with some
>> known limitations. Please consult the Scribus
>> Scripter documentation for futher information. """
>>
>> '''
>> asdf
>> '''
>>
>> scr = scribus
>> print (scr)
>> scra = 3
>> dir(scr)
>> */
> 598a640
>> 	// JONAS - Code duplication - StringIO several times assigned to sys.stdin?
> 605,606c647,649
> < 		"import cStringIO\n"
> < 		"sys.stdin = cStringIO.StringIO()\n"
> ---
>> 		"import io\n"
>> 		"sys.stdin = io.StringIO()\n"
>> 		"print('    scriptercore.cpp: This is the .so plugin loading code.')\n" //JONAS
> diff -r old/scribus-1.5.3/scribus/plugins/scriptplugin/scriptplugin.cpp scribus-1.5.3/scribus/plugins/scriptplugin/scriptplugin.cpp
> 172a173,176
>> 	scripterCore = new ScripterCore(ScCore->primaryMainWindow());
>> 	Q_CHECK_PTR(scripterCore);
>> 	
>> 	PyImport_AppendInittab("scribus", &PyInit_scribus);
> 174c178
> < 	if (PyUnicode_SetDefaultEncoding("utf-8"))
> ---
>> 	/*if (PyUnicode_SetDefaultEncoding("utf-8"))
> 178c182
> < 	}
> ---
>> 	}*/
> 180,182c184
> < 	scripterCore = new ScripterCore(ScCore->primaryMainWindow());
> < 	Q_CHECK_PTR(scripterCore);
> < 	initscribus(ScCore->primaryMainWindow());
> ---
>> 	//initscribus(ScCore->primaryMainWindow());
> 257c259
> < 	return PyString_FromString(scripterCore->inValue.toUtf8().data());
> ---
>> 	return PyUnicode_FromString(scripterCore->inValue.toUtf8().data());
> 577a580,608
>>
>> struct module_state {
>>      PyObject *error;
>> };
>> #define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
>>
>> static int myextension_traverse(PyObject *m, visitproc visit, void *arg) {
>>      Py_VISIT(GETSTATE(m)->error);
>>      return 0;
>> }
>>
>> static int myextension_clear(PyObject *m) {
>>      Py_CLEAR(GETSTATE(m)->error);
>>      return 0;
>> }
>>
>> static struct PyModuleDef moduledef = {
>>          PyModuleDef_HEAD_INIT,
>>          "scribus",
>>          NULL,
>>          sizeof(struct module_state),
>>          scribus_methods,
>>          NULL,
>>          myextension_traverse,
>>          myextension_clear,
>>          NULL
>> };
>>
>>
> 585a617,623
>> // explanation on how it's to be done: https://docs.python.org/3/howto/cporting.html
>> // Additional hint: has to be called by PyImport_AppendInittab before Py_Initialize
>> /*static*/ PyObject* PyInit_scribus(void) {
>> 	PyObject *m;
>> 	m = PyModule_Create(&moduledef);
>> 	return m;
>> }
> 587a626
>> 	
> 594c633
> < 	PyImport_AddModule((char*)"scribus");
> ---
>> 	m = PyImport_AddModule((char*)"scribus");
> 599c638,639
> < 	m = Py_InitModule((char*)"scribus", scribus_methods);
> ---
>> 	//m = Py_InitModule((char*)"scribus", scribus_methods);
>> 	
> 636,736c676,776
> < 	PyDict_SetItemString(d, const_cast<char*>("UNIT_POINTS"), PyInt_FromLong(unitIndexFromString("pt")));
> < 	PyDict_SetItemString(d, const_cast<char*>("UNIT_MILLIMETERS"), PyInt_FromLong(unitIndexFromString("mm")));
> < 	PyDict_SetItemString(d, const_cast<char*>("UNIT_INCHES"), PyInt_FromLong(unitIndexFromString("in")));
> < 	PyDict_SetItemString(d, const_cast<char*>("UNIT_PICAS"), PyInt_FromLong(unitIndexFromString("p")));
> < 	PyDict_SetItemString(d, const_cast<char*>("UNIT_CENTIMETRES"), PyInt_FromLong(unitIndexFromString("cm")));
> < 	PyDict_SetItemString(d, const_cast<char*>("UNIT_CICERO"), PyInt_FromLong(unitIndexFromString("c")));
> <         PyDict_SetItemString(d, const_cast<char*>("UNIT_PT"), PyInt_FromLong(unitIndexFromString("pt")));
> <         PyDict_SetItemString(d, const_cast<char*>("UNIT_MM"), PyInt_FromLong(unitIndexFromString("mm")));
> <         PyDict_SetItemString(d, const_cast<char*>("UNIT_IN"), PyInt_FromLong(unitIndexFromString("in")));
> <         PyDict_SetItemString(d, const_cast<char*>("UNIT_P"), PyInt_FromLong(unitIndexFromString("p")));
> <         PyDict_SetItemString(d, const_cast<char*>("UNIT_CM"), PyInt_FromLong(unitIndexFromString("cm")));
> <         PyDict_SetItemString(d, const_cast<char*>("UNIT_C"), PyInt_FromLong(unitIndexFromString("c")));
> < 	PyDict_SetItemString(d, const_cast<char*>("PORTRAIT"), Py_BuildValue(const_cast<char*>("i"), portraitPage));
> < 	PyDict_SetItemString(d, const_cast<char*>("LANDSCAPE"), Py_BuildValue(const_cast<char*>("i"), landscapePage));
> < 	PyDict_SetItemString(d, const_cast<char*>("NOFACINGPAGES"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("FACINGPAGES"),  Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("FIRSTPAGERIGHT"), Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("FIRSTPAGELEFT"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("ALIGN_LEFT"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("ALIGN_RIGHT"), Py_BuildValue(const_cast<char*>("i"), 2));
> < 	PyDict_SetItemString(d, const_cast<char*>("ALIGN_CENTERED"), Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("ALIGN_BLOCK"), Py_BuildValue(const_cast<char*>("i"), 3));
> < 	PyDict_SetItemString(d, const_cast<char*>("ALIGN_FORCED"), Py_BuildValue(const_cast<char*>("i"), 4));
> < 	PyDict_SetItemString(d, const_cast<char*>("DIRECTION_LTR"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("DIRECTION_RTL"), Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("FILL_NOG"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("FILL_HORIZONTALG"), Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("FILL_VERTICALG"), Py_BuildValue(const_cast<char*>("i"), 2));
> < 	PyDict_SetItemString(d, const_cast<char*>("FILL_DIAGONALG"), Py_BuildValue(const_cast<char*>("i"), 3));
> < 	PyDict_SetItemString(d, const_cast<char*>("FILL_CROSSDIAGONALG"), Py_BuildValue(const_cast<char*>("i"), 4));
> < 	PyDict_SetItemString(d, const_cast<char*>("FILL_RADIALG"), Py_BuildValue(const_cast<char*>("i"), 5));
> < 	PyDict_SetItemString(d, const_cast<char*>("LINE_SOLID"), Py_BuildValue(const_cast<char*>("i"), Qt::SolidLine));
> < 	PyDict_SetItemString(d, const_cast<char*>("LINE_DASH"), Py_BuildValue(const_cast<char*>("i"), Qt::DashLine));
> < 	PyDict_SetItemString(d, const_cast<char*>("LINE_DOT"), Py_BuildValue(const_cast<char*>("i"), Qt::DotLine));
> < 	PyDict_SetItemString(d, const_cast<char*>("LINE_DASHDOT"), Py_BuildValue(const_cast<char*>("i"), Qt::DashDotLine));
> < 	PyDict_SetItemString(d, const_cast<char*>("LINE_DASHDOTDOT"), Py_BuildValue(const_cast<char*>("i"), Qt::DashDotDotLine));
> < 	PyDict_SetItemString(d, const_cast<char*>("JOIN_MITTER"), Py_BuildValue(const_cast<char*>("i"), Qt::MiterJoin));
> < 	PyDict_SetItemString(d, const_cast<char*>("JOIN_BEVEL"), Py_BuildValue(const_cast<char*>("i"), Qt::BevelJoin));
> < 	PyDict_SetItemString(d, const_cast<char*>("JOIN_ROUND"), Py_BuildValue(const_cast<char*>("i"), Qt::RoundJoin));
> < 	PyDict_SetItemString(d, const_cast<char*>("CAP_FLAT"), Py_BuildValue(const_cast<char*>("i"), Qt::FlatCap));
> < 	PyDict_SetItemString(d, const_cast<char*>("CAP_SQUARE"), Py_BuildValue(const_cast<char*>("i"), Qt::SquareCap));
> < 	PyDict_SetItemString(d, const_cast<char*>("CAP_ROUND"), Py_BuildValue(const_cast<char*>("i"), Qt::RoundCap));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_NONE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::NoButton));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_OK"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Ok));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_CANCEL"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Cancel));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_YES"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Yes));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_NO"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::No));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_ABORT"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Abort));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_RETRY"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Retry));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_IGNORE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Ignore));
> < 	PyDict_SetItemString(d, const_cast<char*>("BUTTON_DEFAULT"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Default));
> < 	PyDict_SetItemString(d, const_cast<char*>("ICON_NONE"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::NoIcon));
> < 	PyDict_SetItemString(d, const_cast<char*>("ICON_INFORMATION"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Information));
> < 	PyDict_SetItemString(d, const_cast<char*>("ICON_WARNING"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Warning));
> < 	PyDict_SetItemString(d, const_cast<char*>("ICON_CRITICAL"), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Critical));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A0"), Py_BuildValue(const_cast<char*>("(ff)"), 2380.0, 3368.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A1"), Py_BuildValue(const_cast<char*>("(ff)"), 1684.0, 2380.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A2"), Py_BuildValue(const_cast<char*>("(ff)"), 1190.0, 1684.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A3"), Py_BuildValue(const_cast<char*>("(ff)"), 842.0, 1190.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A4"), Py_BuildValue(const_cast<char*>("(ff)"), 595.0, 842.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A5"), Py_BuildValue(const_cast<char*>("(ff)"), 421.0, 595.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A6"), Py_BuildValue(const_cast<char*>("(ff)"), 297.0, 421.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A7"), Py_BuildValue(const_cast<char*>("(ff)"), 210.0, 297.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A8"), Py_BuildValue(const_cast<char*>("(ff)"), 148.0, 210.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_A9"), Py_BuildValue(const_cast<char*>("(ff)"), 105.0, 148.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B0"), Py_BuildValue(const_cast<char*>("(ff)"), 2836.0, 4008.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B1"), Py_BuildValue(const_cast<char*>("(ff)"), 2004.0, 2836.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B2"), Py_BuildValue(const_cast<char*>("(ff)"), 1418.0, 2004.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B3"), Py_BuildValue(const_cast<char*>("(ff)"), 1002.0, 1418.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B4"), Py_BuildValue(const_cast<char*>("(ff)"), 709.0, 1002.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B5"), Py_BuildValue(const_cast<char*>("(ff)"), 501.0, 709.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B6"), Py_BuildValue(const_cast<char*>("(ff)"), 355.0, 501.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B7"), Py_BuildValue(const_cast<char*>("(ff)"), 250.0, 355.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B8"), Py_BuildValue(const_cast<char*>("(ff)"), 178.0, 250.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B9"), Py_BuildValue(const_cast<char*>("(ff)"), 125.0, 178.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_B10"), Py_BuildValue(const_cast<char*>("(ff)"), 89.0, 125.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_C5E"), Py_BuildValue(const_cast<char*>("(ff)"), 462.0, 649.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_COMM10E"), Py_BuildValue(const_cast<char*>("(ff)"), 298.0, 683.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_DLE"),  Py_BuildValue(const_cast<char*>("(ff)"), 312.0, 624.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_EXECUTIVE"), Py_BuildValue(const_cast<char*>("(ff)"), 542.0, 720.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_FOLIO"), Py_BuildValue(const_cast<char*>("(ff)"), 595.0, 935.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_LEDGER"), Py_BuildValue(const_cast<char*>("(ff)"), 1224.0, 792.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_LEGAL"), Py_BuildValue(const_cast<char*>("(ff)"), 612.0, 1008.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_LETTER"), Py_BuildValue(const_cast<char*>("(ff)"), 612.0, 792.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAPER_TABLOID"), Py_BuildValue(const_cast<char*>("(ff)"), 792.0, 1224.0));
> < 	PyDict_SetItemString(d, const_cast<char*>("NORMAL"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("DARKEN"), Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("LIGHTEN"), Py_BuildValue(const_cast<char*>("i"), 2));
> < 	PyDict_SetItemString(d, const_cast<char*>("MULTIPLY"), Py_BuildValue(const_cast<char*>("i"), 3));
> < 	PyDict_SetItemString(d, const_cast<char*>("SCREEN"), Py_BuildValue(const_cast<char*>("i"), 4));
> < 	PyDict_SetItemString(d, const_cast<char*>("OVERLAY"), Py_BuildValue(const_cast<char*>("i"), 5));
> < 	PyDict_SetItemString(d, const_cast<char*>("HARD_LIGHT"), Py_BuildValue(const_cast<char*>("i"), 6));
> < 	PyDict_SetItemString(d, const_cast<char*>("SOFT_LIGHT"), Py_BuildValue(const_cast<char*>("i"), 7));
> < 	PyDict_SetItemString(d, const_cast<char*>("DIFFERENCE"), Py_BuildValue(const_cast<char*>("i"), 8));
> < 	PyDict_SetItemString(d, const_cast<char*>("EXCLUSION"), Py_BuildValue(const_cast<char*>("i"), 9));
> < 	PyDict_SetItemString(d, const_cast<char*>("COLOR_DODGE"), Py_BuildValue(const_cast<char*>("i"), 10));
> < 	PyDict_SetItemString(d, const_cast<char*>("COLOR_BURN"), Py_BuildValue(const_cast<char*>("i"), 11));
> < 	PyDict_SetItemString(d, const_cast<char*>("HUE"), Py_BuildValue(const_cast<char*>("i"), 12));
> < 	PyDict_SetItemString(d, const_cast<char*>("SATURATION"), Py_BuildValue(const_cast<char*>("i"), 13));
> < 	PyDict_SetItemString(d, const_cast<char*>("COLOR"), Py_BuildValue(const_cast<char*>("i"), 14));
> < 	PyDict_SetItemString(d, const_cast<char*>("LUMINOSITY"), Py_BuildValue(const_cast<char*>("i"), 15));
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_POINTS")), PyInt_FromLong(unitIndexFromString("pt")));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_MILLIMETERS")), PyInt_FromLong(unitIndexFromString("mm")));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_INCHES")), PyInt_FromLong(unitIndexFromString("in")));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_PICAS")), PyInt_FromLong(unitIndexFromString("p")));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_CENTIMETRES")), PyInt_FromLong(unitIndexFromString("cm")));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_CICERO")), PyInt_FromLong(unitIndexFromString("c")));
>>          PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_PT")), PyInt_FromLong(unitIndexFromString("pt")));
>>          PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_MM")), PyInt_FromLong(unitIndexFromString("mm")));
>>          PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_IN")), PyInt_FromLong(unitIndexFromString("in")));
>>          PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_P")), PyInt_FromLong(unitIndexFromString("p")));
>>          PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_CM")), PyInt_FromLong(unitIndexFromString("cm")));
>>          PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("UNIT_C")), PyInt_FromLong(unitIndexFromString("c")));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PORTRAIT")), Py_BuildValue(const_cast<char*>("i"), portraitPage));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LANDSCAPE")), Py_BuildValue(const_cast<char*>("i"), landscapePage));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("NOFACINGPAGES")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FACINGPAGES")),  Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FIRSTPAGERIGHT")), Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FIRSTPAGELEFT")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ALIGN_LEFT")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ALIGN_RIGHT")), Py_BuildValue(const_cast<char*>("i"), 2));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ALIGN_CENTERED")), Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ALIGN_BLOCK")), Py_BuildValue(const_cast<char*>("i"), 3));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ALIGN_FORCED")), Py_BuildValue(const_cast<char*>("i"), 4));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("DIRECTION_LTR")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("DIRECTION_RTL")), Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FILL_NOG")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FILL_HORIZONTALG")), Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FILL_VERTICALG")), Py_BuildValue(const_cast<char*>("i"), 2));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FILL_DIAGONALG")), Py_BuildValue(const_cast<char*>("i"), 3));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FILL_CROSSDIAGONALG")), Py_BuildValue(const_cast<char*>("i"), 4));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("FILL_RADIALG")), Py_BuildValue(const_cast<char*>("i"), 5));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LINE_SOLID")), Py_BuildValue(const_cast<char*>("i"), Qt::SolidLine));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LINE_DASH")), Py_BuildValue(const_cast<char*>("i"), Qt::DashLine));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LINE_DOT")), Py_BuildValue(const_cast<char*>("i"), Qt::DotLine));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LINE_DASHDOT")), Py_BuildValue(const_cast<char*>("i"), Qt::DashDotLine));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LINE_DASHDOTDOT")), Py_BuildValue(const_cast<char*>("i"), Qt::DashDotDotLine));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("JOIN_MITTER")), Py_BuildValue(const_cast<char*>("i"), Qt::MiterJoin));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("JOIN_BEVEL")), Py_BuildValue(const_cast<char*>("i"), Qt::BevelJoin));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("JOIN_ROUND")), Py_BuildValue(const_cast<char*>("i"), Qt::RoundJoin));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("CAP_FLAT")), Py_BuildValue(const_cast<char*>("i"), Qt::FlatCap));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("CAP_SQUARE")), Py_BuildValue(const_cast<char*>("i"), Qt::SquareCap));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("CAP_ROUND")), Py_BuildValue(const_cast<char*>("i"), Qt::RoundCap));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_NONE")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::NoButton));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_OK")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Ok));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_CANCEL")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Cancel));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_YES")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Yes));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_NO")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::No));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_ABORT")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Abort));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_RETRY")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Retry));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_IGNORE")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Ignore));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("BUTTON_DEFAULT")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Default));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ICON_NONE")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::NoIcon));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ICON_INFORMATION")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Information));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ICON_WARNING")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Warning));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("ICON_CRITICAL")), Py_BuildValue(const_cast<char*>("i"), QMessageBox::Critical));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A0")), Py_BuildValue(const_cast<char*>("(ff)"), 2380.0, 3368.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A1")), Py_BuildValue(const_cast<char*>("(ff)"), 1684.0, 2380.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A2")), Py_BuildValue(const_cast<char*>("(ff)"), 1190.0, 1684.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A3")), Py_BuildValue(const_cast<char*>("(ff)"), 842.0, 1190.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A4")), Py_BuildValue(const_cast<char*>("(ff)"), 595.0, 842.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A5")), Py_BuildValue(const_cast<char*>("(ff)"), 421.0, 595.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A6")), Py_BuildValue(const_cast<char*>("(ff)"), 297.0, 421.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A7")), Py_BuildValue(const_cast<char*>("(ff)"), 210.0, 297.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A8")), Py_BuildValue(const_cast<char*>("(ff)"), 148.0, 210.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_A9")), Py_BuildValue(const_cast<char*>("(ff)"), 105.0, 148.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B0")), Py_BuildValue(const_cast<char*>("(ff)"), 2836.0, 4008.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B1")), Py_BuildValue(const_cast<char*>("(ff)"), 2004.0, 2836.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B2")), Py_BuildValue(const_cast<char*>("(ff)"), 1418.0, 2004.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B3")), Py_BuildValue(const_cast<char*>("(ff)"), 1002.0, 1418.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B4")), Py_BuildValue(const_cast<char*>("(ff)"), 709.0, 1002.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B5")), Py_BuildValue(const_cast<char*>("(ff)"), 501.0, 709.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B6")), Py_BuildValue(const_cast<char*>("(ff)"), 355.0, 501.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B7")), Py_BuildValue(const_cast<char*>("(ff)"), 250.0, 355.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B8")), Py_BuildValue(const_cast<char*>("(ff)"), 178.0, 250.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B9")), Py_BuildValue(const_cast<char*>("(ff)"), 125.0, 178.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_B10")), Py_BuildValue(const_cast<char*>("(ff)"), 89.0, 125.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_C5E")), Py_BuildValue(const_cast<char*>("(ff)"), 462.0, 649.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_COMM10E")), Py_BuildValue(const_cast<char*>("(ff)"), 298.0, 683.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_DLE")),  Py_BuildValue(const_cast<char*>("(ff)"), 312.0, 624.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_EXECUTIVE")), Py_BuildValue(const_cast<char*>("(ff)"), 542.0, 720.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_FOLIO")), Py_BuildValue(const_cast<char*>("(ff)"), 595.0, 935.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_LEDGER")), Py_BuildValue(const_cast<char*>("(ff)"), 1224.0, 792.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_LEGAL")), Py_BuildValue(const_cast<char*>("(ff)"), 612.0, 1008.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_LETTER")), Py_BuildValue(const_cast<char*>("(ff)"), 612.0, 792.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAPER_TABLOID")), Py_BuildValue(const_cast<char*>("(ff)"), 792.0, 1224.0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("NORMAL")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("DARKEN")), Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LIGHTEN")), Py_BuildValue(const_cast<char*>("i"), 2));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("MULTIPLY")), Py_BuildValue(const_cast<char*>("i"), 3));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("SCREEN")), Py_BuildValue(const_cast<char*>("i"), 4));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("OVERLAY")), Py_BuildValue(const_cast<char*>("i"), 5));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("HARD_LIGHT")), Py_BuildValue(const_cast<char*>("i"), 6));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("SOFT_LIGHT")), Py_BuildValue(const_cast<char*>("i"), 7));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("DIFFERENCE")), Py_BuildValue(const_cast<char*>("i"), 8));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("EXCLUSION")), Py_BuildValue(const_cast<char*>("i"), 9));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("COLOR_DODGE")), Py_BuildValue(const_cast<char*>("i"), 10));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("COLOR_BURN")), Py_BuildValue(const_cast<char*>("i"), 11));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("HUE")), Py_BuildValue(const_cast<char*>("i"), 12));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("SATURATION")), Py_BuildValue(const_cast<char*>("i"), 13));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("COLOR")), Py_BuildValue(const_cast<char*>("i"), 14));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("LUMINOSITY")), Py_BuildValue(const_cast<char*>("i"), 15));
> 738,741c778,781
> < 	PyDict_SetItemString(d, const_cast<char*>("PAGE_1"), Py_BuildValue(const_cast<char*>("i"), 0));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAGE_2"), Py_BuildValue(const_cast<char*>("i"), 1));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAGE_3"), Py_BuildValue(const_cast<char*>("i"), 2));
> < 	PyDict_SetItemString(d, const_cast<char*>("PAGE_4"), Py_BuildValue(const_cast<char*>("i"), 3));
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAGE_1")), Py_BuildValue(const_cast<char*>("i"), 0));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAGE_2")), Py_BuildValue(const_cast<char*>("i"), 1));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAGE_3")), Py_BuildValue(const_cast<char*>("i"), 2));
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("PAGE_4")), Py_BuildValue(const_cast<char*>("i"), 3));
> 756c796
> < 			name = PyString_FromString("inch");
> ---
>> 			name = PyUnicode_FromString("inch");
> 758c798
> < 			name = PyString_FromString(unitGetUntranslatedStrFromIndex(i).toLatin1().constData());
> ---
>> 			name = PyUnicode_FromString(unitGetUntranslatedStrFromIndex(i).toLatin1().constData());
> 772c812
> < 	PyDict_SetItemString(d, const_cast<char*>("scribus_version"), PyString_FromString(const_cast<char*>(VERSION)));
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("scribus_version")), PyUnicode_FromString(const_cast<char*>(VERSION)));
> 788c828
> < 			PyDict_SetItemString(d, const_cast<char*>("scribus_version_info"), versionTuple);
> ---
>> 			PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("scribus_version_info")), versionTuple);
> 797c837
> < 	// We need to import the __builtins__, warnings and exceptions modules to be able to run
> ---
>> 	// We need to import the builtins, warnings and exceptions modules to be able to run
> 801c841,842
> < 	PyObject* builtinModule = PyImport_ImportModuleEx(const_cast<char*>("__builtin__"),
> ---
>> 	// JONAS: __builtin__ -> builtins (Python3)
>> 	PyObject* builtinModule = PyImport_ImportModuleEx(const_cast<char*>("builtins"),
> 805c846
> < 		qDebug("Failed to import __builtin__ module. Something is probably broken with your Python.");
> ---
>> 		qDebug("Failed to import builtins module. Something is probably broken with your Python.");
> 808c849,851
> < 	PyDict_SetItemString(d, const_cast<char*>("__builtin__"), builtinModule);
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("builtins")), builtinModule);
>> 	
>> 	/* JONAS: "exceptions" has been merged into "builtins" in Python 3
> 816c859,861
> < 	PyDict_SetItemString(d, const_cast<char*>("exceptions"), exceptionsModule);
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("exceptions")), exceptionsModule);
>> 	*/
>> 	
> 824c869
> < 	PyDict_SetItemString(d, const_cast<char*>("warnings"), warningsModule);
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("warnings")), warningsModule);
> 860c905
> < 	PyObject* docStr = PyString_FromString(docstring.toUtf8().data());
> ---
>> 	PyObject* docStr = PyUnicode_FromString(docstring.toUtf8().data());
> 865c910,911
> < 		PyObject* uniDocStr = PyUnicode_FromEncodedObject(docStr, "utf-8", NULL);
> ---
>> 		PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("__doc__")), docStr);
>> 		/*PyObject* uniDocStr = PyUnicode_FromEncodedObject(docStr, "utf-8", NULL);
> 871c917
> < 			PyDict_SetItemString(d, const_cast<char*>("__doc__"), uniDocStr);
> ---
>> 			PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("__doc__")), uniDocStr);
> 873a920
>> 		*/
> 885c932
> < 	PyDict_SetItemString(d, const_cast<char*>("qApp"), wrappedQApp);
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("qApp")), wrappedQApp);
> 896c943
> < 	PyDict_SetItemString(d, const_cast<char*>("mainWindow"), wrappedMainWindow);
> ---
>> 	PyDict_SetItem(d, PyUnicode_FromString(const_cast<char*>("mainWindow")), wrappedMainWindow);
> 898a946,947
>> 	
>> 	return;
> diff -r old/scribus-1.5.3/scribus/scribus.cpp scribus-1.5.3/scribus/scribus.cpp
> 311a312,314
>> 	// JONAS
>> 	m_doc = 0;
>> 	m_tocGenerator = 0;
> 479,480c482,486
> < 	delete m_doc;
> < 	delete m_tocGenerator;
> ---
>> 	// JONAS
>> 	if (m_doc)
>> 		delete m_doc;
>> 	if (m_tocGenerator)
>> 		delete m_tocGenerator;
> ___
> Scribus Mailing List: scribus at lists.scribus.net
> Edit your options or unsubscribe:
> http://lists.scribus.net/mailman/listinfo/scribus
> See also:
> http://wiki.scribus.net
> http://forums.scribus.net
> 





More information about the scribus mailing list