def cura_app_mock(): # Taken from cura_app.py import Arcus import Savitar if Platform.isLinux(): try: import ctypes from ctypes.util import find_library libGL = find_library("GL") ctypes.CDLL(libGL, ctypes.RTLD_GLOBAL) except: pass if Platform.isLinux() and getattr(sys, "frozen", False): old_env = os.environ.get("LD_LIBRARY_PATH", "") # This is where libopenctm.so is in the AppImage. search_path = os.path.join(CuraApplication.getInstallPrefix(), "bin") path_list = old_env.split(":") if search_path not in path_list: path_list.append(search_path) os.environ["LD_LIBRARY_PATH"] = ":".join(path_list) import trimesh.exchange.load os.environ["LD_LIBRARY_PATH"] = old_env sys.argv.clear() sys.argv.append("smartslicetests") sys.argv.append("--headless") return CuraApplication()
def collectAllSettingIds(): VersionUpgradeManager._VersionUpgradeManager__instance = VersionUpgradeManager( MagicMock()) application = CuraApplication() application._initializeSettingDefinitionsAndFunctions() definition_container = DefinitionContainer("whatever") with open(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "definitions", "fdmprinter.def.json"), encoding="utf-8") as data: definition_container.deserialize(data.read()) return definition_container.getAllKeys()
_crash_handler.early_crash_dialog.show() sys.exit(CuraApplication.getInstance().exec_()) else: _crash_handler.show() else: application = QApplication(sys.argv) application.removePostedEvents(None) _crash_handler = CrashHandler(hook_type, value, traceback, has_started) # This means the QtApplication could be created and so the splash screen. Then Cura closes it if CuraApplication.splash is not None: CuraApplication.splash.close() _crash_handler.early_crash_dialog.show() sys.exit(application.exec_()) # Set exception hook to use the crash dialog handler sys.excepthook = exceptHook # Enable dumping traceback for all threads faulthandler.enable(all_threads=True) # Workaround for a race condition on certain systems where there # is a race condition between Arcus and PyQt. Importing Arcus # first seems to prevent Sip from going into a state where it # tries to create PyQt objects on a non-main thread. import Arcus #@UnusedImport import Savitar #@UnusedImport from cura.CuraApplication import CuraApplication app = CuraApplication() app.run()