From 5d6944bb95ea60bbe6ba611b85e3bee3547139c4 Mon Sep 17 00:00:00 2001
From: Jean Ghali
Date: Sun, 27 Oct 2019 13:01:32 +0000
Subject: [PATCH] #15030 : port scripter to Python 3
git-svn-id: svn://scribus.net/trunk/Scribus@23278 11d20701-8431-0410-a711-e3c959e3b870
---
CMakeLists.txt | 6 +-
doc/de/install2.html | 41 ++--
doc/de/scripter1.html | 3 +
doc/en/install2.html | 38 ++--
doc/en/scripter1.html | 4 +-
doc/fr/install2.html | 36 ++--
doc/it/scripter1.html | 6 +
scribus/main_win32.cpp | 4 +-
.../plugins/scriptplugin/cmdannotations.cpp | 46 ++---
scribus/plugins/scriptplugin/cmdcell.cpp | 8 +-
scribus/plugins/scriptplugin/cmdcolor.cpp | 2 +-
scribus/plugins/scriptplugin/cmddialog.cpp | 10 +-
scribus/plugins/scriptplugin/cmddoc.cpp | 18 +-
scribus/plugins/scriptplugin/cmdgetprop.cpp | 34 +--
.../plugins/scriptplugin/cmdgetsetprop.cpp | 43 ++--
scribus/plugins/scriptplugin/cmdmani.cpp | 27 +--
scribus/plugins/scriptplugin/cmdmisc.cpp | 31 ++-
scribus/plugins/scriptplugin/cmdobj.cpp | 41 ++--
scribus/plugins/scriptplugin/cmdpage.cpp | 6 +-
scribus/plugins/scriptplugin/cmdsetprop.cpp | 30 +--
scribus/plugins/scriptplugin/cmdstyle.cpp | 12 +-
scribus/plugins/scriptplugin/cmdtable.cpp | 8 +-
scribus/plugins/scriptplugin/cmdtext.cpp | 36 ++--
scribus/plugins/scriptplugin/cmdutil.cpp | 8 +
scribus/plugins/scriptplugin/cmdutil.h | 10 +-
scribus/plugins/scriptplugin/cmdvar.h | 11 +
.../plugins/scriptplugin/objimageexport.cpp | 27 ++-
scribus/plugins/scriptplugin/objpdffile.cpp | 174 ++++++++--------
scribus/plugins/scriptplugin/objprinter.cpp | 53 ++---
.../plugins/scriptplugin/samples/3columnA4.py | 8 +-
.../scriptplugin/samples/3columnUSLTR.py | 8 +-
.../plugins/scriptplugin/samples/Calender.py | 2 +-
.../scriptplugin/samples/ExtractText.py | 4 +-
.../plugins/scriptplugin/samples/Sample1.py | 2 +-
.../scriptplugin/samples/boilerplate.py | 6 +-
.../scriptplugin/samples/golden-mean.py | 2 +-
.../plugins/scriptplugin/samples/legende.py | 2 +-
.../samples/moins_10_pourcent_group.py | 2 +-
.../samples/plus_10_pourcent_group.py | 2 +-
.../scriptplugin/samples/pochette_cd.py | 2 +-
scribus/plugins/scriptplugin/samples/quote.py | 2 +-
.../scriptplugin/samples/sample_db_usage.py | 4 +-
.../scriptplugin/samples/trait_de_coupe.py | 2 +-
.../plugins/scriptplugin/samples/wordcount.py | 2 +-
scribus/plugins/scriptplugin/scriptercore.cpp | 35 ++--
scribus/plugins/scriptplugin/scriptplugin.cpp | 194 ++++++++++--------
.../scripts/Align_image_in_frame.py | 15 +-
.../scriptplugin/scripts/CalendarWizard.py | 44 ++--
.../plugins/scriptplugin/scripts/Caption.py | 4 +-
.../scriptplugin/scripts/ColorChart.py | 8 +-
.../scriptplugin/scripts/DirectImageImport.py | 6 +-
.../scriptplugin/scripts/FontSample.py | 76 +++----
.../plugins/scriptplugin/scripts/InfoBox.py | 6 +-
.../scriptplugin/scripts/Ligatursatz.py | 24 +--
.../plugins/scriptplugin/scripts/color2csv.py | 8 +-
.../plugins/scriptplugin/scripts/csv2color.py | 10 +-
.../scriptplugin/scripts/importcsv2table.py | 10 +-
57 files changed, 670 insertions(+), 593 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0cfa1d5..cd5c39f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -847,10 +847,10 @@ endif()
#<< PYTHON
#set(PythonLibs_FIND_VERSION 2)
-find_package(PythonInterp 2)
-find_package(PythonLibs 2 REQUIRED)
+find_package(PythonInterp 3)
+find_package(PythonLibs 3 REQUIRED)
if (PYTHON_LIBRARY)
- message("Python Library Found OK")
+ message("Python 3.x Library Found OK")
set(HAVE_PYTHON ON)
set(COMPILE_PYTHON ON)
endif()
diff --git a/doc/de/install2.html b/doc/de/install2.html
index e8ec3b8..dd46fbd 100644
--- a/doc/de/install2.html
+++ b/doc/de/install2.html
@@ -3,36 +3,39 @@
Voraussetzungen
+
Voraussetzungen
Die Programme, die Sie benötigen, um Scribus zu kompilieren, sind:
- - Für Scribus 1.4.x wird mindestens GCC 3.x+ benötigt und GCC 3.3+ dringend empfohlen. Das Scribus-Team hat GCC 4.1+ getestet. Wir empfehlen, jeweils die aktuelle GCC 4.x-Version zu verwenden, da sich dadurch Performance-Vorteile ergeben können.
- - CMake
+ - Für Scribus 1.5.x wird mindestens GCC 4.8+ benötigt und GCC 7+ dringend empfohlen. Wir empfehlen, jeweils die aktuelle GCC Version zu verwenden, da sich dadurch Performance-Vorteile ergeben können.
+ - CMake 3.12+
- GNU make
Die Abhängigkeiten zum Kompilieren und zur Verwendung von Scribus sind:
-- Qt 4.6.0+, sowohl die Laufzeit- als auch die Entwicklerbibliotheken.
-- Python und Python-devel 2.3+. Python 2.2 wird nicht unterstützt.
-- Freetype2 2.1.7+. Wegen verschiedener Fehler in Freetype2 empfehlen wir, wenn möglich, die Verwendung von Version 2.3.x
-- Cairo 1.4.x. We empfehlen 1.4.10 oder höher.
-- libxml2 2.6+.
-- Ghostscript 8.60+ wird dringend empfohlen.
-- littleCMS – in einigen Distributionen auch lcms genannt. Das Minimum ist 1.12, aber wir empfehlen 1.17 oder höher. lcms 1.12+ bietet Unterstützung von Tiefenkompensierung.
-- libtiff 3.6.0+
-- libjpeg
-- CUPS-devel – Scribus unterstützt die direkte Druckausgabe mit CUPS. (Linux/UNIX/Mac OS X).
-- tkinter – für das »Font Sampler«- und das »Calendar Wizard«-Script.
-- Python-imaging für einige Funktionen des Scripters.
-- openssl-devel (einige Linux-Distributionen, insbesondere OpenSUSE, ermöglichen SSL-Unterstützung für CUPS)
-- fontconfig-devel – um das automatische Auffinden von Schriftdateien unter Linux, Mac OS X und UNIX zu ermöglichen. Nicht erforderlich unter Windows, OS/2 und eComStation.
-- Podofo 0.6 oder höher – wird vom AI-Importfilter benötigt.
+ - Qt 5.10.0+, sowohl die Laufzeit- als auch die Entwicklerbibliotheken.
+ - Cairo 1.14.x. We empfehlen 1.16.0 oder höher.
+ - CUPS-devel – Scribus unterstützt die direkte Druckausgabe mit CUPS. (Linux/UNIX/Mac OS X).
+ - fontconfig-devel – um das automatische Auffinden von Schriftdateien unter Linux, Mac OS X und UNIX zu ermöglichen. Nicht erforderlich unter Windows, OS/2 und eComStation.
+ - Freetype2 2.1.7+. Wegen verschiedener Fehler in Freetype2 empfehlen wir, wenn möglich, die Verwendung von Version 2.3.x
+ - Ghostscript 9.0+ wird dringend empfohlen.
+ - littleCMS – in einigen Distributionen auch lcms genannt. Das Minimum ist 2.1, aber wir empfehlen 2.9 oder höher.
+ - libjpeg
+ - libtiff 3.6.0+
+ - libxml2 2.6+.
+ - Podofo 0.9 oder höher – wird vom AI-Importfilter benötigt.
+ - Python und Python-devel 3.3+. Python 3.2 wird nicht unterstützt.
+ - Python-imaging für einige Funktionen des Scripters.
+ - tkinter – für das »Font Sampler«- und das »Calendar Wizard«-Script.
+ - openssl-devel (einige Linux-Distributionen, insbesondere OpenSUSE, ermöglichen SSL-Unterstützung für CUPS)
Optional:
-- antiword – benötigt für dem Import von MS-Word-Dateien, ist aber unnötig beim Kompilieren. Scribus wird ein installiertes Antiword später automatisch finden.
-- Um Renderrahmen verwenden zu können, benötigen Sie zusätzliche Programme wie LaTeX oder Lilypond.
+ - antiword – benötigt für dem Import von MS-Word-Dateien, ist aber unnötig beim Kompilieren. Scribus wird ein installiertes Antiword später automatisch finden.
+ - Um Renderrahmen verwenden zu können, benötigen Sie zusätzliche Programme wie LaTeX oder Lilypond.
Scribus läuft in jeder Desktopumgebung und benötigt kein KDE, aber Drag’n’drop funktioniert nur in KDE.
Falls das Farbmanagement nicht funktioniert, müssen Sie zusätzlich mindestens ein RGB- und ein CMYK-Profil installieren. Anderenfalls werden die Farbmanagement-Optionen ausgeblendet oder ausgegraut. Normalerweise installiert Scribus ein RGB- and ein CMYK-Profil, und zwar nur, um das Farbmanagement zu aktivieren, aber aufgrund ihrer Lizenzpolitik (v.a. Debian) befinden sich die Profile u.U. in einem separaten Paket.
diff --git a/doc/de/scripter1.html b/doc/de/scripter1.html
index c3acdd0..78fba55 100644
--- a/doc/de/scripter1.html
+++ b/doc/de/scripter1.html
@@ -14,6 +14,9 @@
Note that additions to the Scripter are being made frequently, which means that the available documentation may be incomplete.
+Scripter and Windows
+If you installed your Windows version of Scribus using the installer at Sourceforge, the installation includes Python 3.7 in a directory labeled python\. This will suffice for most uses. You may find or write some Python script which requires an additional Python package not included, and there is no way to add these to the Scribus directory. Chances are, your system is not even aware of this Python.
+Should you need to use some additional packages, the answer comes from installing Python 3.7 on your system, then also the desired additional packages. The next and important step is to use a file manager to go to C:\Program Files\Scribus 1.5.6\ and look for a directory named python\. Simply rename this to anything else, such as oldpython\, and the next time Scribus starts, it will use the system Python and its packages.
Using the Plug-in
Scribus is being shipped with some “hard-wired” scripts, which are available via Scripter > Scribus Scripts:
diff --git a/doc/en/install2.html b/doc/en/install2.html
index a02c4a7..7762b5d 100644
--- a/doc/en/install2.html
+++ b/doc/en/install2.html
@@ -10,32 +10,32 @@
Requirements
The programs you will need to compile Scribus 1.4 are:
- - For Scribus 1.4.x GCC 3.x+ is required, GCC 3.3+ is strongly recommended. The Scribus Team has tested compiling with GCC 4.1+. We recommend the newest stable GCC 4.x release for the performance benefits.
- - CMake
+ - For Scribus 1.5.x GCC 4.8+ is required, GCC 7+ is strongly recommended. We recommend the newest stable GCC release for the performance benefits.
+ - CMake 3.12+
- GNU make
The dependencies for compilation, and also to run Scribus are:
-- Qt 4.6.0+, both the runtime libraries and development libraries.
-- Python and Python-devel libraries 2.3+. Python 2.2 is not supported.
-- Freetype2 2.1.7+. Due to various freetype2 bugs, we recommend, if your distribution/OS allows, to use 2.3.x
-- Cairo 1.4.x. We recommend 1.4.10 or later for performance reasons.
-- libxml2 2.6+.
-- Ghostscript 8.60+ is highly recommended.
-- littleCMS – also known as lcms in some distributions. The minimum is 1.12, whereas 1.17+ is recommended. lcms 1.12+ has support for black point compensation.
-- libtiff 3.6.0+
-- libjpeg
-- CUPS development libraries – Scribus directly supports printing with CUPS. (Linux/UNIX/Mac OS X only).
-- tkinter – for the Font Sampler and Calendar Wizard scripts.
-- Python-imaging libaries for some scripting features.
-- openssl-devel (Some Linux distributions enable ssl support for CUPS, notably OpenSUSE)
-- fontconfig-devel – for auto discovery of fonts on Linux, Mac OS X and UNIX. Not needed on Windows, OS/2 and eComStation.
-- Podofo 0.6 or later – used to enhance the Adobe Illustrator importer.
+ - Qt 5.10.0+, both the runtime libraries and development libraries.
+ - Cairo 1.14.x. We recommend 1.16.x.
+ - CUPS development libraries – Scribus directly supports printing with CUPS. (Linux/UNIX/Mac OS X only).
+ - fontconfig-devel – for auto discovery of fonts on Linux, Mac OS X and UNIX. Not needed on Windows, OS/2 and eComStation.
+ - Freetype2 2.1.7+. Due to various freetype2 bugs, we recommend, if your distribution/OS allows, to use 2.3.x
+ - Ghostscript 9.0+ is highly recommended.
+ - littleCMS – also known as lcms in some distributions. The minimum is 2.1, whereas 2.9+ is recommended..
+ - libjpeg
+ - libtiff 3.6.0+
+ - libxml2 2.6+.
+ - Podofo 0.9 or later – used to enhance the Adobe Illustrator importer.
+ - Python and Python-devel libraries 3.3+. Python 3.2 is not supported.
+ - Python-imaging libaries for some scripting features.
+ - tkinter – for the Font Sampler and Calendar Wizard scripts.
+ - openssl-devel (Some Linux distributions enable ssl support for CUPS, notably OpenSUSE)
Optionally:
-- antiword – this is not needed at compile time for MS Word import. Scribus will detect this at run time however.
-- To use Render Frames, you need additional programs, like LaTeX or Lilypond.
+ - antiword – this is not needed at compile time for MS Word import. Scribus will detect this at run time however.
+ - To use Render Frames, you need additional programs, like LaTeX or Lilypond.
Scribus will run under almost any window manager and does not require KDE. However, drag and drop functionality will be lost without KDE.
If color management does not work, you also need at least one RGB profile and one CMYK profile installed or the color preferences and options will not appear in the menus. Scribus installs one RGB and one CMYK profile simply to enable color management, but some distributions, notably Debian, provide ICC profiles in separate packages, due to their licensing policy.
diff --git a/doc/en/scripter1.html b/doc/en/scripter1.html
index 922e0cf..78fba55 100644
--- a/doc/en/scripter1.html
+++ b/doc/en/scripter1.html
@@ -15,8 +15,8 @@
Note that additions to the Scripter are being made frequently, which means that the available documentation may be incomplete.
Scripter and Windows
-If you installed your Windows version of Scribus using the installer at Sourceforge, the installation includes Python2.7 in a directory labeled python\. This will suffice for most uses. You may find or write some Python script which requires an additional Python package not included, and there is no way to add these to the Scribus directory. Chances are, your system is not even aware of this Python.
-Should you need to use some additional packages, the answer comes from installing Python27 on your system, then also the desired additional packages. The next and important step is to use a file manager to go to C:\Program Files\Scribus 1.5.3\ and look for a directory named python\. Simply rename this to anything else, such as oldpython\, and the next time Scribus starts, it will use the system Python and its packages.
+If you installed your Windows version of Scribus using the installer at Sourceforge, the installation includes Python 3.7 in a directory labeled python\. This will suffice for most uses. You may find or write some Python script which requires an additional Python package not included, and there is no way to add these to the Scribus directory. Chances are, your system is not even aware of this Python.
+Should you need to use some additional packages, the answer comes from installing Python 3.7 on your system, then also the desired additional packages. The next and important step is to use a file manager to go to C:\Program Files\Scribus 1.5.6\ and look for a directory named python\. Simply rename this to anything else, such as oldpython\, and the next time Scribus starts, it will use the system Python and its packages.
Using the Plug-in
Scribus is being shipped with some “hard-wired” scripts, which are available via Scripter > Scribus Scripts:
diff --git a/doc/fr/install2.html b/doc/fr/install2.html
index 1ff30ec..8e802dd 100644
--- a/doc/fr/install2.html
+++ b/doc/fr/install2.html
@@ -7,19 +7,24 @@
Éléments requis
Pour compiler Scribus, vous aurez besoin de :
- - Pour Scribus 1.3.x+ GCC 3.x+ est requis, GCC 3.3+ est fortement recommandé. L'équipe de Scribus a testé la compilation avec GCC 3.4 ou GCC 4.0 et recommande de l'utiliser, s'il est disponible, pour les gains de performance obtenus.
- - autoconf 2.53+
- - automake 1.6.3+
+ - Pour Scribus 1.5.x+ GCC 4.8+ est requis, GCC 7+ est fortement recommandé. L'équipe de Scribus recommande de l'utiliser la dernière release de GGC en raison des gains de performance obtenus.
+ - CMake 3.12+
+ - GNU make
Les dépendances pour la compilation et pour exécuter Scribus sont:
- - Qt 3.3.0+, les librairies d'exécution et les libraires de développement. Nous recommandons d'utiliser Qt 3.3.4+. Qt =< 3.2.x n'est pas supporté.
- - Les librairies Python et python-devel 2.3+. Vous pouvez désactiver le support Python à l'aide de
configure --without-python
. Python 2.2 n'est pas supporté.
- - Freetype2 2.1.3+. À cause de nombreux problèmes de freetype2, nous recommandons, si votre distribution/système d'exploitation le permet, d'utiliser 2.1.10+
- - libart_lgpl 2.3.10+, 2.3.17+ recommandé.
- - libxml 2.6+.
- - Ghostscript 7.07+ ou GPL Ghostscript 8.57+ est hautement recommandé.
- - PostScript-Fonts. TrueType Fonts. Scribus supporte également les polices OpenType, TrueType et Type 1 Outline OpenType Fonts dans 1.1.1+.
+ - Qt 5.10.0+, les librairies d'exécution et les libraires de développement. Nous recommandons d'utiliser Qt 5.12.0+.
+ - Cairo 1.14.x. Nous recommandons 1.16.x ou ultérieur.
+ - Les librairies de développement CUPS - Scribus supporte maintenant directement l'impression avec CUPS. (Linux/UNIX/Mac OS X uniquement)
+ - fontconfig-devel - pour la découverte automatique des polices sous Linux, MacOSX et Unix. Pas nécessaire sous Windows.
+ - Freetype2 2.1.7+. À cause de nombreux problèmes de freetype2, nous recommandons, si votre distribution/système d'exploitation le permet, d'utiliser 2.1.10+
+ - Ghostscript 9.00+ est hautement recommandé.
+ - Littlecms - aussi connu comme lcms dans certaines distributions. Minimum 2.1, 2.9+ recommandé.
+ - libjpeg
+ - libtiff 3.6.0+
+ - libxml2 2.6+.
+ - Podofo 0.9 ou ultérieur. Utilisé pour améliorer l'import des fichiers Adobe Illustrator.
+ - Les librairies Python et python-devel 3.3+. Python 3.2 n'est pas supporté.
Scribus s'exécutera sous la plupart des gestionnaires de fenêtres et ne requiert pas KDE en soi. Cependant, les fonctionnalités de glisser-déposer seront perdues sans KDE. Un des développeurs de Scribus roule sous Gnome. L'auteur de cette documentation s'est astreint à tester chaque version de Scribus sous Blackbox également.
L'opération n'a révélé aucune incompatibilité ni problème, mise à part la perte de la fonctionnalité glisser-déposer.
@@ -32,13 +37,10 @@ CXXFLAGS="-march=athlon" serait bénéfique. V&eacu
pour des options détaillées
Optionnellement :
-- Les librairies de développement CUPS - Scribus supporte maintenant directement l'impression avec CUPS.
-- Les librairies de développement Gimp Print - Scribus supporte maintenant l'extension Gimp Print avec CUPS.
-- Littlecms - aussi connu comme lcms dans certaines distributions. Minimum 1.12, 1.16+ recommandé. lcms 1.12+ supporte la génération du point noir.
-- tkinter - pour le script d'échantillonnage de police
-- Les librairies python-imaging pour l'aperçu du script d'échantillonage de police
-- openssl-devel (Certaines distributions activent le support ssl pour CUPS, notamment Suse Linux)
-- fontconfig-devel - pour la découverte automatique des polices sous Linux, MacOSX et Unix. Pas nécessaire sous Windows.
+ - Les librairies de développement Gimp Print - Scribus supporte maintenant l'extension Gimp Print avec CUPS.
+ - tkinter - pour le script d'échantillonnage de police
+ - Les librairies python-imaging pour l'aperçu du script d'échantillonage de police
+ - openssl-devel (Certaines distributions activent le support ssl pour CUPS, notamment Suse Linux)