Merge branch 'master' of lastycah.fablabchemnitz.de:MarioVoigt/mightyscape-1.X

This commit is contained in:
leyghisbb 2021-05-09 22:53:11 +02:00
commit 8c8614e4f8
3 changed files with 135 additions and 127 deletions

View File

@ -6,6 +6,7 @@ import shutil
import os import os
import sys import sys
import warnings import warnings
import shlex
""" """
Extension for InkScape 1.X Extension for InkScape 1.X
@ -36,15 +37,14 @@ DETACHED_PROCESS = 0x00000008
class AnimateOrder (inkex.EffectExtension): class AnimateOrder (inkex.EffectExtension):
def spawnIndependentProcess(self, args): #function to spawn non-blocking inkscape instance. the inkscape command is available because it is added to ENVIRONMENT when Inkscape main instance is started def spawnIndependentProcess(self, args): #function to spawn non-blocking inkscape instance. the inkscape command is available because it is added to ENVIRONMENT when Inkscape main instance is started
if os.name == 'nt':
warnings.simplefilter('ignore', ResourceWarning) #suppress "enable tracemalloc to get the object allocation traceback" warnings.simplefilter('ignore', ResourceWarning) #suppress "enable tracemalloc to get the object allocation traceback"
if os.name == 'nt':
subprocess.Popen(args, close_fds=True, creationflags=DETACHED_PROCESS) subprocess.Popen(args, close_fds=True, creationflags=DETACHED_PROCESS)
warnings.simplefilter("default", ResourceWarning)
else: else:
pid = os.fork() cmd = "nohup " + " ".join(args) + " &"
if pid == 0: # new process cmds = shlex.split(cmd)
os.system("nohup " + args + " &") subprocess.Popen(cmds, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
exit() warnings.simplefilter("default", ResourceWarning)
def add_arguments(self, pars): def add_arguments(self, pars):
pars.add_argument("--tab") pars.add_argument("--tab")

View File

@ -8,6 +8,7 @@ import os
import sys import sys
import subprocess import subprocess
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import shlex
import warnings import warnings
import inkex import inkex
import inkex.command import inkex.command
@ -22,7 +23,6 @@ logger = logging.getLogger(__name__)
DETACHED_PROCESS = 0x00000008 DETACHED_PROCESS = 0x00000008
GROUP_ID = 'export_selection_transform' GROUP_ID = 'export_selection_transform'
class ExportObject(inkex.EffectExtension): class ExportObject(inkex.EffectExtension):
def add_arguments(self, pars): def add_arguments(self, pars):
@ -43,15 +43,14 @@ class ExportObject(inkex.EffectExtension):
Popen(["xdg-open", dir], close_fds=True, start_new_session=True).wait() Popen(["xdg-open", dir], close_fds=True, start_new_session=True).wait()
def spawnIndependentInkscape(self, file): #function to spawn non-blocking inkscape instance. the inkscape command is available because it is added to ENVIRONMENT when Inkscape main instance is started def spawnIndependentInkscape(self, file): #function to spawn non-blocking inkscape instance. the inkscape command is available because it is added to ENVIRONMENT when Inkscape main instance is started
if os.name == 'nt':
warnings.simplefilter('ignore', ResourceWarning) #suppress "enable tracemalloc to get the object allocation traceback" warnings.simplefilter('ignore', ResourceWarning) #suppress "enable tracemalloc to get the object allocation traceback"
if os.name == 'nt':
Popen(["inkscape", file], close_fds=True, creationflags=DETACHED_PROCESS) Popen(["inkscape", file], close_fds=True, creationflags=DETACHED_PROCESS)
warnings.simplefilter("default", ResourceWarning)
else: else:
pid = os.fork() cmd = "nohup inkscape " + file + " &"
if pid == 0: # new process cmds = shlex.split(cmd)
os.system("nohup inkscape " + file + " &") subprocess.Popen(cmds, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
exit() warnings.simplefilter("default", ResourceWarning)
def effect(self): def effect(self):
if not self.svg.selected: if not self.svg.selected:

View File

@ -36,6 +36,15 @@ Module licenses
possible import file types -> https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-8.0-Documentation/a04096.html possible import file types -> https://www.graphics.rwth-aachen.de/media/openmesh_static/Documentations/OpenMesh-8.0-Documentation/a04096.html
todo:
- debug coplanar color for edges for some cases
- remove empty groups (text)
- abort if 0 faces
- give hints for joinery preparations (apply transform, ungroup, ...)
- update documentation accordingly
- make angleRange global for complete unfolding (to match glue pairs between multiple unfoldings)
- add angleRange to stats
""" """
# Compute the third point of a triangle when two points and all edge lengths are given # Compute the third point of a triangle when two points and all edge lengths are given