From fed0a015eefd87c4ca0cf63c78cffe249dcc7b91 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 29 May 2018 15:56:00 +0200 Subject: [PATCH 1/5] Clear is_user_specified_job_name flag when setting a project file name CURA-5280 --- cura/PrintInformation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 2c9f6511fa..9239dec8b7 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -329,6 +329,8 @@ class PrintInformation(QObject): baseNameChanged = pyqtSignal() def setBaseName(self, base_name: str, is_project_file: bool = False): + self._is_user_specified_job_name = False + # Ensure that we don't use entire path but only filename name = os.path.basename(base_name) From b46a08f566b573dee767d1216fc9c340e350e02b Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 29 May 2018 18:15:16 +0200 Subject: [PATCH 2/5] Add Reft and Right side aligned action buttons to the message box CURA-4952 --- cura/CuraApplication.py | 2 +- .../FirmwareUpdateCheckerJob.py | 14 ++++++++++++-- plugins/SliceInfoPlugin/SliceInfo.py | 5 +++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index ed4336a9a0..34b6b5cde1 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -452,7 +452,7 @@ class CuraApplication(QtApplication): ## A reusable dialogbox # - showMessageBox = pyqtSignal(str, str, str, str, str, int, int, arguments = ["title", "footer", "text", "informativeText", "detailedText", "buttons", "icon"]) + showMessageBox = pyqtSignal(str, str, str, str, int, int, arguments = ["title", "text", "informativeText", "detailedText", "buttons", "icon"]) def messageBox(self, title, text, informativeText = "", detailedText = "", buttons = QMessageBox.Ok, icon = QMessageBox.NoIcon, callback = None, callback_arguments = []): self._message_box_callback = callback diff --git a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py index 19b77c1181..089d1847ed 100644 --- a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py +++ b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py @@ -75,9 +75,19 @@ class FirmwareUpdateCheckerJob(Job): machine_name=machine_name), title=i18n_catalog.i18nc( "@info:title The %s gets replaced with the printer name.", - "New %s firmware available") % machine_name, - footer = footer_message) + "New %s firmware available") % machine_name) + message.addAction("download", + i18n_catalog.i18nc("@action:button", "How to update"), + "[no_icon]", + "[no_description]", + button_style=Message.ActionButtonStyle.LINK, + button_align=Message.ActionButtonStyle.BUTTON_ALIGN_LEFT) + + + # If we do this in a cool way, the download url should be available in the JSON file + if self._set_download_url_callback: + self._set_download_url_callback("https://ultimaker.com/en/resources/20500-upgrade-firmware") message.actionTriggered.connect(self._callback) message.show() diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 82e07da464..b0525bdbfa 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -46,10 +46,11 @@ class SliceInfo(QObject, Extension): dismissable = False, title = catalog.i18nc("@info:title", "Collecting Data")) - self.send_slice_info_message.addAction("Dismiss", name = catalog.i18nc("@action:button", "Allow"), icon = None, - description = catalog.i18nc("@action:tooltip", "Allow Cura to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing.")) self.send_slice_info_message.addAction("MoreInfo", name = catalog.i18nc("@action:button", "More info"), icon = None, description = catalog.i18nc("@action:tooltip", "See more information on what data Cura sends."), button_style = Message.ActionButtonStyle.LINK) + + self.send_slice_info_message.addAction("Dismiss", name = catalog.i18nc("@action:button", "Allow"), icon = None, + description = catalog.i18nc("@action:tooltip", "Allow Cura to send anonymized usage statistics to help prioritize future improvements to Cura. Some of your preferences and settings are sent, the Cura version and a hash of the models you're slicing.")) self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered) self.send_slice_info_message.show() From 4d6753a1f163d78a9fe61756c94d22e674887a46 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 29 May 2018 18:33:38 +0200 Subject: [PATCH 3/5] remove unused code lines in firmware checker CURA-4952 --- plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py index 089d1847ed..ce4fb8c92f 100644 --- a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py +++ b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py @@ -64,11 +64,6 @@ class FirmwareUpdateCheckerJob(Job): if (checked_version != "") and (checked_version != current_version): Logger.log("i", "SHOWING FIRMWARE UPDATE MESSAGE") - footer_text = i18n_catalog.i18nc("@action:info", "Read more on how to update printer firmware") - footer_link = "?url=https://ultimaker.com/en/resources/23129-updating-the-firmware?utm_source=cura&utm_medium=software&utm_campaign=hw-update" - - footer_message = footer_text + " " + footer_link - message = Message(i18n_catalog.i18nc( "@info Don't translate {machine_name}, since it gets replaced by a printer name!", "New features are available for your {machine_name}! It is recommended to update the firmware on your printer.").format( From 80d4989843f4c629a562d9816cabeaa276e2a110 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 30 May 2018 09:03:34 +0200 Subject: [PATCH 4/5] Show keep/discard user settings dialog upon variant change CURA-5417 --- cura/Settings/MachineManager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 84ffc8aaf4..5c87b6ffba 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1350,6 +1350,10 @@ class MachineManager(QObject): self._updateMaterialWithVariant(position) self._updateQualityWithMaterial() + # See if we need to show the Discard or Keep changes screen + if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1: + self._application.discardOrKeepProfileChanges() + @pyqtSlot(str) def setQualityGroupByQualityType(self, quality_type: str) -> None: if self._global_container_stack is None: From 13b3e4afa5c00ab3baab0570d318467f50fdf688 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Tue, 29 May 2018 16:34:36 +0200 Subject: [PATCH 5/5] CURA-5357 Drag & dribble multiple packages like a plugable trickle, yo Also improved interfacing with `CuraVersion.py` --- plugins/Toolbox/src/Toolbox.py | 62 ++++++++++++++++++++-------------- resources/qml/Cura.qml | 15 ++++---- 2 files changed, 46 insertions(+), 31 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index e540bce523..b9e7f8f94d 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -28,7 +28,8 @@ i18n_catalog = i18nCatalog("cura") ## The Toolbox class is responsible of communicating with the server through the API class Toolbox(QObject, Extension): - DEFAULT_PACKAGES_API_ROOT = "https://api.ultimaker.com" + DEFAULT_CLOUD_API_ROOT = "https://api.ultimaker.com" + DEFAULT_CLOUD_API_VERSION = 1 def __init__(self, parent=None) -> None: super().__init__(parent) @@ -37,16 +38,10 @@ class Toolbox(QObject, Extension): self._package_manager = None self._plugin_registry = Application.getInstance().getPluginRegistry() - self._sdk_version = self._getPackagesVersion() - - self._cloud_api_version = 1 - self._cloud_api_root = self._getPackagesApiRoot() - - self._api_url = "{cloud_api_root}/cura-packages/v{cloud_api_version}/cura/v{sdk_version}".format( - cloud_api_root = self._cloud_api_root, - cloud_api_version = self._cloud_api_version, - sdk_version = self._sdk_version - ) + self._sdk_version = None + self._cloud_api_version = None + self._cloud_api_root = None + self._api_url = None # Network: self._get_packages_request = None @@ -67,12 +62,7 @@ class Toolbox(QObject, Extension): ) ) ] - self._request_urls = { - "authors": QUrl("{base_url}/authors".format(base_url = self._api_url)), - "packages": QUrl("{base_url}/packages".format(base_url = self._api_url)), - "plugins_showcase": QUrl("{base_url}/showcase".format(base_url = self._api_url)), - "materials_showcase": QUrl("{base_url}/showcase".format(base_url = self._api_url)) - } + self._request_urls = {} self._to_update = [] # Package_ids that are waiting to be updated # Data: @@ -164,22 +154,44 @@ class Toolbox(QObject, Extension): # this is initialized. Therefore, we wait until the application is ready. def _onAppInitialized(self) -> None: self._package_manager = Application.getInstance().getCuraPackageManager() + self._sdk_version = self._getSDKVersion() + self._cloud_api_version = self._getCloudAPIVersion() + self._cloud_api_root = self._getCloudAPIRoot() + self._api_url = "{cloud_api_root}/cura-packages/v{cloud_api_version}/cura/v{sdk_version}".format( + cloud_api_root=self._cloud_api_root, + cloud_api_version=self._cloud_api_version, + sdk_version=self._sdk_version + ) + self._request_urls = { + "authors": QUrl("{base_url}/authors".format(base_url=self._api_url)), + "packages": QUrl("{base_url}/packages".format(base_url=self._api_url)), + "plugins_showcase": QUrl("{base_url}/showcase".format(base_url=self._api_url)), + "materials_showcase": QUrl("{base_url}/showcase".format(base_url=self._api_url)) + } # Get the API root for the packages API depending on Cura version settings. - def _getPackagesApiRoot(self) -> str: + def _getCloudAPIRoot(self) -> str: if not hasattr(cura, "CuraVersion"): - return self.DEFAULT_PACKAGES_API_ROOT - if not hasattr(cura.CuraVersion, "CuraPackagesApiRoot"): - return self.DEFAULT_PACKAGES_API_ROOT - return cura.CuraVersion.CuraPackagesApiRoot + return self.DEFAULT_CLOUD_API_ROOT + if not hasattr(cura.CuraVersion, "CuraCloudAPIRoot"): + return self.DEFAULT_CLOUD_API_ROOT + return cura.CuraVersion.CuraCloudAPIRoot + + # Get the cloud API version from CuraVersion + def _getCloudAPIVersion(self) -> int: + if not hasattr(cura, "CuraVersion"): + return self.DEFAULT_CLOUD_API_VERSION + if not hasattr(cura.CuraVersion, "CuraCloudAPIVersion"): + return self.DEFAULT_CLOUD_API_VERSION + return cura.CuraVersion.CuraCloudAPIVersion # Get the packages version depending on Cura version settings. - def _getPackagesVersion(self) -> int: + def _getSDKVersion(self) -> int: if not hasattr(cura, "CuraVersion"): return self._plugin_registry.APIVersion - if not hasattr(cura.CuraVersion, "CuraPackagesVersion"): + if not hasattr(cura.CuraVersion, "CuraSDKVersion"): return self._plugin_registry.APIVersion - return cura.CuraVersion.CuraPackagesVersion + return cura.CuraVersion.CuraSDKVersion @pyqtSlot() def browsePackages(self) -> None: diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index e1cc4f6e45..b8f289278c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -323,10 +323,11 @@ UM.MainWindow { if (drop.urls.length > 0) { - // As the drop area also supports plugins, first check if it's a plugin that was dropped. - if (drop.urls.length == 1) + + var nonPackages = []; + for (var i = 0; i < drop.urls.length; i++) { - var filename = drop.urls[0]; + var filename = drop.urls[i]; if (filename.endsWith(".curapackage")) { // Try to install plugin & close. @@ -334,11 +335,13 @@ UM.MainWindow packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting."); packageInstallDialog.icon = StandardIcon.Information; packageInstallDialog.open(); - return; + } + else + { + others.push(filename); } } - - openDialog.handleOpenFileUrls(drop.urls); + openDialog.handleOpenFileUrls(nonPackages); } } }