From 1f9e0e2dee75bcbc12fbe1b54c61de10e5a5f65c Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 28 Nov 2023 15:15:39 +0100 Subject: [PATCH 01/27] Add url protocol support for msi, nsis, dmg and pkg installers CURA-11288 --- UltiMaker-Cura.spec.jinja | 4 +++ packaging/NSIS/Ultimaker-Cura.nsi.jinja | 15 +++++++++++ packaging/msi/UltiMaker-Cura.wxs.jinja | 36 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/UltiMaker-Cura.spec.jinja b/UltiMaker-Cura.spec.jinja index 3d540d3b8f..cd939cf736 100644 --- a/UltiMaker-Cura.spec.jinja +++ b/UltiMaker-Cura.spec.jinja @@ -266,6 +266,10 @@ app = UMBUNDLE( 'CFBundlePackageType': 'APPL', 'CFBundleVersionString': {{ version }}, 'CFBundleShortVersionString': {{ short_version }}, + 'CFBundleURLTypes': [{ + 'CFBundleURLName': '{{ display_name }}', + 'CFBundleURLSchemes': ['cura', 'slicer'], + }], 'CFBundleDocumentTypes': [{ 'CFBundleTypeRole': 'Viewer', 'CFBundleTypeExtensions': ['*'], diff --git a/packaging/NSIS/Ultimaker-Cura.nsi.jinja b/packaging/NSIS/Ultimaker-Cura.nsi.jinja index 9996b24773..228dba4fe4 100644 --- a/packaging/NSIS/Ultimaker-Cura.nsi.jinja +++ b/packaging/NSIS/Ultimaker-Cura.nsi.jinja @@ -192,3 +192,18 @@ DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}" SectionEnd ###################################################################### + +Section UrlProtocol + WriteRegStr HKCR "cura" "" "URL:cura" + WriteRegStr HKCR "cura" "URL Protocol" "" + WriteRegStr HKCR "cura\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" + WriteRegStr HKCR "cura\shell" "" "open" + WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' + + WriteRegStr HKCR "slicer" "" "URL:slicer" + WriteRegStr HKCR "slicer" "URL Protocol" "" + WriteRegStr HKCR "slicer\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" + WriteRegStr HKCR "slicer\shell" "" "open" + WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' + +SectionEnd \ No newline at end of file diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index a183a97d5f..5ce8cd0a08 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -33,6 +33,21 @@ /> + + + + + {% if "Enterprise" in app_name %} @@ -144,11 +159,32 @@ + + + + + + + + + + + + + + + + + + + + + From d53b2d94abc0219995757c4c2e922226cefd0054 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 11:51:35 +0100 Subject: [PATCH 02/27] Add directory for wix components CURA-11288 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index 5ce8cd0a08..de441443f4 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -160,7 +160,7 @@ - + @@ -169,7 +169,7 @@ - + From 2b5f8b3a7c4a77e7eb99fc974996efcd4b77ace0 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 13:23:37 +0100 Subject: [PATCH 03/27] Remove deprecated `createAndRemoveOnUninstall` action from wix installer CURA-11288 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index de441443f4..07a2c7d8c9 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -161,7 +161,7 @@ - + @@ -170,7 +170,7 @@ - + From 87caa0307a80040a74d68a2060b9f34853e09115 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 13:28:33 +0100 Subject: [PATCH 04/27] Display message on open file event CURA-11288 --- cura/CuraApplication.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index c6c44cf8f5..0ac7118776 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1154,6 +1154,15 @@ class CuraApplication(QtApplication): """Handle Qt events""" if event.type() == QEvent.Type.FileOpen: + + result_message = Message( + f"file: {str(event.file())}, url: {str(event.url())}", + lifetime=0, + title="OPENING FILE", + message_type=Message.MessageType.NEUTRAL, + ) + result_message.show() + if self._plugins_loaded: self._openFile(event.file()) else: From ad871c627ed5a4de7e93613f83e7439d8030818c Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 13:42:48 +0100 Subject: [PATCH 05/27] Don't open file on open file event CURA-11288 --- cura/CuraApplication.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 0ac7118776..da1594c37b 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1163,10 +1163,10 @@ class CuraApplication(QtApplication): ) result_message.show() - if self._plugins_loaded: - self._openFile(event.file()) - else: - self._open_file_queue.append(event.file()) + # if self._plugins_loaded: + # self._openFile(event.file()) + # else: + # self._open_file_queue.append(event.file()) if int(event.type()) == 20: # 'QEvent.Type.Quit' enum isn't there, even though it should be according to docs. # Once we're at this point, everything should have been flushed already (past OnExitCallbackManager). From a442228f38d758870f7753870f03438e9fd6986b Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 30 Nov 2023 22:45:18 +0100 Subject: [PATCH 06/27] Open file on url scheme CURA-11289 --- cura/CuraApplication.py | 73 ++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 16 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index da1594c37b..e7289a225f 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -8,9 +8,11 @@ import time import platform from pathlib import Path from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict +import re +import requests import numpy -from PyQt6.QtCore import QObject, QTimer, QUrl, pyqtSignal, pyqtProperty, QEvent, pyqtEnum, QCoreApplication +from PyQt6.QtCore import QObject, QTimer, QUrl, QUrlQuery, pyqtSignal, pyqtProperty, QEvent, pyqtEnum, QCoreApplication from PyQt6.QtGui import QColor, QIcon from PyQt6.QtQml import qmlRegisterUncreatableType, qmlRegisterUncreatableMetaObject, qmlRegisterSingletonType, qmlRegisterType from PyQt6.QtWidgets import QMessageBox @@ -249,7 +251,7 @@ class CuraApplication(QtApplication): self._additional_components = {} # Components to add to certain areas in the interface self._open_file_queue = [] # A list of files to open (after the application has started) - + self._open_url_queue = [] # A list of urls to open (after the application has started) self._update_platform_activity_timer = None self._sidebar_custom_menu_items = [] # type: list # Keeps list of custom menu items for the side bar @@ -946,6 +948,8 @@ class CuraApplication(QtApplication): self.callLater(self._openFile, file_name) for file_name in self._open_file_queue: # Open all the files that were queued up while plug-ins were loading. self.callLater(self._openFile, file_name) + for url in self._open_url_queue: + self.callLater(self._openUrl, url) initializationFinished = pyqtSignal() showAddPrintersUncancellableDialog = pyqtSignal() # Used to show the add printers dialog with a greyed background @@ -1154,19 +1158,16 @@ class CuraApplication(QtApplication): """Handle Qt events""" if event.type() == QEvent.Type.FileOpen: - - result_message = Message( - f"file: {str(event.file())}, url: {str(event.url())}", - lifetime=0, - title="OPENING FILE", - message_type=Message.MessageType.NEUTRAL, - ) - result_message.show() - - # if self._plugins_loaded: - # self._openFile(event.file()) - # else: - # self._open_file_queue.append(event.file()) + if self._plugins_loaded: + if event.file(): + self._openFile(event.file()) + if event.url(): + self._openUrl(event.url()) + else: + if event.file(): + self._open_file_queue.append(event.file()) + if event.url(): + self._open_url_queue.append(event.url()) if int(event.type()) == 20: # 'QEvent.Type.Quit' enum isn't there, even though it should be according to docs. # Once we're at this point, everything should have been flushed already (past OnExitCallbackManager). @@ -1550,7 +1551,7 @@ class CuraApplication(QtApplication): if not nodes: return - objects_in_filename = {} # type: Dict[str, List[CuraSceneNode]] + objects_in_filename: Dict[str, List[CuraSceneNode]] = {} for node in nodes: mesh_data = node.getMeshData() if mesh_data: @@ -1791,6 +1792,46 @@ class CuraApplication(QtApplication): def _openFile(self, filename): self.readLocalFile(QUrl.fromLocalFile(filename)) + def _openUrl(self, url: QUrl) -> None: + supported_schemes = ["cura", "slicer"] + if url.scheme() not in supported_schemes: + # only handle cura:// and slicer:// urls schemes + return + + match url.host() + url.path(): + case "open": + query = QUrlQuery(url.query()) + model_url = QUrl(query.queryItemValue("file", options=QUrl.ComponentFormattingOption.FullyDecoded)) + response = requests.get(model_url.url()) + if response.status_code is not 200: + Logger.log("e", "Could not download file from {0}".format(model_url.url())) + return + + content_disposition = response.headers.get('Content-Disposition') + if content_disposition is None: + Logger.log("w", + "Could not find Content-Disposition header in response from {0}".format(model_url.url())) + # Use the last part of the url as the filename, and assume it is an STL file + filename = model_url.path().split("/")[-1] + ".stl" + else: + # content_disposition is in the following format + # ``` + # content_disposition attachment; "filename=[FILENAME]" + # ``` + # Use a regex to extract the filename + # content_disposition = response.headers.get('Content-Disposition') + content_disposition_match = re.match(r'attachment; filename="(?P.*)"', + content_disposition) + assert content_disposition_match is not None + filename = content_disposition_match.group("filename") + + tmp = tempfile.NamedTemporaryFile(suffix=filename, delete=False) + with open(tmp.name, "wb") as f: + f.write(response.content) + self.readLocalFile(QUrl.fromLocalFile(tmp.name), add_to_recent_files=False) + case path: + Logger.log("w", "Unsupported url scheme path: {0}".format(path)) + def _addProfileReader(self, profile_reader): # TODO: Add the profile reader to the list of plug-ins that can be used when importing profiles. pass From cf6874c98481bd899a4a47c9af05af1570688a34 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 1 Dec 2023 10:53:30 +0100 Subject: [PATCH 07/27] Use the `HttpRequestManager` to avoid blocking the main thread CURA-11289 --- cura/CuraApplication.py | 65 ++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index e7289a225f..079a27b6ce 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -2,17 +2,18 @@ # Cura is released under the terms of the LGPLv3 or higher. import enum import os +import re import sys import tempfile import time import platform from pathlib import Path from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict -import re import requests import numpy -from PyQt6.QtCore import QObject, QTimer, QUrl, QUrlQuery, pyqtSignal, pyqtProperty, QEvent, pyqtEnum, QCoreApplication +from PyQt6.QtCore import QObject, QTimer, QUrl, QUrlQuery, pyqtSignal, pyqtProperty, QEvent, pyqtEnum, QCoreApplication, \ + QByteArray from PyQt6.QtGui import QColor, QIcon from PyQt6.QtQml import qmlRegisterUncreatableType, qmlRegisterUncreatableMetaObject, qmlRegisterSingletonType, qmlRegisterType from PyQt6.QtWidgets import QMessageBox @@ -1802,33 +1803,43 @@ class CuraApplication(QtApplication): case "open": query = QUrlQuery(url.query()) model_url = QUrl(query.queryItemValue("file", options=QUrl.ComponentFormattingOption.FullyDecoded)) - response = requests.get(model_url.url()) - if response.status_code is not 200: - Logger.log("e", "Could not download file from {0}".format(model_url.url())) + + def on_finish(response): + content_disposition_header_key = QByteArray("content-disposition".encode()) + + if not response.hasRawHeader(content_disposition_header_key): + Logger.log("w", "Could not find Content-Disposition header in response from {0}".format( + model_url.url())) + # Use the last part of the url as the filename, and assume it is an STL file + filename = model_url.path().split("/")[-1] + ".stl" + else: + # content_disposition is in the format + # ``` + # content_disposition attachment; "filename=[FILENAME]" + # ``` + # Use a regex to extract the filename + content_disposition = str(response.rawHeader(content_disposition_header_key).data(), + encoding='utf-8') + content_disposition_match = re.match(r'attachment; filename="(?P.*)"', + content_disposition) + assert content_disposition_match is not None + filename = content_disposition_match.group("filename") + + tmp = tempfile.NamedTemporaryFile(suffix=filename, delete=False) + with open(tmp.name, "wb") as f: + f.write(response.readAll()) + + self.readLocalFile(QUrl.fromLocalFile(tmp.name), add_to_recent_files=False) + + def on_error(): + Logger.log("w", "Could not download file from {0}".format(model_url.url())) return - content_disposition = response.headers.get('Content-Disposition') - if content_disposition is None: - Logger.log("w", - "Could not find Content-Disposition header in response from {0}".format(model_url.url())) - # Use the last part of the url as the filename, and assume it is an STL file - filename = model_url.path().split("/")[-1] + ".stl" - else: - # content_disposition is in the following format - # ``` - # content_disposition attachment; "filename=[FILENAME]" - # ``` - # Use a regex to extract the filename - # content_disposition = response.headers.get('Content-Disposition') - content_disposition_match = re.match(r'attachment; filename="(?P.*)"', - content_disposition) - assert content_disposition_match is not None - filename = content_disposition_match.group("filename") - - tmp = tempfile.NamedTemporaryFile(suffix=filename, delete=False) - with open(tmp.name, "wb") as f: - f.write(response.content) - self.readLocalFile(QUrl.fromLocalFile(tmp.name), add_to_recent_files=False) + self.getHttpRequestManager().get( + model_url.url(), + callback=on_finish, + error_callback=on_error, + ) case path: Logger.log("w", "Unsupported url scheme path: {0}".format(path)) From 4b4b8b351462f7b788816c2ddbf2d75d38ee7de6 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 1 Dec 2023 13:03:40 +0100 Subject: [PATCH 08/27] Update nsi installer CURA-11288 --- packaging/NSIS/Ultimaker-Cura.nsi.jinja | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packaging/NSIS/Ultimaker-Cura.nsi.jinja b/packaging/NSIS/Ultimaker-Cura.nsi.jinja index 228dba4fe4..c562e5f654 100644 --- a/packaging/NSIS/Ultimaker-Cura.nsi.jinja +++ b/packaging/NSIS/Ultimaker-Cura.nsi.jinja @@ -197,13 +197,11 @@ Section UrlProtocol WriteRegStr HKCR "cura" "" "URL:cura" WriteRegStr HKCR "cura" "URL Protocol" "" WriteRegStr HKCR "cura\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" - WriteRegStr HKCR "cura\shell" "" "open" - WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' + WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}"' WriteRegStr HKCR "slicer" "" "URL:slicer" WriteRegStr HKCR "slicer" "URL Protocol" "" WriteRegStr HKCR "slicer\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" - WriteRegStr HKCR "slicer\shell" "" "open" - WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' + WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}"' SectionEnd \ No newline at end of file From 34aecf20fe4f8f5e1ff4e52e80969d2f4279cb15 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 1 Dec 2023 13:04:49 +0100 Subject: [PATCH 09/27] pin uranium CURA-11288 --- conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index 48cba847be..2c756f20c8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -327,7 +327,7 @@ class CuraConan(ConanFile): self.requires("pysavitar/5.3.0") self.requires("pynest2d/5.3.0") self.requires("curaengine_plugin_gradual_flow/0.1.0") - self.requires("uranium/(latest)@ultimaker/testing") + self.requires("uranium/latest@ultimaker/cura_11288") self.requires("cura_binary_data/(latest)@ultimaker/testing") self.requires("cpython/3.10.4") if self.options.internal: @@ -358,7 +358,7 @@ class CuraConan(ConanFile): vr = VirtualRunEnv(self) vr.generate() - self._generate_cura_version(os.path.join(self.source_folder, "cura")) + # self._generate_cura_version(os.path.join(self.source_folder, "cura")) if not self.in_local_cache: # Copy CuraEngine.exe to bindirs of Virtual Python Environment @@ -466,7 +466,7 @@ echo "CURA_APP_NAME={{ cura_app_name }}" >> ${{ env_prefix }}GITHUB_ENV ext = ".sh" if self.settings.os != "Windows" else ".ps1" save(self, os.path.join(self._script_dir, f"activate_github_actions_version_env{ext}"), activate_github_actions_version_env) - self._generate_cura_version(os.path.join(self._site_packages, "cura")) + # self._generate_cura_version(os.path.join(self._site_packages, "cura")) entitlements_file = "'{}'".format(Path(self.cpp_info.res_paths[2], "MacOS", "cura.entitlements")) self._generate_pyinstaller_spec(location = self._base_dir, From 19b75b96fb007973bb2fe3f3c0ef0e1e95567903 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Fri, 1 Dec 2023 16:13:19 +0100 Subject: [PATCH 10/27] unpin dulcificum CURA-11288 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 2c756f20c8..b58cbb4b7f 100644 --- a/conanfile.py +++ b/conanfile.py @@ -322,7 +322,7 @@ class CuraConan(ConanFile): self.requires("curaengine_grpc_definitions/0.1.0") self.requires("zlib/1.2.13") self.requires("pyarcus/5.3.0") - self.requires("dulcificum/0.1.0-beta.1") + self.requires("dulcificum/(latest)@ultimaker/testing") self.requires("curaengine/(latest)@ultimaker/testing") self.requires("pysavitar/5.3.0") self.requires("pynest2d/5.3.0") From b46f6e8e09582f49216e4f0af295a413b78c9e7e Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 5 Dec 2023 18:24:44 +0100 Subject: [PATCH 11/27] Add support for CLI file opening with 'cura' and 'slicer' schemes CURA-11288 --- cura/CuraApplication.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 079a27b6ce..a71b6d9915 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -276,6 +276,8 @@ class CuraApplication(QtApplication): self._conan_installs = ApplicationMetadata.CONAN_INSTALLS self._python_installs = ApplicationMetadata.PYTHON_INSTALLS + self._supported_url_schemes: List[str] = ["cura", "slicer"] + @pyqtProperty(str, constant=True) def ultimakerCloudApiRootUrl(self) -> str: return UltimakerCloudConstants.CuraCloudAPIRoot @@ -328,7 +330,11 @@ class CuraApplication(QtApplication): assert not "This crash is triggered by the trigger_early_crash command line argument." for filename in self._cli_args.file: - self._files_to_open.append(os.path.abspath(filename)) + url = QUrl(filename) + if url.scheme() in self._supported_url_schemes: + self._open_url_queue.append(url) + else: + self._files_to_open.append(os.path.abspath(filename)) def initialize(self) -> None: self.__addExpectedResourceDirsAndSearchPaths() # Must be added before init of super @@ -1794,8 +1800,7 @@ class CuraApplication(QtApplication): self.readLocalFile(QUrl.fromLocalFile(filename)) def _openUrl(self, url: QUrl) -> None: - supported_schemes = ["cura", "slicer"] - if url.scheme() not in supported_schemes: + if url.scheme() not in self._supported_url_schemes: # only handle cura:// and slicer:// urls schemes return From a7a4e4bd2911ae9a7a9095cb9d676b009233149a Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 06:06:08 +0100 Subject: [PATCH 12/27] Revert "Update nsi installer" This reverts commit 4b4b8b351462f7b788816c2ddbf2d75d38ee7de6. --- packaging/NSIS/Ultimaker-Cura.nsi.jinja | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/NSIS/Ultimaker-Cura.nsi.jinja b/packaging/NSIS/Ultimaker-Cura.nsi.jinja index c562e5f654..228dba4fe4 100644 --- a/packaging/NSIS/Ultimaker-Cura.nsi.jinja +++ b/packaging/NSIS/Ultimaker-Cura.nsi.jinja @@ -197,11 +197,13 @@ Section UrlProtocol WriteRegStr HKCR "cura" "" "URL:cura" WriteRegStr HKCR "cura" "URL Protocol" "" WriteRegStr HKCR "cura\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" - WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}"' + WriteRegStr HKCR "cura\shell" "" "open" + WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' WriteRegStr HKCR "slicer" "" "URL:slicer" WriteRegStr HKCR "slicer" "URL Protocol" "" WriteRegStr HKCR "slicer\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" - WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}"' + WriteRegStr HKCR "slicer\shell" "" "open" + WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' SectionEnd \ No newline at end of file From 351183f407360b89565084b0bdef72ff7e852570 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 06:13:39 +0100 Subject: [PATCH 13/27] Temporarily pin spdlog CURA-11288 --- conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conanfile.py b/conanfile.py index b58cbb4b7f..081db4d933 100644 --- a/conanfile.py +++ b/conanfile.py @@ -335,6 +335,7 @@ class CuraConan(ConanFile): self.requires("fdm_materials/(latest)@internal/testing") else: self.requires("fdm_materials/(latest)@ultimaker/testing") + self.requires("spdlog/1.12.0@_/_") def build_requirements(self): if self.options.get_safe("enable_i18n", False): From c4939701e1f3ee37314f8e71a27eb4196ab3f3e1 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 06:37:36 +0100 Subject: [PATCH 14/27] Re-enable genrate cura version CURA-11288 --- conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 081db4d933..ec5be608d6 100644 --- a/conanfile.py +++ b/conanfile.py @@ -359,7 +359,7 @@ class CuraConan(ConanFile): vr = VirtualRunEnv(self) vr.generate() - # self._generate_cura_version(os.path.join(self.source_folder, "cura")) + self._generate_cura_version(os.path.join(self.source_folder, "cura")) if not self.in_local_cache: # Copy CuraEngine.exe to bindirs of Virtual Python Environment @@ -467,7 +467,7 @@ echo "CURA_APP_NAME={{ cura_app_name }}" >> ${{ env_prefix }}GITHUB_ENV ext = ".sh" if self.settings.os != "Windows" else ".ps1" save(self, os.path.join(self._script_dir, f"activate_github_actions_version_env{ext}"), activate_github_actions_version_env) - # self._generate_cura_version(os.path.join(self._site_packages, "cura")) + self._generate_cura_version(os.path.join(self._site_packages, "cura")) entitlements_file = "'{}'".format(Path(self.cpp_info.res_paths[2], "MacOS", "cura.entitlements")) self._generate_pyinstaller_spec(location = self._base_dir, From 153e2e7bd073f4d7e367560345993525f7a5aebc Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 07:14:36 +0100 Subject: [PATCH 15/27] Fix warning/Boyscouting CURA-11288 --- cura/PrinterOutput/Models/MaterialOutputModel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/PrinterOutput/Models/MaterialOutputModel.py b/cura/PrinterOutput/Models/MaterialOutputModel.py index 6920cead1b..d60c34ed10 100644 --- a/cura/PrinterOutput/Models/MaterialOutputModel.py +++ b/cura/PrinterOutput/Models/MaterialOutputModel.py @@ -42,8 +42,7 @@ class MaterialOutputModel(QObject): "tpu" :{"name" :"tpu_175" ,"guid": "19baa6a9-94ff-478b-b4a1-8157b74358d2"} } - - if guid is None and brand is not "empty" and type in _MATERIAL_MAP: + if guid is None and brand != "empty" and type in _MATERIAL_MAP: name = _MATERIAL_MAP[type]["name"] guid = _MATERIAL_MAP[type]["guid"] return name, guid From d6a73a5976067078c7e7e63e2d6a12b89573d566 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 07:57:45 +0100 Subject: [PATCH 16/27] Fix opening files on windows `_open_url_queue` is expecting a list of strings, not a `QUrl` instance CURA-11288 --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a71b6d9915..82313eece8 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -332,7 +332,7 @@ class CuraApplication(QtApplication): for filename in self._cli_args.file: url = QUrl(filename) if url.scheme() in self._supported_url_schemes: - self._open_url_queue.append(url) + self._open_url_queue.append(filename) else: self._files_to_open.append(os.path.abspath(filename)) From 568fc4ca766afa3ee14f1620d925b90363196b09 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 08:49:37 +0100 Subject: [PATCH 17/27] Revert "Fix opening files on windows" This reverts commit d6a73a5976067078c7e7e63e2d6a12b89573d566. --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 82313eece8..a71b6d9915 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -332,7 +332,7 @@ class CuraApplication(QtApplication): for filename in self._cli_args.file: url = QUrl(filename) if url.scheme() in self._supported_url_schemes: - self._open_url_queue.append(filename) + self._open_url_queue.append(url) else: self._files_to_open.append(os.path.abspath(filename)) From 84d56367f4f357caec408e14e4d396d96aa13aef Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 6 Dec 2023 13:33:57 +0100 Subject: [PATCH 18/27] Also listen to the "/" appended string for url schemes Windows adds a slash for some reason CURA-11288 --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a71b6d9915..1f60130787 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1805,7 +1805,7 @@ class CuraApplication(QtApplication): return match url.host() + url.path(): - case "open": + case "open" | "open/": query = QUrlQuery(url.query()) model_url = QUrl(query.queryItemValue("file", options=QUrl.ComponentFormattingOption.FullyDecoded)) From 7574b56ebad4371efcbeb5bd42d0bbe864e317ec Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Thu, 7 Dec 2023 10:32:01 +0100 Subject: [PATCH 19/27] Update conanfile.py --- conanfile.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index 1ee2094490..678943759c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -326,13 +326,12 @@ class CuraConan(ConanFile): self.requires("curaengine_grpc_definitions/0.1.0") self.requires("zlib/1.2.13") self.requires("pyarcus/5.3.0") - self.requires("dulcificum/(latest)@ultimaker/testing") self.requires("dulcificum/(latest)@ultimaker/stable") self.requires("curaengine/(latest)@ultimaker/testing") self.requires("pysavitar/5.3.0") self.requires("pynest2d/5.3.0") self.requires("curaengine_plugin_gradual_flow/0.1.0") - self.requires("uranium/latest@ultimaker/testing") + self.requires("uranium/(latest)@ultimaker/testing") self.requires("cura_binary_data/(latest)@ultimaker/testing") self.requires("cpython/3.10.4@ultimaker/stable") self.requires("openssl/3.2.0") @@ -341,7 +340,6 @@ class CuraConan(ConanFile): self.requires("fdm_materials/(latest)@internal/testing") else: self.requires("fdm_materials/(latest)@ultimaker/testing") - self.requires("spdlog/1.12.0@_/_") def build_requirements(self): if self.options.get_safe("enable_i18n", False): From ddfd7d6a06842b2350b259ad9c22d8fd8fadcf06 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 19 Dec 2023 10:50:56 +0100 Subject: [PATCH 20/27] Use of APP_ASSOCIATE in url_scheme CURA-11288 --- packaging/NSIS/Ultimaker-Cura.nsi.jinja | 67 +++++++++++++++++++------ 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/packaging/NSIS/Ultimaker-Cura.nsi.jinja b/packaging/NSIS/Ultimaker-Cura.nsi.jinja index 228dba4fe4..3bef698805 100644 --- a/packaging/NSIS/Ultimaker-Cura.nsi.jinja +++ b/packaging/NSIS/Ultimaker-Cura.nsi.jinja @@ -144,6 +144,49 @@ SectionEnd ###################################################################### +Section UrlProtocol + +!macro APP_ASSOCIATE extension progid description commandname command + WriteRegStr HKCR "${extension}" "" "${description}" + WriteRegStr HKCR "${extension}" "URL Protocol" "" + WriteRegStr HKCR "${extension}\DefaultIcon" "" "${commandname},1" + WriteRegStr HKCR "${extension}\shell" "" "open" + WriteRegStr HKCR "${extension}\shell\open\command" "" '"${command}" "%1"' + !insertmacro APP_ASSOCIATE_SHORTCUT "${extension}" "${progid}" "${description}" "${command}" +!macroend + +WriteRegStr HKCR "cura" "" "URL:cura" +WriteRegStr HKCR "cura" "URL Protocol" "" +WriteRegStr HKCR "cura\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" +WriteRegStr HKCR "cura\shell" "" "open" +WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' + +WriteRegStr HKCR "slicer" "" "URL:slicer" +WriteRegStr HKCR "slicer" "URL Protocol" "" +WriteRegStr HKCR "slicer\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" +WriteRegStr HKCR "slicer\shell" "" "open" +WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' + +; Set the uninstall section flag for this section +SetSectionFlags ${SECTION_UNINSTALL} + +; Define file associations for 'cura' protocol +StrCpy $0 "cura" +StrCpy $1 "URL:cura" +StrCpy $2 "CURA Protocol" +StrCpy $3 "$INSTDIR\${MAIN_APP_EXE},1" +Call APP_ASSOCIATE + +; Define file associations for 'slicer' protocol +StrCpy $0 "slicer" +StrCpy $1 "URL:slicer" +StrCpy $2 "SLICER Protocol" +StrCpy $3 "$INSTDIR\${MAIN_APP_EXE},1" +Call APP_ASSOCIATE + +SectionEnd +###################################################################### + Section Uninstall ${INSTALL_TYPE}{% for files in mapped_out_paths.values() %}{% for file in files %} Delete "{{ file[1] }}"{% endfor %}{% endfor %}{% for rem_dir in rmdir_paths %} @@ -187,23 +230,15 @@ RmDir "$SMPROGRAMS\{{ app_name }}" !insertmacro APP_UNASSOCIATE "stl" "Cura.model" !insertmacro APP_UNASSOCIATE "3mf" "Cura.project" +; Unassociate file associations for 'cura' protocol +StrCpy $0 "cura" +Call APP_UNASSOCIATE + +; Unassociate file associations for 'slicer' protocol +StrCpy $0 "slicer" +Call APP_UNASSOCIATE + DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}" DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}" SectionEnd -###################################################################### - -Section UrlProtocol - WriteRegStr HKCR "cura" "" "URL:cura" - WriteRegStr HKCR "cura" "URL Protocol" "" - WriteRegStr HKCR "cura\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" - WriteRegStr HKCR "cura\shell" "" "open" - WriteRegStr HKCR "cura\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' - - WriteRegStr HKCR "slicer" "" "URL:slicer" - WriteRegStr HKCR "slicer" "URL Protocol" "" - WriteRegStr HKCR "slicer\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" - WriteRegStr HKCR "slicer\shell" "" "open" - WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' - -SectionEnd \ No newline at end of file From 5769fcba50134c7975437452a4a17f68927a6446 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 19 Dec 2023 13:26:19 +0100 Subject: [PATCH 21/27] Deleting the register key for url scheme CURA-11288 --- packaging/NSIS/Ultimaker-Cura.nsi.jinja | 32 ++----------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/packaging/NSIS/Ultimaker-Cura.nsi.jinja b/packaging/NSIS/Ultimaker-Cura.nsi.jinja index 3bef698805..0a2ce0f517 100644 --- a/packaging/NSIS/Ultimaker-Cura.nsi.jinja +++ b/packaging/NSIS/Ultimaker-Cura.nsi.jinja @@ -146,15 +146,6 @@ SectionEnd Section UrlProtocol -!macro APP_ASSOCIATE extension progid description commandname command - WriteRegStr HKCR "${extension}" "" "${description}" - WriteRegStr HKCR "${extension}" "URL Protocol" "" - WriteRegStr HKCR "${extension}\DefaultIcon" "" "${commandname},1" - WriteRegStr HKCR "${extension}\shell" "" "open" - WriteRegStr HKCR "${extension}\shell\open\command" "" '"${command}" "%1"' - !insertmacro APP_ASSOCIATE_SHORTCUT "${extension}" "${progid}" "${description}" "${command}" -!macroend - WriteRegStr HKCR "cura" "" "URL:cura" WriteRegStr HKCR "cura" "URL Protocol" "" WriteRegStr HKCR "cura\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" @@ -167,23 +158,6 @@ WriteRegStr HKCR "slicer\DefaultIcon" "" "$INSTDIR\${MAIN_APP_EXE},1" WriteRegStr HKCR "slicer\shell" "" "open" WriteRegStr HKCR "slicer\shell\open\command" "" '"$INSTDIR\${MAIN_APP_EXE}" "%1"' -; Set the uninstall section flag for this section -SetSectionFlags ${SECTION_UNINSTALL} - -; Define file associations for 'cura' protocol -StrCpy $0 "cura" -StrCpy $1 "URL:cura" -StrCpy $2 "CURA Protocol" -StrCpy $3 "$INSTDIR\${MAIN_APP_EXE},1" -Call APP_ASSOCIATE - -; Define file associations for 'slicer' protocol -StrCpy $0 "slicer" -StrCpy $1 "URL:slicer" -StrCpy $2 "SLICER Protocol" -StrCpy $3 "$INSTDIR\${MAIN_APP_EXE},1" -Call APP_ASSOCIATE - SectionEnd ###################################################################### @@ -231,12 +205,10 @@ RmDir "$SMPROGRAMS\{{ app_name }}" !insertmacro APP_UNASSOCIATE "3mf" "Cura.project" ; Unassociate file associations for 'cura' protocol -StrCpy $0 "cura" -Call APP_UNASSOCIATE +DeleteRegKey HKCR "cura" ; Unassociate file associations for 'slicer' protocol -StrCpy $0 "slicer" -Call APP_UNASSOCIATE +DeleteRegKey HKCR "slicer" DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}" DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}" From 69f8227b412e2eefa8e53b4c2e28fca6f803490c Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 19 Dec 2023 14:33:21 +0100 Subject: [PATCH 22/27] Path correction for cura application for msi CURA-11288 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index 07a2c7d8c9..e9cb01a041 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -164,8 +164,8 @@ - - + + @@ -173,8 +173,8 @@ - - + + From cb01026aad29777fdd2aa3eb05a6fbd9fe1f43ac Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 19 Dec 2023 15:27:53 +0100 Subject: [PATCH 23/27] Path correction for cura application for msi CURA-11288 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index e9cb01a041..c6ec5dbd63 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -164,8 +164,8 @@ - - + + @@ -173,8 +173,8 @@ - - + + From f663c57a927ca7a637bd382cd7b0ab9bc19c76aa Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Wed, 20 Dec 2023 08:50:37 +0100 Subject: [PATCH 24/27] Remove msi installer code Should be done for CURA-11435 CURA-11288 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 36 -------------------------- 1 file changed, 36 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index c6ec5dbd63..a183a97d5f 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -33,21 +33,6 @@ /> - - - - - {% if "Enterprise" in app_name %} @@ -159,32 +144,11 @@ - - - - - - - - - - - - - - - - - - - - - From f8f497b5781da97567077bff81bd75123b5bc3f4 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Wed, 20 Dec 2023 10:05:01 +0100 Subject: [PATCH 25/27] url registry entry for msi CURA-11435 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index a183a97d5f..c6ec5dbd63 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -33,6 +33,21 @@ /> + + + + + {% if "Enterprise" in app_name %} @@ -144,11 +159,32 @@ + + + + + + + + + + + + + + + + + + + + + From 76f86081c63c48652949d11d5c6aea62c5a4fd8b Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Wed, 20 Dec 2023 10:50:57 +0100 Subject: [PATCH 26/27] fixing the register entry CURA-11435 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 41 ++++++++++++++++++++------ 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index c6ec5dbd63..3dcb9ef2ee 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -160,24 +160,47 @@ - + + + + + + + + + + + + + + + + + + + + + 127.0.0.1 + + + + - - + + - + - - - - + + + + - From e08d183b6c424d9ecc5c5e4668e7e379edf0cabf Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Wed, 20 Dec 2023 10:56:25 +0100 Subject: [PATCH 27/27] undo commit 76f8608 CURA-11435 --- packaging/msi/UltiMaker-Cura.wxs.jinja | 37 +++++--------------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/packaging/msi/UltiMaker-Cura.wxs.jinja b/packaging/msi/UltiMaker-Cura.wxs.jinja index 3dcb9ef2ee..21f017c813 100644 --- a/packaging/msi/UltiMaker-Cura.wxs.jinja +++ b/packaging/msi/UltiMaker-Cura.wxs.jinja @@ -160,31 +160,7 @@ - - - - - - - - - - - - - - - - - - - - - 127.0.0.1 - - - - + @@ -193,14 +169,15 @@ - + - - - - + + + + +