move inx to subdirs

This commit is contained in:
leyghisbb 2020-08-30 12:29:46 +02:00
parent 9a6167904a
commit 88039f5a72
2 changed files with 19 additions and 5 deletions

View File

@ -92,7 +92,10 @@ class Imagetracerjs (inkex.Effect):
image = Image.open(self.path)
# Write the embedded or linked image to temporary directory
exportfile = "imagetracerjs.png"
if os.name == "nt":
exportfile = "imagetracerjs.png"
else:
exportfile ="/tmp/imagetracerjs.png"
image.save(exportfile, "png")
nodeclipath = os.path.join("imagetracerjs-master", "nodecli", "nodecli.js")
@ -157,4 +160,4 @@ class Imagetracerjs (inkex.Effect):
else:
inkex.utils.debug("No image found for tracing. Please select an image first.")
Imagetracerjs().run()
Imagetracerjs().run()

View File

@ -91,11 +91,18 @@ class Primitive (inkex.Effect):
image = Image.open(self.path)
# Write the embedded or linked image to temporary directory
exportfile = "Primitive.png"
if os.name == "nt":
exportfile = "Primitive.png"
else:
exportfile = "/tmp/Primitive.png"
image.save(exportfile, "png")
## Build up Primitive command according to your settings from extension GUI
command = "primitive"
if os.name == "nt":
command = "primitive"
else:
command = "./primitive"
command += " -m " + str(self.options.m)
command += " -rep " + str(self.options.rep)
command += " -r " + str(self.options.r)
@ -116,6 +123,7 @@ class Primitive (inkex.Effect):
#inkex.utils.debug(result)
# proceed if new SVG file was successfully created
doc = None
if os.path.exists(exportfile + ".svg"):
# Delete the temporary png file again because we do not need it anymore
if os.path.exists(exportfile):
@ -136,6 +144,9 @@ class Primitive (inkex.Effect):
if os.path.exists(exportfile + ".svg"):
os.remove(exportfile + ".svg")
else:
inkex.utils.debug("Error while creating output file! :-( The \"primitive\" executable seems to be missing or platform is imcompatible.")
exit(1)
#remove the old image or not
if self.options.keeporiginal is not True:
node.getparent().remove(node)
@ -162,4 +173,4 @@ class Primitive (inkex.Effect):
else:
inkex.utils.debug("No image found for tracing. Please select an image first.")
Primitive().run()
Primitive().run()