From 3d352b3585cd3730912836d4105169b9221e3813 Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 4 Nov 2019 15:44:04 +0100 Subject: [PATCH 1/6] Show welcome page in marketplace window when not logged in TODO: marketplace logo CURA-6569 --- plugins/Toolbox/resources/qml/Toolbox.qml | 9 ++++ plugins/Toolbox/resources/qml/WelcomePage.qml | 53 +++++++++++++++++++ plugins/Toolbox/src/Toolbox.py | 23 ++++++-- resources/qml/MainWindow/ApplicationMenu.qml | 2 +- 4 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 plugins/Toolbox/resources/qml/WelcomePage.qml diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index f70dab03d8..cf69231428 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -1,6 +1,8 @@ // Copyright (c) 2018 Ultimaker B.V. // Toolbox is released under the terms of the LGPLv3 or higher. +// Main window for the Toolbox + import QtQuick 2.2 import QtQuick.Dialogs 1.1 import QtQuick.Window 2.2 @@ -29,9 +31,16 @@ Window Item { anchors.fill: parent + + WelcomePage + { + visible: toolbox.viewPage === "welcome" + } + ToolboxHeader { id: header + visible: toolbox.viewPage !== "welcome" } Item diff --git a/plugins/Toolbox/resources/qml/WelcomePage.qml b/plugins/Toolbox/resources/qml/WelcomePage.qml new file mode 100644 index 0000000000..a89b490b51 --- /dev/null +++ b/plugins/Toolbox/resources/qml/WelcomePage.qml @@ -0,0 +1,53 @@ +// Copyright (c) 2018 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.7 +import QtQuick.Controls 2.1 +import QtQuick.Window 2.2 + +import UM 1.3 as UM +import Cura 1.1 as Cura + +Column +{ + id: welcomePage + spacing: UM.Theme.getSize("wide_margin").height + width: parent.width + height: childrenRect.height + anchors.centerIn: parent + + Image + { + id: profileImage + fillMode: Image.PreserveAspectFit + source: "../images/logobot.svg" + anchors.horizontalCenter: parent.horizontalCenter + width: Math.round(parent.width / 4) + } + + Label + { + id: welcomeTextLabel + text: catalog.i18nc("@description", "Get plugins and materials verified by Ultimaker") + width: Math.round(parent.width / 2) + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + anchors.horizontalCenter: parent.horizontalCenter + wrapMode: Label.WordWrap + renderType: Text.NativeRendering + } + + Cura.PrimaryButton + { + id: loginButton + width: UM.Theme.getSize("account_button").width + height: UM.Theme.getSize("account_button").height + anchors.horizontalCenter: parent.horizontalCenter + text: catalog.i18nc("@button", "Sign in") + onClicked: Cura.API.account.login() + fixedWidthMode: true + } +} + diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 869ac6ab5e..9f8273d6e8 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -86,7 +86,7 @@ class Toolbox(QObject, Extension): # View page defines which type of page layout to use. For example, # possible values include "overview", "detail" or "author". - self._view_page = "loading" # type: str + self._view_page = "welcome" # type: str # Active package refers to which package is currently being downloaded, # installed, or otherwise modified. @@ -105,7 +105,6 @@ class Toolbox(QObject, Extension): self._restart_dialog_message = "" # type: str self._application.initializationFinished.connect(self._onAppInitialized) - self._application.getCuraAPI().account.loginStateChanged.connect(self._updateRequestHeader) self._application.getCuraAPI().account.accessTokenChanged.connect(self._updateRequestHeader) # Signals: @@ -126,6 +125,14 @@ class Toolbox(QObject, Extension): showLicenseDialog = pyqtSignal() uninstallVariablesChanged = pyqtSignal() + def _loginStateChanged(self): + self._updateRequestHeader() + if self._application.getCuraAPI().account.isLoggedIn: + self.setViewPage("loading") + self._fetchPackageData() + else: + self.setViewPage("welcome") + def _updateRequestHeader(self): self._request_headers = [ (b"User-Agent", @@ -191,6 +198,8 @@ class Toolbox(QObject, Extension): "packages": QUrl("{base_url}/packages".format(base_url = self._api_url)) } + self._application.getCuraAPI().account.loginStateChanged.connect(self._loginStateChanged) + if CuraApplication.getInstance().getPreferences().getValue("info/automatic_update_check"): # Request the latest and greatest! self._fetchPackageData() @@ -213,9 +222,9 @@ class Toolbox(QObject, Extension): # Gather installed packages: self._updateInstalledModels() + # Displays the toolbox @pyqtSlot() - def browsePackages(self) -> None: - self._fetchPackageData() + def launch(self) -> None: if not self._dialog: self._dialog = self._createDialog("Toolbox.qml") @@ -224,6 +233,12 @@ class Toolbox(QObject, Extension): Logger.log("e", "Unexpected error trying to create the 'Marketplace' dialog.") return + if self._application.getCuraAPI().account.isLoggedIn: + self.setViewPage("loading") + self._fetchPackageData() + else: + self.setViewPage("welcome") + self._dialog.show() # Apply enabled/disabled state to installed plugins diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 70d7cd422c..30e44d7d3b 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -160,7 +160,7 @@ Item target: Cura.Actions.browsePackages onTriggered: { - curaExtensions.callExtensionMethod("Toolbox", "browsePackages") + curaExtensions.callExtensionMethod("Toolbox", "launch") } } } \ No newline at end of file From 7af5f132e07af6e3bdb2f848ca3f331116f40f8e Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 4 Nov 2019 16:15:00 +0100 Subject: [PATCH 2/6] Only show toolbox/marketplace welcome screen for Essentials builds CURA-6569 --- plugins/Toolbox/src/Toolbox.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 9f8273d6e8..9caf95eab0 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -125,13 +125,15 @@ class Toolbox(QObject, Extension): showLicenseDialog = pyqtSignal() uninstallVariablesChanged = pyqtSignal() - def _loginStateChanged(self): + ## Go back to the start state (welcome screen or loading if no login required) + def _restart(self): self._updateRequestHeader() - if self._application.getCuraAPI().account.isLoggedIn: + # For an Essentials build, login is mandatory + if not self._application.getCuraAPI().account.isLoggedIn and ApplicationMetadata.CuraBuildType == "essentials": + self.setViewPage("welcome") + else: self.setViewPage("loading") self._fetchPackageData() - else: - self.setViewPage("welcome") def _updateRequestHeader(self): self._request_headers = [ @@ -198,7 +200,7 @@ class Toolbox(QObject, Extension): "packages": QUrl("{base_url}/packages".format(base_url = self._api_url)) } - self._application.getCuraAPI().account.loginStateChanged.connect(self._loginStateChanged) + self._application.getCuraAPI().account.loginStateChanged.connect(self._restart) if CuraApplication.getInstance().getPreferences().getValue("info/automatic_update_check"): # Request the latest and greatest! @@ -233,11 +235,7 @@ class Toolbox(QObject, Extension): Logger.log("e", "Unexpected error trying to create the 'Marketplace' dialog.") return - if self._application.getCuraAPI().account.isLoggedIn: - self.setViewPage("loading") - self._fetchPackageData() - else: - self.setViewPage("welcome") + self._restart() self._dialog.show() From ed7134ded888d2276ea7d947c926edb82deff82b Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Mon, 4 Nov 2019 17:35:24 +0100 Subject: [PATCH 3/6] Organize Toolbox (marketplace) qml files according to type CURA-6569 --- cura/ApplicationMetadata.py | 2 +- plugins/Toolbox/resources/qml/Toolbox.qml | 4 ++++ .../Toolbox/resources/qml/{ => components}/RatingWidget.qml | 0 .../resources/qml/{ => components}/SmallRatingWidget.qml | 0 .../qml/{ => components}/ToolboxActionButtonStyle.qml | 0 .../resources/qml/{ => components}/ToolboxBackColumn.qml | 0 .../qml/{ => components}/ToolboxCompatibilityChart.qml | 0 .../resources/qml/{ => components}/ToolboxDetailList.qml | 0 .../resources/qml/{ => components}/ToolboxDetailTile.qml | 0 .../qml/{ => components}/ToolboxDetailTileActions.qml | 0 .../resources/qml/{ => components}/ToolboxDownloadsGrid.qml | 0 .../qml/{ => components}/ToolboxDownloadsGridTile.qml | 4 ++-- .../qml/{ => components}/ToolboxDownloadsShowcase.qml | 0 .../qml/{ => components}/ToolboxDownloadsShowcaseTile.qml | 4 ++-- .../Toolbox/resources/qml/{ => components}/ToolboxFooter.qml | 0 .../Toolbox/resources/qml/{ => components}/ToolboxHeader.qml | 0 .../resources/qml/{ => components}/ToolboxInstalledTile.qml | 0 .../qml/{ => components}/ToolboxInstalledTileActions.qml | 0 .../resources/qml/{ => components}/ToolboxProgressButton.qml | 0 .../Toolbox/resources/qml/{ => components}/ToolboxShadow.qml | 0 .../resources/qml/{ => components}/ToolboxTabButton.qml | 0 .../qml/{ => dialogs}/ToolboxConfirmUninstallResetDialog.qml | 2 +- .../resources/qml/{ => dialogs}/ToolboxLicenseDialog.qml | 0 .../Toolbox/resources/qml/{ => pages}/ToolboxAuthorPage.qml | 4 +++- .../Toolbox/resources/qml/{ => pages}/ToolboxDetailPage.qml | 4 +++- .../resources/qml/{ => pages}/ToolboxDownloadsPage.qml | 2 ++ .../Toolbox/resources/qml/{ => pages}/ToolboxErrorPage.qml | 0 .../resources/qml/{ => pages}/ToolboxInstalledPage.qml | 2 ++ .../Toolbox/resources/qml/{ => pages}/ToolboxLoadingPage.qml | 0 plugins/Toolbox/resources/qml/{ => pages}/WelcomePage.qml | 2 +- plugins/Toolbox/src/Toolbox.py | 2 +- 31 files changed, 22 insertions(+), 10 deletions(-) rename plugins/Toolbox/resources/qml/{ => components}/RatingWidget.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/SmallRatingWidget.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxActionButtonStyle.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxBackColumn.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxCompatibilityChart.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDetailList.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDetailTile.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDetailTileActions.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDownloadsGrid.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDownloadsGridTile.qml (97%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDownloadsShowcase.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxDownloadsShowcaseTile.qml (97%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxFooter.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxHeader.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxInstalledTile.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxInstalledTileActions.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxProgressButton.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxShadow.qml (100%) rename plugins/Toolbox/resources/qml/{ => components}/ToolboxTabButton.qml (100%) rename plugins/Toolbox/resources/qml/{ => dialogs}/ToolboxConfirmUninstallResetDialog.qml (96%) rename plugins/Toolbox/resources/qml/{ => dialogs}/ToolboxLicenseDialog.qml (100%) rename plugins/Toolbox/resources/qml/{ => pages}/ToolboxAuthorPage.qml (98%) rename plugins/Toolbox/resources/qml/{ => pages}/ToolboxDetailPage.qml (99%) rename plugins/Toolbox/resources/qml/{ => pages}/ToolboxDownloadsPage.qml (98%) rename plugins/Toolbox/resources/qml/{ => pages}/ToolboxErrorPage.qml (100%) rename plugins/Toolbox/resources/qml/{ => pages}/ToolboxInstalledPage.qml (99%) rename plugins/Toolbox/resources/qml/{ => pages}/ToolboxLoadingPage.qml (100%) rename plugins/Toolbox/resources/qml/{ => pages}/WelcomePage.qml (97%) diff --git a/cura/ApplicationMetadata.py b/cura/ApplicationMetadata.py index daa937197c..4dced1c4dc 100644 --- a/cura/ApplicationMetadata.py +++ b/cura/ApplicationMetadata.py @@ -7,7 +7,7 @@ DEFAULT_CURA_APP_NAME = "cura" DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura" DEFAULT_CURA_VERSION = "master" -DEFAULT_CURA_BUILD_TYPE = "" +DEFAULT_CURA_BUILD_TYPE = "essentials" DEFAULT_CURA_DEBUG_MODE = False DEFAULT_CURA_SDK_VERSION = "7.0.0" diff --git a/plugins/Toolbox/resources/qml/Toolbox.qml b/plugins/Toolbox/resources/qml/Toolbox.qml index cf69231428..03fd3468f6 100644 --- a/plugins/Toolbox/resources/qml/Toolbox.qml +++ b/plugins/Toolbox/resources/qml/Toolbox.qml @@ -8,6 +8,10 @@ import QtQuick.Dialogs 1.1 import QtQuick.Window 2.2 import UM 1.1 as UM +import "./pages" +import "./dialogs" +import "./components" + Window { id: base diff --git a/plugins/Toolbox/resources/qml/RatingWidget.qml b/plugins/Toolbox/resources/qml/components/RatingWidget.qml similarity index 100% rename from plugins/Toolbox/resources/qml/RatingWidget.qml rename to plugins/Toolbox/resources/qml/components/RatingWidget.qml diff --git a/plugins/Toolbox/resources/qml/SmallRatingWidget.qml b/plugins/Toolbox/resources/qml/components/SmallRatingWidget.qml similarity index 100% rename from plugins/Toolbox/resources/qml/SmallRatingWidget.qml rename to plugins/Toolbox/resources/qml/components/SmallRatingWidget.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxActionButtonStyle.qml b/plugins/Toolbox/resources/qml/components/ToolboxActionButtonStyle.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxActionButtonStyle.qml rename to plugins/Toolbox/resources/qml/components/ToolboxActionButtonStyle.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxBackColumn.qml b/plugins/Toolbox/resources/qml/components/ToolboxBackColumn.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxBackColumn.qml rename to plugins/Toolbox/resources/qml/components/ToolboxBackColumn.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/components/ToolboxCompatibilityChart.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml rename to plugins/Toolbox/resources/qml/components/ToolboxCompatibilityChart.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailList.qml b/plugins/Toolbox/resources/qml/components/ToolboxDetailList.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxDetailList.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDetailList.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxDetailTile.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxDetailTile.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDetailTile.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml b/plugins/Toolbox/resources/qml/components/ToolboxDetailTileActions.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxDetailTileActions.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDetailTileActions.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml b/plugins/Toolbox/resources/qml/components/ToolboxDownloadsGrid.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxDownloadsGrid.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDownloadsGrid.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxDownloadsGridTile.qml similarity index 97% rename from plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDownloadsGridTile.qml index 73dd593336..78cdf1562a 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsGridTile.qml +++ b/plugins/Toolbox/resources/qml/components/ToolboxDownloadsGridTile.qml @@ -67,7 +67,7 @@ Item width: UM.Theme.getSize("toolbox_thumbnail_small").width - UM.Theme.getSize("wide_margin").width height: UM.Theme.getSize("toolbox_thumbnail_small").height - UM.Theme.getSize("wide_margin").width fillMode: Image.PreserveAspectFit - source: model.icon_url || "../images/logobot.svg" + source: model.icon_url || "../../images/logobot.svg" mipmap: true } UM.RecolorImage @@ -82,7 +82,7 @@ Item sourceSize.height: height visible: installedPackages != 0 color: (installedPackages >= packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border") - source: "../images/installed_check.svg" + source: "../../images/installed_check.svg" } } Item diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml b/plugins/Toolbox/resources/qml/components/ToolboxDownloadsShowcase.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxDownloadsShowcase.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDownloadsShowcase.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxDownloadsShowcaseTile.qml similarity index 97% rename from plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml rename to plugins/Toolbox/resources/qml/components/ToolboxDownloadsShowcaseTile.qml index 89348b18de..f6e32b2d84 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsShowcaseTile.qml +++ b/plugins/Toolbox/resources/qml/components/ToolboxDownloadsShowcaseTile.qml @@ -23,7 +23,7 @@ Rectangle height: UM.Theme.getSize("toolbox_thumbnail_large").height - 4 * UM.Theme.getSize("default_margin").height width: UM.Theme.getSize("toolbox_thumbnail_large").height - 4 * UM.Theme.getSize("default_margin").height fillMode: Image.PreserveAspectFit - source: model.icon_url || "../images/logobot.svg" + source: model.icon_url || "../../images/logobot.svg" mipmap: true anchors { @@ -62,7 +62,7 @@ Rectangle } visible: installedPackages != 0 color: (installedPackages >= packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border") - source: "../images/installed_check.svg" + source: "../../images/installed_check.svg" } SmallRatingWidget diff --git a/plugins/Toolbox/resources/qml/ToolboxFooter.qml b/plugins/Toolbox/resources/qml/components/ToolboxFooter.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxFooter.qml rename to plugins/Toolbox/resources/qml/components/ToolboxFooter.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxHeader.qml b/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxHeader.qml rename to plugins/Toolbox/resources/qml/components/ToolboxHeader.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxInstalledTile.qml rename to plugins/Toolbox/resources/qml/components/ToolboxInstalledTile.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml b/plugins/Toolbox/resources/qml/components/ToolboxInstalledTileActions.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxInstalledTileActions.qml rename to plugins/Toolbox/resources/qml/components/ToolboxInstalledTileActions.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxProgressButton.qml b/plugins/Toolbox/resources/qml/components/ToolboxProgressButton.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxProgressButton.qml rename to plugins/Toolbox/resources/qml/components/ToolboxProgressButton.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxShadow.qml b/plugins/Toolbox/resources/qml/components/ToolboxShadow.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxShadow.qml rename to plugins/Toolbox/resources/qml/components/ToolboxShadow.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxTabButton.qml b/plugins/Toolbox/resources/qml/components/ToolboxTabButton.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxTabButton.qml rename to plugins/Toolbox/resources/qml/components/ToolboxTabButton.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml b/plugins/Toolbox/resources/qml/dialogs/ToolboxConfirmUninstallResetDialog.qml similarity index 96% rename from plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml rename to plugins/Toolbox/resources/qml/dialogs/ToolboxConfirmUninstallResetDialog.qml index 81649fdfef..1b5e4d1d46 100644 --- a/plugins/Toolbox/resources/qml/ToolboxConfirmUninstallResetDialog.qml +++ b/plugins/Toolbox/resources/qml/dialogs/ToolboxConfirmUninstallResetDialog.qml @@ -14,7 +14,7 @@ import Cura 1.0 as Cura UM.Dialog { - // This dialog asks the user whether he/she wants to open a project file as a project or import models. + // This dialog asks the user to confirm he/she wants to uninstall materials/pprofiles which are currently in use id: base title: catalog.i18nc("@title:window", "Confirm uninstall") + toolbox.pluginToUninstall diff --git a/plugins/Toolbox/resources/qml/ToolboxLicenseDialog.qml b/plugins/Toolbox/resources/qml/dialogs/ToolboxLicenseDialog.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxLicenseDialog.qml rename to plugins/Toolbox/resources/qml/dialogs/ToolboxLicenseDialog.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxAuthorPage.qml similarity index 98% rename from plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml rename to plugins/Toolbox/resources/qml/pages/ToolboxAuthorPage.qml index 08ac1f83a5..d1abe48de1 100644 --- a/plugins/Toolbox/resources/qml/ToolboxAuthorPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxAuthorPage.qml @@ -6,6 +6,8 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import UM 1.1 as UM +import "../components" + Item { id: page @@ -31,7 +33,7 @@ Item width: UM.Theme.getSize("toolbox_thumbnail_medium").width height: UM.Theme.getSize("toolbox_thumbnail_medium").height fillMode: Image.PreserveAspectFit - source: details.icon_url || "../images/logobot.svg" + source: details.icon_url || "../../images/logobot.svg" mipmap: true anchors { diff --git a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxDetailPage.qml similarity index 99% rename from plugins/Toolbox/resources/qml/ToolboxDetailPage.qml rename to plugins/Toolbox/resources/qml/pages/ToolboxDetailPage.qml index 1773ef9053..6d34e23f42 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDetailPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxDetailPage.qml @@ -8,6 +8,8 @@ import UM 1.1 as UM import Cura 1.1 as Cura +import "../components" + Item { id: page @@ -44,7 +46,7 @@ Item { anchors.fill: parent fillMode: Image.PreserveAspectFit - source: details === null ? "" : (details.icon_url || "../images/logobot.svg") + source: details === null ? "" : (details.icon_url || "../../images/logobot.svg") mipmap: true } } diff --git a/plugins/Toolbox/resources/qml/ToolboxDownloadsPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxDownloadsPage.qml similarity index 98% rename from plugins/Toolbox/resources/qml/ToolboxDownloadsPage.qml rename to plugins/Toolbox/resources/qml/pages/ToolboxDownloadsPage.qml index 57fb3a9279..9be8cbe2b9 100644 --- a/plugins/Toolbox/resources/qml/ToolboxDownloadsPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxDownloadsPage.qml @@ -5,6 +5,8 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import UM 1.1 as UM +import "../components" + ScrollView { clip: true diff --git a/plugins/Toolbox/resources/qml/ToolboxErrorPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxErrorPage.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxErrorPage.qml rename to plugins/Toolbox/resources/qml/pages/ToolboxErrorPage.qml diff --git a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml similarity index 99% rename from plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml rename to plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml index f4a9e634c4..99590c712c 100644 --- a/plugins/Toolbox/resources/qml/ToolboxInstalledPage.qml +++ b/plugins/Toolbox/resources/qml/pages/ToolboxInstalledPage.qml @@ -6,6 +6,8 @@ import QtQuick.Controls 2.3 import UM 1.1 as UM +import "../components" + ScrollView { id: page diff --git a/plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml b/plugins/Toolbox/resources/qml/pages/ToolboxLoadingPage.qml similarity index 100% rename from plugins/Toolbox/resources/qml/ToolboxLoadingPage.qml rename to plugins/Toolbox/resources/qml/pages/ToolboxLoadingPage.qml diff --git a/plugins/Toolbox/resources/qml/WelcomePage.qml b/plugins/Toolbox/resources/qml/pages/WelcomePage.qml similarity index 97% rename from plugins/Toolbox/resources/qml/WelcomePage.qml rename to plugins/Toolbox/resources/qml/pages/WelcomePage.qml index a89b490b51..cbfdf8f402 100644 --- a/plugins/Toolbox/resources/qml/WelcomePage.qml +++ b/plugins/Toolbox/resources/qml/pages/WelcomePage.qml @@ -20,7 +20,7 @@ Column { id: profileImage fillMode: Image.PreserveAspectFit - source: "../images/logobot.svg" + source: "../../images/logobot.svg" anchors.horizontalCenter: parent.horizontalCenter width: Math.round(parent.width / 4) } diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 9caf95eab0..a31b818b37 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -342,7 +342,7 @@ class Toolbox(QObject, Extension): self._package_used_qualities = package_used_qualities # Ask change to default material / profile if self._confirm_reset_dialog is None: - self._confirm_reset_dialog = self._createDialog("ToolboxConfirmUninstallResetDialog.qml") + self._confirm_reset_dialog = self._createDialog("dialogs/ToolboxConfirmUninstallResetDialog.qml") self.uninstallVariablesChanged.emit() if self._confirm_reset_dialog is None: Logger.log("e", "ToolboxConfirmUninstallResetDialog should have been initialized, but it is not. Not showing dialog and not uninstalling package.") From 689562e61b0816215d483dabf8d18a3c368ddd89 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 5 Nov 2019 09:59:32 +0100 Subject: [PATCH 4/6] Add IsEnterpriseVersion flag CURA-6569 --- cura/ApplicationMetadata.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cura/ApplicationMetadata.py b/cura/ApplicationMetadata.py index daa937197c..024219e1f3 100644 --- a/cura/ApplicationMetadata.py +++ b/cura/ApplicationMetadata.py @@ -9,7 +9,11 @@ DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura" DEFAULT_CURA_VERSION = "master" DEFAULT_CURA_BUILD_TYPE = "" DEFAULT_CURA_DEBUG_MODE = False -DEFAULT_CURA_SDK_VERSION = "7.0.0" + +# Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for +# example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the +# CuraVersion.py.in template. +CuraSDKVersion = "7.0.0" try: from cura.CuraVersion import CuraAppName # type: ignore @@ -32,6 +36,9 @@ try: except ImportError: CuraVersion = DEFAULT_CURA_VERSION # [CodeStyle: Reflecting imported value] +# CURA-6569 +# This string indicates what type of version it is. For example, "enterprise". By default it's empty which indicates +# a default/normal Cura build. try: from cura.CuraVersion import CuraBuildType # type: ignore except ImportError: @@ -42,7 +49,8 @@ try: except ImportError: CuraDebugMode = DEFAULT_CURA_DEBUG_MODE -# Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for -# example Cura 3.2 with SDK version 6.1 will not work. So the SDK version is hard-coded here and left out of the -# CuraVersion.py.in template. -CuraSDKVersion = "7.0.0" + +# CURA-6569 +# Various convenience flags indicating what kind of Cura build it is. +__ENTERPRISE_VERSION_TYPE = "enterprise" +IsEnterpriseVersion = CuraBuildType.lower() == __ENTERPRISE_VERSION_TYPE From 792c365e9e69032a6a41efa997ce395fff50cab8 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 5 Nov 2019 10:40:30 +0100 Subject: [PATCH 5/6] Remove hardcoded essentials CURA-6569 --- cura/ApplicationMetadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/ApplicationMetadata.py b/cura/ApplicationMetadata.py index 7058a2f6cb..024219e1f3 100644 --- a/cura/ApplicationMetadata.py +++ b/cura/ApplicationMetadata.py @@ -7,7 +7,7 @@ DEFAULT_CURA_APP_NAME = "cura" DEFAULT_CURA_DISPLAY_NAME = "Ultimaker Cura" DEFAULT_CURA_VERSION = "master" -DEFAULT_CURA_BUILD_TYPE = "essentials" +DEFAULT_CURA_BUILD_TYPE = "" DEFAULT_CURA_DEBUG_MODE = False # Each release has a fixed SDK version coupled with it. It doesn't make sense to make it configurable because, for From 8baa009f1fab63f288c4dc77d3f76c7c4c1a71e7 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 5 Nov 2019 10:53:49 +0100 Subject: [PATCH 6/6] Use IsEnterpriseVersion in Toolbox CURA-6569 --- plugins/Toolbox/src/Toolbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index a31b818b37..c8c809cc82 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -129,7 +129,7 @@ class Toolbox(QObject, Extension): def _restart(self): self._updateRequestHeader() # For an Essentials build, login is mandatory - if not self._application.getCuraAPI().account.isLoggedIn and ApplicationMetadata.CuraBuildType == "essentials": + if not self._application.getCuraAPI().account.isLoggedIn and ApplicationMetadata.IsEnterpriseVersion: self.setViewPage("welcome") else: self.setViewPage("loading")