mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fix dark mode issues Post processing plugin
Also revamped the post-processing list a bit. CURA-8688
This commit is contained in:
parent
e2fe50baf1
commit
0a214b2c47
1 changed files with 136 additions and 142 deletions
|
@ -15,14 +15,15 @@ UM.Dialog
|
||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
title: catalog.i18nc("@title:window", "Post Processing Plugin")
|
title: catalog.i18nc("@title:window", "Post Processing Plugin")
|
||||||
width: 700 * screenScaleFactor;
|
width: 700 * screenScaleFactor
|
||||||
height: 500 * screenScaleFactor;
|
height: 500 * screenScaleFactor
|
||||||
minimumWidth: 400 * screenScaleFactor;
|
minimumWidth: 400 * screenScaleFactor
|
||||||
minimumHeight: 250 * screenScaleFactor;
|
minimumHeight: 250 * screenScaleFactor
|
||||||
|
|
||||||
onVisibleChanged:
|
onVisibleChanged:
|
||||||
{
|
{
|
||||||
if(!visible) //Whenever the window is closed (either via the "Close" button or the X on the window frame), we want to update it in the stack.
|
// Whenever the window is closed (either via the "Close" button or the X on the window frame), we want to update it in the stack.
|
||||||
|
if (!visible)
|
||||||
{
|
{
|
||||||
manager.writeScriptsToStack()
|
manager.writeScriptsToStack()
|
||||||
}
|
}
|
||||||
|
@ -35,8 +36,7 @@ UM.Dialog
|
||||||
property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width)
|
property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width)
|
||||||
property int textMargin: UM.Theme.getSize("narrow_margin").width
|
property int textMargin: UM.Theme.getSize("narrow_margin").width
|
||||||
property string activeScriptName
|
property string activeScriptName
|
||||||
SystemPalette{ id: palette }
|
|
||||||
SystemPalette{ id: disabledPalette; colorGroup: SystemPalette.Disabled }
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
ButtonGroup
|
ButtonGroup
|
||||||
|
@ -51,14 +51,12 @@ UM.Dialog
|
||||||
|
|
||||||
spacing: base.textMargin
|
spacing: base.textMargin
|
||||||
|
|
||||||
Label
|
UM.Label
|
||||||
{
|
{
|
||||||
id: activeScriptsHeader
|
id: activeScriptsHeader
|
||||||
text: catalog.i18nc("@label", "Post Processing Scripts")
|
text: catalog.i18nc("@label", "Post Processing Scripts")
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: base.textMargin
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: base.textMargin
|
|
||||||
font: UM.Theme.getFont("large_bold")
|
font: UM.Theme.getFont("large_bold")
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
@ -79,137 +77,142 @@ UM.Dialog
|
||||||
id: activeScriptsScrollBar
|
id: activeScriptsScrollBar
|
||||||
}
|
}
|
||||||
model: manager.scriptList
|
model: manager.scriptList
|
||||||
delegate: Item
|
|
||||||
|
delegate: Button
|
||||||
{
|
{
|
||||||
|
id: activeScriptButton
|
||||||
|
|
||||||
width: parent.width - activeScriptsScrollBar.width
|
width: parent.width - activeScriptsScrollBar.width
|
||||||
height: activeScriptButton.height
|
height: UM.Theme.getSize("standard_list_lineheight").height
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: activeScriptButton
|
|
||||||
text: manager.getScriptLabelByKey(modelData.toString())
|
|
||||||
ButtonGroup.group: selectedScriptGroup
|
|
||||||
width: parent.width
|
|
||||||
height: UM.Theme.getSize("setting").height
|
|
||||||
checkable: true
|
|
||||||
|
|
||||||
checked:
|
ButtonGroup.group: selectedScriptGroup
|
||||||
|
checkable: true
|
||||||
|
|
||||||
|
checked:
|
||||||
|
{
|
||||||
|
if (manager.selectedScriptIndex == index)
|
||||||
{
|
{
|
||||||
if (manager.selectedScriptIndex == index)
|
|
||||||
{
|
|
||||||
base.activeScriptName = manager.getScriptLabelByKey(modelData.toString())
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
forceActiveFocus()
|
|
||||||
manager.setSelectedScriptIndex(index)
|
|
||||||
base.activeScriptName = manager.getScriptLabelByKey(modelData.toString())
|
base.activeScriptName = manager.getScriptLabelByKey(modelData.toString())
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
else
|
||||||
background: Rectangle
|
|
||||||
{
|
{
|
||||||
color: activeScriptButton.checked ? palette.highlight : "transparent"
|
return false
|
||||||
}
|
}
|
||||||
contentItem: Label
|
|
||||||
{
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
text: activeScriptButton.text
|
|
||||||
elide: Text.ElideRight
|
|
||||||
color: activeScriptButton.checked ? palette.highlightedText : palette.text
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button
|
background: Rectangle
|
||||||
{
|
{
|
||||||
id: removeButton
|
color: activeScriptButton.checked ? UM.Theme.getColor("background_3") : "transparent"
|
||||||
text: "x"
|
}
|
||||||
width: 20 * screenScaleFactor
|
|
||||||
height: 20 * screenScaleFactor
|
onClicked:
|
||||||
anchors.right: parent.right
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
forceActiveFocus()
|
||||||
onClicked: manager.removeScriptByIndex(index)
|
manager.setSelectedScriptIndex(index)
|
||||||
contentItem: Item
|
base.activeScriptName = manager.getScriptLabelByKey(modelData.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
height: childrenRect.height
|
||||||
|
|
||||||
|
UM.Label
|
||||||
{
|
{
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: manager.getScriptLabelByKey(modelData.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: downButton
|
||||||
|
Layout.preferredWidth: height
|
||||||
|
Layout.fillHeight: true
|
||||||
|
enabled: index != manager.scriptList.length - 1
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
if (manager.selectedScriptIndex == index)
|
||||||
|
{
|
||||||
|
manager.setSelectedScriptIndex(index + 1)
|
||||||
|
}
|
||||||
|
return manager.moveScript(index, index + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width: Math.round(removeButton.width / 2.7)
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
height: Math.round(removeButton.height / 2.7)
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
sourceSize.height: width
|
sourceSize.width: width
|
||||||
color: palette.text
|
sourceSize.height: height
|
||||||
source: UM.Theme.getIcon("Cancel")
|
color: parent.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled")
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: downButton
|
|
||||||
text: ""
|
|
||||||
anchors.right: removeButton.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
enabled: index != manager.scriptList.length - 1
|
|
||||||
width: 20 * screenScaleFactor
|
|
||||||
height: 20 * screenScaleFactor
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
if (manager.selectedScriptIndex == index)
|
|
||||||
{
|
|
||||||
manager.setSelectedScriptIndex(index + 1)
|
|
||||||
}
|
|
||||||
return manager.moveScript(index, index + 1)
|
|
||||||
}
|
|
||||||
contentItem: Item
|
|
||||||
{
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
width: Math.round(downButton.width / 2.5)
|
|
||||||
height: Math.round(downButton.height / 2.5)
|
|
||||||
sourceSize.height: width
|
|
||||||
color: downButton.enabled ? palette.text : disabledPalette.text
|
|
||||||
source: UM.Theme.getIcon("ChevronSingleDown")
|
source: UM.Theme.getIcon("ChevronSingleDown")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
Item
|
||||||
Button
|
|
||||||
{
|
|
||||||
id: upButton
|
|
||||||
text: ""
|
|
||||||
enabled: index != 0
|
|
||||||
width: 20 * screenScaleFactor
|
|
||||||
height: 20 * screenScaleFactor
|
|
||||||
anchors.right: downButton.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
onClicked:
|
|
||||||
{
|
{
|
||||||
if (manager.selectedScriptIndex == index)
|
id: upButton
|
||||||
|
Layout.preferredWidth: height
|
||||||
|
Layout.fillHeight: true
|
||||||
|
enabled: index != 0
|
||||||
|
|
||||||
|
MouseArea
|
||||||
{
|
{
|
||||||
manager.setSelectedScriptIndex(index - 1)
|
anchors.fill: parent
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
if (manager.selectedScriptIndex == index)
|
||||||
|
{
|
||||||
|
manager.setSelectedScriptIndex(index - 1)
|
||||||
|
}
|
||||||
|
return manager.moveScript(index, index - 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return manager.moveScript(index, index - 1)
|
|
||||||
}
|
|
||||||
contentItem: Item
|
|
||||||
{
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width: Math.round(upButton.width / 2.5)
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
height: Math.round(upButton.height / 2.5)
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
sourceSize.height: width
|
sourceSize.width: width
|
||||||
color: upButton.enabled ? palette.text : disabledPalette.text
|
sourceSize.height: height
|
||||||
|
color: upButton.enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_disabled")
|
||||||
source: UM.Theme.getIcon("ChevronSingleUp")
|
source: UM.Theme.getIcon("ChevronSingleUp")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: removeButton
|
||||||
|
Layout.preferredWidth: height
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: manager.removeScriptByIndex(index)
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
source: UM.Theme.getIcon("Cancel")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,28 +220,26 @@ UM.Dialog
|
||||||
{
|
{
|
||||||
id: addButton
|
id: addButton
|
||||||
text: catalog.i18nc("@action", "Add a script")
|
text: catalog.i18nc("@action", "Add a script")
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: base.textMargin
|
|
||||||
onClicked: scriptsMenu.open()
|
onClicked: scriptsMenu.open()
|
||||||
}
|
}
|
||||||
Menu
|
}
|
||||||
|
|
||||||
|
Cura.Menu
|
||||||
|
{
|
||||||
|
id: scriptsMenu
|
||||||
|
|
||||||
|
Models.Instantiator
|
||||||
{
|
{
|
||||||
id: scriptsMenu
|
model: manager.loadedScriptList
|
||||||
width: parent.width
|
|
||||||
|
|
||||||
Models.Instantiator
|
Cura.MenuItem
|
||||||
{
|
{
|
||||||
model: manager.loadedScriptList
|
text: manager.getScriptLabelByKey(modelData.toString())
|
||||||
|
onTriggered: manager.addScriptToList(modelData.toString())
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text: manager.getScriptLabelByKey(modelData.toString())
|
|
||||||
onTriggered: manager.addScriptToList(modelData.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
onObjectAdded: scriptsMenu.insertItem(index, object)
|
|
||||||
onObjectRemoved: scriptsMenu.removeItem(object)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onObjectAdded: scriptsMenu.insertItem(index, object)
|
||||||
|
onObjectRemoved: scriptsMenu.removeItem(object)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,16 +304,9 @@ UM.Dialog
|
||||||
width: listview.width
|
width: listview.width
|
||||||
height:
|
height:
|
||||||
{
|
{
|
||||||
if(provider.properties.enabled == "True")
|
if (provider.properties.enabled == "True" && model.type != undefined)
|
||||||
{
|
{
|
||||||
if(model.type != undefined)
|
return UM.Theme.getSize("section").height;
|
||||||
{
|
|
||||||
return UM.Theme.getSize("section").height
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -392,10 +386,10 @@ UM.Dialog
|
||||||
|
|
||||||
function onShowTooltip(text)
|
function onShowTooltip(text)
|
||||||
{
|
{
|
||||||
tooltip.text = text
|
tooltip.text = text;
|
||||||
var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0)
|
var position = settingLoader.mapToItem(settingsPanel, settingsPanel.x, 0);
|
||||||
tooltip.show(position)
|
tooltip.show(position);
|
||||||
tooltip.target.x = position.x + 1
|
tooltip.target.x = position.x + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHideTooltip() { tooltip.hide() }
|
function onHideTooltip() { tooltip.hide() }
|
||||||
|
@ -452,7 +446,7 @@ UM.Dialog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rightButtons: Cura.PrimaryButton
|
rightButtons: Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:button", "Close")
|
text: catalog.i18nc("@action:button", "Close")
|
||||||
onClicked: dialog.accept()
|
onClicked: dialog.accept()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue