fix deprecation in inkcut
This commit is contained in:
parent
980772f41c
commit
1d7cb76dd0
@ -25,7 +25,6 @@ import inkex
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
from shutil import copy2
|
from shutil import copy2
|
||||||
from distutils.spawn import find_executable
|
|
||||||
|
|
||||||
def contains_text(nodes):
|
def contains_text(nodes):
|
||||||
for node in 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"'
|
command = "inkscape " + tempfile + ' --actions="EditSelectAllInAllLayers;EditUnlinkClone;ObjectToPath;FileSave;FileQuit"'
|
||||||
|
|
||||||
if find_executable('xvfb-run'):
|
if shutil.which('xvfb-run'):
|
||||||
command = 'xvfb-run -a ' + command
|
command = 'xvfb-run -a ' + command
|
||||||
|
|
||||||
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
|
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
|
@ -24,6 +24,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import inkex
|
import inkex
|
||||||
|
import shutil
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
import subprocess
|
import subprocess
|
||||||
from inkcut import contains_text, convert_objects_to_paths
|
from inkcut import contains_text, convert_objects_to_paths
|
||||||
@ -59,6 +60,10 @@ class InkscapeInkcutPlugin(inkex.Effect):
|
|||||||
else:
|
else:
|
||||||
cmd = ['inkcut']
|
cmd = ['inkcut']
|
||||||
|
|
||||||
|
if shutil.which('inkcut') is None:
|
||||||
|
inkex.errormsg("Error: inkcut executable not found!")
|
||||||
|
return
|
||||||
|
|
||||||
cmd += ['open', '-',
|
cmd += ['open', '-',
|
||||||
'--nodes']+[str(k) for k in nodes.keys()]
|
'--nodes']+[str(k) for k in nodes.keys()]
|
||||||
p = subprocess.Popen(cmd,
|
p = subprocess.Popen(cmd,
|
||||||
|
@ -25,6 +25,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import inkex
|
import inkex
|
||||||
import importlib
|
import importlib
|
||||||
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from inkcut import convert_objects_to_paths
|
from inkcut import convert_objects_to_paths
|
||||||
@ -50,6 +51,10 @@ class InkscapeInkcutPlugin(inkex.Effect):
|
|||||||
else:
|
else:
|
||||||
cmd = ['inkcut']
|
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)
|
document = convert_objects_to_paths(self.options.input_file, self.document)
|
||||||
|
|
||||||
cmd += ['open', '-']
|
cmd += ['open', '-']
|
||||||
|
Reference in New Issue
Block a user