Merge pull request #6986 from Ultimaker/CURA-7027_Add_more_materials_from_Marketplace_button

Cura 7027 add more materials from marketplace button
This commit is contained in:
ninovanhooff 2020-01-16 16:26:38 +01:00 committed by GitHub
commit 8bf7666493
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 0 deletions

View file

@ -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

View file

@ -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;

View file

@ -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")
}
}
}

View file

@ -157,4 +157,11 @@ Menu
{
action: Cura.Actions.manageMaterials
}
MenuSeparator {}
MenuItem
{
action: Cura.Actions.marketplaceMaterials
}
}