From 6492dbeee8dbead146e1dc5e2c2ba64a2dd019a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Thu, 7 Apr 2022 00:20:50 +0100 Subject: [PATCH] Create UVtoolsBootstrap.py --- Scripts/UVtools.Python/UVtoolsBootstrap.py | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Scripts/UVtools.Python/UVtoolsBootstrap.py diff --git a/Scripts/UVtools.Python/UVtoolsBootstrap.py b/Scripts/UVtools.Python/UVtoolsBootstrap.py new file mode 100644 index 0000000..dfa2ddf --- /dev/null +++ b/Scripts/UVtools.Python/UVtoolsBootstrap.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +""" + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. +""" +from clr_loader import get_coreclr +from pythonnet import set_runtime +import sys +import platform +import os + +UVTOOLS_PATH = None +if platform.system() == 'Windows': + try: + import winreg + + key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'Software\UVtools', 0, winreg.KEY_READ) + UVTOOLS_PATH = winreg.QueryValueEx(key, 'InstallDir')[0] + if key: + winreg.CloseKey(key) + except: + pass +else: + UVTOOLS_PATH = os.getenv('UVTOOLS_PATH') + +if UVTOOLS_PATH is None or not os.path.exists(UVTOOLS_PATH): + print("Unable to find UVtools path, please install and register the path with a Environment Variable (UVTOOLS_PATH)") + exit(-1) + +# Don't touch +# Set runtime +sys.path.append(UVTOOLS_PATH) +rt = get_coreclr(r"UVtools.runtimeconfig.json") +set_runtime(rt) +import clr + +clr.AddReference(r"UVtools.Core") +from UVtools.Core import * +from UVtools.Core.EmguCV import * +from UVtools.Core.Extensions import * +from UVtools.Core.FileFormats import * +from UVtools.Core.GCode import * +from UVtools.Core.Layers import * +from UVtools.Core.Managers import * +from UVtools.Core.MeshFormats import * +from UVtools.Core.Network import * +from UVtools.Core.Objects import * +from UVtools.Core.Operations import * +from UVtools.Core.PixelEditor import * +from UVtools.Core.Printer import * +from UVtools.Core.Scripting import * +from UVtools.Core.Suggestions import * +from UVtools.Core.SystemOS import * + +print(f'{About.SoftwareWithVersionArch}') \ No newline at end of file