diff --git a/extensions/fablabchemnitz/animate_order/animate_order.py b/extensions/fablabchemnitz/animate_order/animate_order.py index 84bd5d90..ed7501e9 100644 --- a/extensions/fablabchemnitz/animate_order/animate_order.py +++ b/extensions/fablabchemnitz/animate_order/animate_order.py @@ -36,7 +36,7 @@ DETACHED_PROCESS = 0x00000008 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): 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) diff --git a/extensions/fablabchemnitz/open_dir/meta.json b/extensions/fablabchemnitz/open_dir/meta.json new file mode 100644 index 00000000..399e06c7 --- /dev/null +++ b/extensions/fablabchemnitz/open_dir/meta.json @@ -0,0 +1,20 @@ +[ + { + "name": "Open Extension Directory", + "id": "fablabchemnitz.de.open_dir", + "path": "open_dir", + "dependent_extensions": null, + "original_name": "Animate Order", + "original_id": "fablabchemnitz.de.open_dir", + "license": "GNU GPL v3", + "license_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/LICENSE", + "comment": "Written by Mario Voigt", + "source_url": "https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X/src/branch/master/extensions/fablabchemnitz/animate_order", + "fork_url": null, + "documentation_url": "https://stadtfabrikanten.org/display/IFM/Open+Dir", + "inkscape_gallery_url": null, + "main_authors": [ + "github.com/vmario89" + ] + } +] \ No newline at end of file diff --git a/extensions/fablabchemnitz/open_dir/open_dir.inx b/extensions/fablabchemnitz/open_dir/open_dir.inx new file mode 100644 index 00000000..f596de70 --- /dev/null +++ b/extensions/fablabchemnitz/open_dir/open_dir.inx @@ -0,0 +1,14 @@ + + + Open Extension Directory + fablabchemnitz.de.open_dir + + all + + + + + + \ No newline at end of file diff --git a/extensions/fablabchemnitz/open_dir/open_dir.py b/extensions/fablabchemnitz/open_dir/open_dir.py new file mode 100644 index 00000000..30375963 --- /dev/null +++ b/extensions/fablabchemnitz/open_dir/open_dir.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +import subprocess +import os +import sys +import warnings +import inkex + +DETACHED_PROCESS = 0x00000008 + +class OpenExtensionDirectory(inkex.EffectExtension): + + def spawnIndependentProcess(self, args): + 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) + else: + subprocess.Popen(args, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + warnings.simplefilter("default", ResourceWarning) + + def effect(self): + extension_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..') + + if os.name == 'nt': + explorer = "explorer" + else: + explorer = "xdg-open" + args = [explorer, extension_dir] + try: + self.spawnIndependentProcess(args) + except FileNotFoundError as e: + inkex.utils.debug(e) + exit(1) + +if __name__ == '__main__': + OpenExtensionDirectory().run() \ No newline at end of file