Merge branch 'master' into feature_model_list

This commit is contained in:
Diego Prado Gesto 2019-05-07 11:57:31 +02:00
commit 9e5e57e6c5
514 changed files with 80530 additions and 9839 deletions

View file

@ -32,7 +32,11 @@ Cura.ExpandablePopup
{
return Cura.MachineManager.activeMachineNetworkGroupName
}
return Cura.MachineManager.activeMachineName
if(Cura.MachineManager.activeStack != null)
{
return Cura.MachineManager.activeStack.name
}
return ""
}
source:
{
@ -114,6 +118,7 @@ Cura.ExpandablePopup
MachineSelectorList
{
id: machineSelectorList
// Can't use parent.width since the parent is the flickable component and not the ScrollView
width: scroll.width - scroll.leftPadding - scroll.rightPadding
property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height
@ -155,9 +160,13 @@ Cura.ExpandablePopup
Cura.SecondaryButton
{
id: addPrinterButton
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Add printer")
// The maximum width of the button is half of the total space, minus the padding of the parent, the left
// padding of the component and half the spacing because of the space between buttons.
maximumWidth: UM.Theme.getSize("machine_selector_widget_content").width / 2 - parent.padding - leftPadding - parent.spacing / 2
onClicked:
{
toggleContent()
@ -167,9 +176,13 @@ Cura.ExpandablePopup
Cura.SecondaryButton
{
id: managePrinterButton
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Manage printers")
// The maximum width of the button is half of the total space, minus the padding of the parent, the right
// padding of the component and half the spacing because of the space between buttons.
maximumWidth: UM.Theme.getSize("machine_selector_widget_content").width / 2 - parent.padding - rightPadding - parent.spacing / 2
onClicked:
{
toggleContent()

View file

@ -1,12 +1,13 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.1 as UM
import Cura 1.0 as Cura
Button
{
id: machineSelectorButton
@ -18,12 +19,23 @@ Button
checkable: true
hoverEnabled: true
property bool selected: checked
property bool printerTypeLabelAutoFit: false
property var outputDevice: null
property var printerTypesList: []
// Indicates if only to update the printer types list when this button is checked
property bool updatePrinterTypesOnlyWhenChecked: true
property var updatePrinterTypesFunction: updatePrinterTypesList
// This function converts the printer type string to another string.
property var printerTypeLabelConversionFunction: Cura.MachineManager.getAbbreviatedMachineName
function updatePrinterTypesList()
{
printerTypesList = (checked && (outputDevice != null)) ? outputDevice.uniquePrinterTypes : []
var to_update = (updatePrinterTypesOnlyWhenChecked && checked) || !updatePrinterTypesOnlyWhenChecked
printerTypesList = (to_update && outputDevice != null) ? outputDevice.uniquePrinterTypes : []
}
contentItem: Item
@ -41,7 +53,7 @@ Button
verticalCenter: parent.verticalCenter
}
text: machineSelectorButton.text
color: UM.Theme.getColor("text")
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("small_button_text")
font: UM.Theme.getFont("medium")
visible: text != ""
renderType: Text.NativeRendering
@ -66,7 +78,8 @@ Button
model: printerTypesList
delegate: Cura.PrinterTypeLabel
{
text: Cura.MachineManager.getAbbreviatedMachineName(modelData)
autoFit: printerTypeLabelAutoFit
text: printerTypeLabelConversionFunction(modelData)
}
}
}
@ -75,29 +88,30 @@ Button
background: Rectangle
{
id: backgroundRect
color: machineSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
color:
{
if (!machineSelectorButton.enabled)
{
return UM.Theme.getColor("action_button_disabled")
}
return machineSelectorButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
}
radius: UM.Theme.getSize("action_button_radius").width
border.width: UM.Theme.getSize("default_lining").width
border.color: machineSelectorButton.checked ? UM.Theme.getColor("primary") : "transparent"
}
onClicked:
{
toggleContent()
Cura.MachineManager.setActiveMachine(model.id)
border.color: machineSelectorButton.selected ? UM.Theme.getColor("primary") : "transparent"
}
Connections
{
target: outputDevice
onUniqueConfigurationsChanged: updatePrinterTypesList()
onUniqueConfigurationsChanged: updatePrinterTypesFunction()
}
Connections
{
target: Cura.MachineManager
onOutputDevicesChanged: updatePrinterTypesList()
onOutputDevicesChanged: updatePrinterTypesFunction()
}
Component.onCompleted: updatePrinterTypesList()
Component.onCompleted: updatePrinterTypesFunction()
}

View file

@ -32,15 +32,12 @@ ListView
width: listView.width
outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
checked:
checked: Cura.MachineManager.activeMachineId == model.id
onClicked:
{
// If the machine has a remote connection
var result = Cura.MachineManager.activeMachineId == model.id
if (Cura.MachineManager.activeMachineHasRemoteConnection)
{
result |= Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["group_name"]
}
return result
toggleContent()
Cura.MachineManager.setActiveMachine(model.id)
}
}
}