diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index f1c7c35419..e0d04bed5b 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -714,6 +714,11 @@ class Toolbox(QObject, Extension): self._view_category = category self.viewChanged.emit() + ## Function explicitly defined so that it can be called through the callExtensionsMethod + # which cannot receive arguments. + def setViewCategoryToMaterials(self) -> None: + self.setViewCategory("material") + @pyqtProperty(str, fset = setViewCategory, notify = viewChanged) def viewCategory(self) -> str: return self._view_category diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index e5b39c6ba5..c62b0cb89a 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -54,6 +54,7 @@ Item property alias manageProfiles: manageProfilesAction; property alias manageMaterials: manageMaterialsAction; + property alias marketplaceMaterials: marketplaceMaterialsAction; property alias preferences: preferencesAction; @@ -188,6 +189,12 @@ Item shortcut: "Ctrl+K" } + Action + { + id: marketplaceMaterialsAction + text: catalog.i18nc("@action:inmenu", "Add more materials from Marketplace") + } + Action { id: updateProfileAction; diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 33cbf75c8b..1ddb0410b2 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -163,4 +163,15 @@ Item curaExtensions.callExtensionMethod("Toolbox", "launch") } } + + // Show the Marketplace dialog at the materials tab + Connections + { + target: Cura.Actions.marketplaceMaterials + onTriggered: + { + curaExtensions.callExtensionMethod("Toolbox", "launch") + curaExtensions.callExtensionMethod("Toolbox", "setViewCategoryToMaterials") + } + } } \ No newline at end of file diff --git a/resources/qml/Menus/MaterialMenu.qml b/resources/qml/Menus/MaterialMenu.qml index c101f56da5..b733ead40b 100644 --- a/resources/qml/Menus/MaterialMenu.qml +++ b/resources/qml/Menus/MaterialMenu.qml @@ -157,4 +157,11 @@ Menu { action: Cura.Actions.manageMaterials } + + MenuSeparator {} + + MenuItem + { + action: Cura.Actions.marketplaceMaterials + } }