Merge branch 'CURA-5876_fixes' into 4.0

This commit is contained in:
Ghostkeeper 2018-12-14 16:28:04 +01:00
commit 78a5f95c43
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
23 changed files with 218 additions and 431 deletions

View file

@ -16,8 +16,8 @@ Item
{
id: header
text: catalog.i18nc("@header", "Configurations")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("small_button_text")
height: contentHeight
renderType: Text.NativeRendering

View file

@ -14,122 +14,117 @@ Button
property var configuration: null
hoverEnabled: true
height: background.height
background: Rectangle
{
height: childrenRect.height
color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
border.width: parent.checked ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width
border.color: parent.checked ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
radius: UM.Theme.getSize("default_radius").width
}
Column
contentItem: Column
{
id: contentColumn
width: parent.width
padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("narrow_margin").height
Row
{
id: contentColumn
width: parent.width
padding: UM.Theme.getSize("wide_margin").width
spacing: UM.Theme.getSize("narrow_margin").height
id: extruderRow
Row
anchors
{
id: extruderRow
anchors
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: childrenRect.height
spacing: UM.Theme.getSize("default_margin").width
Repeater
{
id: repeater
height: childrenRect.height
model: configuration.extruderConfigurations
delegate: PrintCoreConfiguration
{
width: Math.round(parent.width / 2)
printCoreConfiguration: modelData
}
}
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
//Buildplate row separator
Rectangle
spacing: UM.Theme.getSize("default_margin").width
Repeater
{
id: separator
visible: buildplateInformation.visible
anchors
id: repeater
model: configuration.extruderConfigurations
delegate: PrintCoreConfiguration
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
color: UM.Theme.getColor("lining")
}
Item
{
id: buildplateInformation
anchors
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: childrenRect.height
visible: configuration.buildplateConfiguration != ""
UM.RecolorImage
{
id: buildplateIcon
anchors.left: parent.left
width: UM.Theme.getSize("main_window_header_button_icon").width
height: UM.Theme.getSize("main_window_header_button_icon").height
source: UM.Theme.getIcon("buildplate")
color: UM.Theme.getColor("text")
}
Label
{
id: buildplateLabel
anchors.left: buildplateIcon.right
anchors.verticalCenter: buildplateIcon.verticalCenter
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
text: configuration.buildplateConfiguration
renderType: Text.NativeRendering
color: UM.Theme.getColor("text")
width: Math.round(parent.width / 2)
printCoreConfiguration: modelData
}
}
}
Connections
//Buildplate row separator
Rectangle
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
id: separator
visible: buildplateInformation.visible
anchors
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
color: UM.Theme.getColor("lining")
}
Component.onCompleted:
Item
{
id: buildplateInformation
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: childrenRect.height
visible: configuration.buildplateConfiguration != ""
UM.RecolorImage
{
id: buildplateIcon
anchors.left: parent.left
width: UM.Theme.getSize("main_window_header_button_icon").width
height: UM.Theme.getSize("main_window_header_button_icon").height
source: UM.Theme.getIcon("buildplate")
color: UM.Theme.getColor("text")
}
Label
{
id: buildplateLabel
anchors.left: buildplateIcon.right
anchors.verticalCenter: buildplateIcon.verticalCenter
anchors.leftMargin: UM.Theme.getSize("narrow_margin").height
text: configuration.buildplateConfiguration
renderType: Text.NativeRendering
color: UM.Theme.getColor("text")
}
}
}
Connections
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}
}
Component.onCompleted:
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}
onClicked:
{
Cura.MachineManager.applyRemoteConfiguration(configuration)
}
}
}

View file

@ -7,16 +7,15 @@ import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Column
Item
{
id: base
property var outputDevice: null
height: childrenRect.height + 2 * padding
spacing: UM.Theme.getSize("narrow_margin").height
height: childrenRect.height
function forceModelUpdate()
{
// FIXME For now the model should be removed and then created again, otherwise changes in the printer don't automatically update the UI
// FIXME For now the model has to be removed and then created again, otherwise changes in the printer don't automatically update the UI
configurationList.model = []
if (outputDevice)
{
@ -24,6 +23,42 @@ Column
}
}
// This component will appear when there is no configurations (e.g. when losing connection)
Item
{
width: parent.width
visible: configurationList.model.length == 0
height: label.height + UM.Theme.getSize("wide_margin").height
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
UM.RecolorImage
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: label.verticalCenter
source: UM.Theme.getIcon("warning")
color: UM.Theme.getColor("warning")
width: UM.Theme.getSize("section_icon").width
height: width
}
Label
{
id: label
anchors.left: icon.right
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@label", "The configurations are not available because the printer is disconnected.")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
wrapMode: Text.WordWrap
}
}
ScrollView
{
id: container
@ -57,7 +92,6 @@ Column
id: configurationList
spacing: UM.Theme.getSize("narrow_margin").height
width: container.width - ((height > container.maximumHeight) ? container.ScrollBar.vertical.background.width : 0) //Make room for scroll bar if there is any.
contentHeight: childrenRect.height
height: childrenRect.height
section.property: "modelData.printerType"
@ -100,4 +134,4 @@ Column
forceModelUpdate()
}
}
}
}

View file

@ -31,6 +31,7 @@ Cura.ExpandablePopup
Custom
}
contentPadding: UM.Theme.getSize("default_lining").width
enabled: Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants || Cura.MachineManager.hasVariantBuildplates; //Only let it drop down if there is any configuration that you could change.
headerItem: Item
@ -124,34 +125,41 @@ Cura.ExpandablePopup
contentItem: Column
{
id: popupItem
width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: implicitHeight //Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up.
width: UM.Theme.getSize("configuration_selector").width
height: implicitHeight // Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up.
padding: UM.Theme.getSize("default_margin").height
spacing: UM.Theme.getSize("default_margin").height
property bool is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible.
property bool is_connected: false // If current machine is connected to a printer. Only evaluated upon making popup visible.
property int configuration_method: ConfigurationMenu.ConfigurationMethod.Custom // Type of configuration being used. Only evaluated upon making popup visible.
property int manual_selected_method: -1 // It stores the configuration method selected by the user. By default the selected method is
onVisibleChanged:
{
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate.
}
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected // Re-evaluate.
property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.Auto : ConfigurationMenu.ConfigurationMethod.Custom //Auto if connected to a printer at start-up, or Custom if not.
// If the printer is not connected, we switch always to the custom mode. If is connected instead, the auto mode
// or the previous state is selected
configuration_method = is_connected ? (manual_selected_method == -1 ? ConfigurationMenu.ConfigurationMethod.Auto : manual_selected_method) : ConfigurationMenu.ConfigurationMethod.Custom
}
Item
{
width: parent.width
width: parent.width - 2 * parent.padding
height:
{
var height = 0;
if(autoConfiguration.visible)
var height = 0
if (autoConfiguration.visible)
{
height += autoConfiguration.height;
height += autoConfiguration.height
}
if(customConfiguration.visible)
if (customConfiguration.visible)
{
height += customConfiguration.height;
height += customConfiguration.height
}
return height;
return height
}
AutoConfiguration
{
id: autoConfiguration
@ -169,9 +177,9 @@ Cura.ExpandablePopup
{
id: separator
visible: buttonBar.visible
x: -contentPadding
x: -parent.padding
width: base.width
width: parent.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")
@ -183,7 +191,7 @@ Cura.ExpandablePopup
id: buttonBar
visible: popupItem.is_connected //Switching only makes sense if the "auto" part is possible.
width: parent.width
width: parent.width - 2 * parent.padding
height: childrenRect.height
Cura.SecondaryButton
@ -197,7 +205,11 @@ Cura.ExpandablePopup
iconSource: UM.Theme.getIcon("arrow_right")
isIconOnRightSide: true
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom
onClicked:
{
popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom
popupItem.manual_selected_method = popupItem.configuration_method
}
}
Cura.SecondaryButton
@ -208,8 +220,18 @@ Cura.ExpandablePopup
iconSource: UM.Theme.getIcon("arrow_left")
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto
onClicked:
{
popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto
popupItem.manual_selected_method = popupItem.configuration_method
}
}
}
}
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: popupItem.manual_selected_method = -1 // When switching printers, reset the value of the manual selected method
}
}

View file

@ -23,8 +23,8 @@ Item
{
id: header
text: catalog.i18nc("@header", "Custom")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("small_button_text")
height: contentHeight
renderType: Text.NativeRendering
@ -51,9 +51,7 @@ Item
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
top: header.bottom
topMargin: visible ? UM.Theme.getSize("default_margin").height : 0
}
@ -74,7 +72,7 @@ Item
id: printerTypeSelector
text: Cura.MachineManager.activeMachineDefinitionName
tooltip: Cura.MachineManager.activeMachineDefinitionName
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width
anchors.right: parent.right
style: UM.Theme.styles.print_setup_header_button
@ -224,7 +222,7 @@ Item
Row
{
height: UM.Theme.getSize("print_setup_item").height
height: UM.Theme.getSize("print_setup_big_item").height
visible: Cura.MachineManager.hasMaterials
Label
@ -248,7 +246,7 @@ Item
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : ""
tooltip: text
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button
@ -262,7 +260,7 @@ Item
Row
{
height: UM.Theme.getSize("print_setup_item").height
height: UM.Theme.getSize("print_setup_big_item").height
visible: Cura.MachineManager.hasVariants
Label
@ -282,7 +280,7 @@ Item
text: Cura.MachineManager.activeVariantName
tooltip: Cura.MachineManager.activeVariantName
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button
activeFocusOnPress: true;