mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 06:33:55 -06:00
CURA-4354 fixed plugin injected tool icon path finding, example in PerObjectSettingsTool
This commit is contained in:
parent
045f1ce259
commit
11241642b3
3 changed files with 12 additions and 19 deletions
|
@ -13,7 +13,7 @@ def getMetaData():
|
||||||
"tool": {
|
"tool": {
|
||||||
"name": i18n_catalog.i18nc("@label", "Per Model Settings"),
|
"name": i18n_catalog.i18nc("@label", "Per Model Settings"),
|
||||||
"description": i18n_catalog.i18nc("@info:tooltip", "Configure Per Model Settings"),
|
"description": i18n_catalog.i18nc("@info:tooltip", "Configure Per Model Settings"),
|
||||||
"icon": "setting_per_object",
|
"icon": "tool_icon.svg",
|
||||||
"tool_panel": "PerObjectSettingsPanel.qml",
|
"tool_panel": "PerObjectSettingsPanel.qml",
|
||||||
"weight": 3
|
"weight": 3
|
||||||
},
|
},
|
||||||
|
|
3
plugins/PerObjectSettingsTool/tool_icon.svg
Normal file
3
plugins/PerObjectSettingsTool/tool_icon.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
|
||||||
|
<path d="M30 20L25.1 6.7 27.6 0H12.9l1.6 5H6.4l2.3 6H2.4l2.4 6.2L0 30h19.5l-1.7-4H26l-2.3-6H30zm-12.5 5l-2.8-7.5 2.4-6.5H9.6L7.7 6h14.7L20 12.4l2.9 7.6 2 5h-7.4z"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 240 B |
|
@ -34,28 +34,18 @@ Item
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
iconSource:
|
iconSource: (UM.Theme.getIcon(model.icon) != "") ? UM.Theme.getIcon(model.icon) : "file:///" + model.location + "/" + model.icon
|
||||||
{
|
checkable: true
|
||||||
var result = UM.Theme.getIcon(model.icon)
|
checked: model.active
|
||||||
if(result == "")
|
enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled
|
||||||
{
|
style: UM.Theme.styles.tool_button
|
||||||
return model.location + "/" + model.icon
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
checkable: true;
|
onCheckedChanged: {
|
||||||
checked: model.active;
|
if (checked) {
|
||||||
enabled: model.enabled && UM.Selection.hasSelection && UM.Controller.toolsEnabled;
|
|
||||||
|
|
||||||
style: UM.Theme.styles.tool_button;
|
|
||||||
onCheckedChanged:
|
|
||||||
{
|
|
||||||
if(checked)
|
|
||||||
{
|
|
||||||
base.activeY = y
|
base.activeY = y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead
|
//Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead
|
||||||
//just catch the click so we do not trigger that behaviour.
|
//just catch the click so we do not trigger that behaviour.
|
||||||
MouseArea
|
MouseArea
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue