summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnout Engelen <arnouten@bzzt.net>2018-02-09 22:21:50 +0000
committerEduard Braun <eduard.braun2@gmx.de>2018-03-03 14:03:32 +0000
commitdcb8b50b507e696581be7adaf14deda774ef4da7 (patch)
tree5c89cc1353b594a2d0e99035371a815c70e6b682
parentSource typos (diff)
downloadinkscape-dcb8b50b507e696581be7adaf14deda774ef4da7.tar.gz
inkscape-dcb8b50b507e696581be7adaf14deda774ef4da7.zip
If available, run 'background' inkscape inside xvfb-run (!201)
-rw-r--r--share/extensions/hpgl_encoder.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/share/extensions/hpgl_encoder.py b/share/extensions/hpgl_encoder.py
index e8c7a6151..d9a15ef36 100644
--- a/share/extensions/hpgl_encoder.py
+++ b/share/extensions/hpgl_encoder.py
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import math
import re
import string
+from distutils.spawn import find_executable
from subprocess import Popen, PIPE
from shutil import copy2
# local libraries
@@ -116,8 +117,13 @@ class hpglEncoder:
# so that we can open and close it silently
copy2(file, tempfile)
+ command = 'inkscape --verb=EditSelectAllInAllLayers --verb=EditUnlinkClone --verb=ObjectToPath --verb=FileSave --verb=FileQuit ' + tempfile
+
+ if find_executable('xvfb-run'):
+ command = 'xvfb-run ' + command
+
# Unfortunately this briefly pops up the GUI and cannot be done with -z, see https://bugs.launchpad.net/inkscape/+bug/843260
- p = Popen('inkscape --verb=EditSelectAllInAllLayers --verb=EditUnlinkClone --verb=ObjectToPath --verb=FileSave --verb=FileQuit ' + tempfile, shell=True, stdout=PIPE, stderr=PIPE)
+ p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
(out, err) = p.communicate()
if p.returncode != 0: