mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Update Per Object Settings tool with changes made in 15.10
This commit is contained in:
parent
751f58fb02
commit
15747dedec
2 changed files with 70 additions and 23 deletions
|
@ -41,6 +41,33 @@ Item {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: closeButton;
|
||||||
|
width: UM.Theme.sizes.message_close.width;
|
||||||
|
height: UM.Theme.sizes.message_close.height;
|
||||||
|
anchors {
|
||||||
|
right: parent.right;
|
||||||
|
rightMargin: UM.Theme.sizes.default_margin.width / 2;
|
||||||
|
top: parent.top;
|
||||||
|
topMargin: UM.Theme.sizes.default_margin.width / 2;
|
||||||
|
}
|
||||||
|
UM.RecolorImage {
|
||||||
|
anchors.fill: parent;
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: width
|
||||||
|
color: UM.Theme.colors.message_dismiss
|
||||||
|
source: UM.Theme.icons.cross2;
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: settingsPanel.opacity = 0
|
||||||
|
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: UM.Theme.colors.message_background
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: items
|
id: items
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
|
@ -58,7 +85,6 @@ Item {
|
||||||
|
|
||||||
name: catalog.i18nc("@label", "Profile")
|
name: catalog.i18nc("@label", "Profile")
|
||||||
type: "enum"
|
type: "enum"
|
||||||
perObjectSetting: true
|
|
||||||
|
|
||||||
style: UM.Theme.styles.setting_item;
|
style: UM.Theme.styles.setting_item;
|
||||||
|
|
||||||
|
@ -88,8 +114,6 @@ Item {
|
||||||
description: model.description;
|
description: model.description;
|
||||||
unit: model.unit;
|
unit: model.unit;
|
||||||
valid: model.valid;
|
valid: model.valid;
|
||||||
perObjectSetting: true
|
|
||||||
dismissable: true
|
|
||||||
options: model.options
|
options: model.options
|
||||||
|
|
||||||
style: UM.Theme.styles.setting_item;
|
style: UM.Theme.styles.setting_item;
|
||||||
|
@ -98,18 +122,36 @@ Item {
|
||||||
settings.model.setSettingValue(model.key, value)
|
settings.model.setSettingValue(model.key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button {
|
Button
|
||||||
// anchors.left: parent.right;
|
{
|
||||||
// text: "x";
|
anchors.left: parent.horizontalCenter;
|
||||||
//
|
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||||
// width: UM.Theme.sizes.setting.height;
|
|
||||||
// height: UM.Theme.sizes.setting.height;
|
width: UM.Theme.sizes.setting.height;
|
||||||
//
|
height: UM.Theme.sizes.setting.height;
|
||||||
// opacity: parent.hovered || hovered ? 1 : 0;
|
|
||||||
// onClicked: UM.ActiveTool.properties.Model.removeSettingOverride(UM.ActiveTool.properties.Model.getItem(base.currentIndex).id, model.key)
|
opacity: parent.hovered || hovered ? 1 : 0;
|
||||||
//
|
onClicked: UM.ActiveTool.properties.Model.removeSettingOverride(UM.ActiveTool.properties.Model.getItem(base.currentIndex).id, model.key)
|
||||||
// style: ButtonStyle { }
|
|
||||||
// }
|
style: ButtonStyle
|
||||||
|
{
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
color: control.hovered ? control.parent.style.controlHighlightColor : control.parent.style.controlColor;
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: parent.width/2
|
||||||
|
height: parent.height/2
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: width
|
||||||
|
color: UM.Theme.colors.setting_control_revert
|
||||||
|
source: UM.Theme.icons.cross1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +214,8 @@ Item {
|
||||||
|
|
||||||
checkable: true;
|
checkable: true;
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if(settingsPanel.opacity < 0.5) //Per-object panel is not currently displayed.
|
||||||
|
{
|
||||||
base.currentIndex = index;
|
base.currentIndex = index;
|
||||||
|
|
||||||
settingsPanel.anchors.left = right;
|
settingsPanel.anchors.left = right;
|
||||||
|
@ -179,6 +223,11 @@ Item {
|
||||||
|
|
||||||
settingsPanel.opacity = 1;
|
settingsPanel.opacity = 1;
|
||||||
}
|
}
|
||||||
|
else //Per-object panel is already displayed. Deactivate it (same behaviour as the close button).
|
||||||
|
{
|
||||||
|
settingsPanel.opacity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,9 +44,7 @@ class SettingOverrideModel(ListModel):
|
||||||
if not self._decorator:
|
if not self._decorator:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._ignore_setting_change = key
|
|
||||||
self._decorator.setSettingValue(key, value)
|
self._decorator.setSettingValue(key, value)
|
||||||
self._ignore_setting_change = None
|
|
||||||
|
|
||||||
def _onDecoratorsChanged(self, node):
|
def _onDecoratorsChanged(self, node):
|
||||||
if not self._node.getDecorator(SettingOverrideDecorator):
|
if not self._node.getDecorator(SettingOverrideDecorator):
|
||||||
|
@ -97,6 +95,6 @@ class SettingOverrideModel(ListModel):
|
||||||
def _onSettingValueChanged(self, setting):
|
def _onSettingValueChanged(self, setting):
|
||||||
index = self.find("key", setting.getKey())
|
index = self.find("key", setting.getKey())
|
||||||
value = self._decorator.getSettingValue(setting.getKey())
|
value = self._decorator.getSettingValue(setting.getKey())
|
||||||
if index != -1 and self._ignore_setting_change != setting.getKey():
|
if index != -1:
|
||||||
self.setProperty(index, "value", str(value))
|
self.setProperty(index, "value", str(value))
|
||||||
self.setProperty(index, "valid", setting.validate(value))
|
self.setProperty(index, "valid", setting.validate(value))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue