fix deprecation in inkcut

This commit is contained in:
Mario Voigt 2021-12-25 20:47:58 +01:00
parent 980772f41c
commit 1d7cb76dd0
3 changed files with 11 additions and 2 deletions

View File

@ -25,7 +25,6 @@ import inkex
from lxml import etree
from subprocess import Popen, PIPE
from shutil import copy2
from distutils.spawn import find_executable
def contains_text(nodes):
for node in nodes:
@ -42,7 +41,7 @@ def convert_objects_to_paths(file, document):
command = "inkscape " + tempfile + ' --actions="EditSelectAllInAllLayers;EditUnlinkClone;ObjectToPath;FileSave;FileQuit"'
if find_executable('xvfb-run'):
if shutil.which('xvfb-run'):
command = 'xvfb-run -a ' + command
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)

View File

@ -24,6 +24,7 @@ import os
import sys
import inkex
import shutil
from lxml import etree
import subprocess
from inkcut import contains_text, convert_objects_to_paths
@ -59,6 +60,10 @@ class InkscapeInkcutPlugin(inkex.Effect):
else:
cmd = ['inkcut']
if shutil.which('inkcut') is None:
inkex.errormsg("Error: inkcut executable not found!")
return
cmd += ['open', '-',
'--nodes']+[str(k) for k in nodes.keys()]
p = subprocess.Popen(cmd,

View File

@ -25,6 +25,7 @@ import os
import sys
import inkex
import importlib
import shutil
import subprocess
from lxml import etree
from inkcut import convert_objects_to_paths
@ -50,6 +51,10 @@ class InkscapeInkcutPlugin(inkex.Effect):
else:
cmd = ['inkcut']
if shutil.which('inkcut') is None:
inkex.errormsg("Error: inkcut executable not found!")
return
document = convert_objects_to_paths(self.options.input_file, self.document)
cmd += ['open', '-']