mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
CURA-4461 Add dropdown menu in the UI for selecting the buildplate if
the printer has different buildplates.
This commit is contained in:
parent
342bdda641
commit
becb0cf7b9
4 changed files with 149 additions and 3 deletions
|
@ -844,6 +844,11 @@ class MachineManager(QObject):
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "While trying to set the active variant, no variant was found to replace.")
|
Logger.log("w", "While trying to set the active variant, no variant was found to replace.")
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def setActiveVariantBuildplate(self, variant_buildplate_id: str):
|
||||||
|
Logger.log("d", "Attempting to change the active buildplate to %s", variant_buildplate_id)
|
||||||
|
pass
|
||||||
|
|
||||||
## set the active quality
|
## set the active quality
|
||||||
# \param quality_id The quality_id of either a quality or a quality_changes
|
# \param quality_id The quality_id of either a quality or a quality_changes
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
|
@ -1105,6 +1110,15 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify = activeVariantChanged)
|
||||||
|
def activeVariantBuildplateName(self) -> str:
|
||||||
|
if self._global_container_stack:
|
||||||
|
variant = self._global_container_stack.variant
|
||||||
|
if variant:
|
||||||
|
return variant.getName()
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
@pyqtProperty(str, notify = globalContainerChanged)
|
@pyqtProperty(str, notify = globalContainerChanged)
|
||||||
def activeDefinitionId(self) -> str:
|
def activeDefinitionId(self) -> str:
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
|
@ -1202,7 +1216,6 @@ class MachineManager(QObject):
|
||||||
def hasMaterials(self) -> bool:
|
def hasMaterials(self) -> bool:
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
return Util.parseBool(self._global_container_stack.getMetaDataEntry("has_materials", False))
|
return Util.parseBool(self._global_container_stack.getMetaDataEntry("has_materials", False))
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@pyqtProperty(bool, notify = globalContainerChanged)
|
@pyqtProperty(bool, notify = globalContainerChanged)
|
||||||
|
@ -1211,6 +1224,12 @@ class MachineManager(QObject):
|
||||||
return Util.parseBool(self._global_container_stack.getMetaDataEntry("has_variants", False))
|
return Util.parseBool(self._global_container_stack.getMetaDataEntry("has_variants", False))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify = globalContainerChanged)
|
||||||
|
def hasVariantBuildplates(self) -> bool:
|
||||||
|
if self._global_container_stack:
|
||||||
|
return Util.parseBool(self._global_container_stack.getMetaDataEntry("has_variant_buildplates", False))
|
||||||
|
return False
|
||||||
|
|
||||||
## Property to indicate if a machine has "specialized" material profiles.
|
## Property to indicate if a machine has "specialized" material profiles.
|
||||||
# Some machines have their own material profiles that "override" the default catch all profiles.
|
# Some machines have their own material profiles that "override" the default catch all profiles.
|
||||||
@pyqtProperty(bool, notify = globalContainerChanged)
|
@pyqtProperty(bool, notify = globalContainerChanged)
|
||||||
|
|
|
@ -874,7 +874,7 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
# Map XML file setting names to internal names
|
# Map XML file setting names to internal names
|
||||||
__material_settings_setting_map = {
|
__material_settings_setting_map = {
|
||||||
"print temperature": "default_material_print_temperature",
|
"print temperature": "default_material_print_temperature",
|
||||||
"heated bed temperature": "material_bed_temperature",
|
"heated bed temperature": "default_material_bed_temperature",
|
||||||
"standby temperature": "material_standby_temperature",
|
"standby temperature": "material_standby_temperature",
|
||||||
"processing temperature graph": "material_flow_temp_graph",
|
"processing temperature graph": "material_flow_temp_graph",
|
||||||
"print cooling": "cool_fan_speed",
|
"print cooling": "cool_fan_speed",
|
||||||
|
|
87
resources/qml/Menus/BuildplateMenu.qml
Normal file
87
resources/qml/Menus/BuildplateMenu.qml
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Controls 1.1
|
||||||
|
|
||||||
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
|
Menu
|
||||||
|
{
|
||||||
|
id: menu
|
||||||
|
title: "Build plate"
|
||||||
|
|
||||||
|
property int buildplateIndex: 0
|
||||||
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
|
property bool isClusterPrinter:
|
||||||
|
{
|
||||||
|
if(Cura.MachineManager.printerOutputDevices.length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
|
||||||
|
// This is not a cluster printer or the cluster it is just one printer
|
||||||
|
if(clusterSize == undefined || clusterSize == 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MenuItem
|
||||||
|
// {
|
||||||
|
// id: automaticBuildplate
|
||||||
|
// text:
|
||||||
|
// {
|
||||||
|
// if(printerConnected && Cura.MachineManager.buildplateIds.length > buildplateIndex && !isClusterPrinter)
|
||||||
|
// {
|
||||||
|
// var buildplateName = Cura.MachineManager.buildplateIds[buildplateIndex]
|
||||||
|
// return catalog.i18nc("@title:menuitem %1 is the buildplate currently loaded in the printer", "Automatic: %1").arg(buildplateName)
|
||||||
|
// }
|
||||||
|
// return ""
|
||||||
|
// }
|
||||||
|
// visible: printerConnected && Cura.MachineManager.buildplateIds.length > buildplateIndex && !isClusterPrinter
|
||||||
|
// onTriggered:
|
||||||
|
// {
|
||||||
|
// var buildplateId = Cura.MachineManager.buildplateIds[buildplateIndex]
|
||||||
|
// var itemIndex = buildplateInstantiator.model.find("name", buildplateId);
|
||||||
|
// if(itemIndex > -1)
|
||||||
|
// {
|
||||||
|
// Cura.MachineManager.setActiveVariantBuildplate(buildplateInstantiator.model.getItem(itemIndex).id);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// MenuSeparator
|
||||||
|
// {
|
||||||
|
// visible: automaticBuildplate.visible
|
||||||
|
// }
|
||||||
|
|
||||||
|
Instantiator
|
||||||
|
{
|
||||||
|
id: buildplateInstantiator
|
||||||
|
model: UM.InstanceContainersModel
|
||||||
|
{
|
||||||
|
filter:
|
||||||
|
{
|
||||||
|
"type": "variant",
|
||||||
|
"definition": Cura.MachineManager.activeQualityDefinitionId //Only show variants of this machine
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MenuItem {
|
||||||
|
text: model.name
|
||||||
|
checkable: true
|
||||||
|
checked: model.id == Cura.MachineManager.buildplateIds[buildplateIndex]
|
||||||
|
exclusiveGroup: group
|
||||||
|
onTriggered:
|
||||||
|
{
|
||||||
|
Cura.MachineManager.setActiveVariantBuildplate(model.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onObjectAdded: menu.insertItem(index, object)
|
||||||
|
onObjectRemoved: menu.removeItem(object)
|
||||||
|
}
|
||||||
|
|
||||||
|
ExclusiveGroup { id: group }
|
||||||
|
}
|
|
@ -279,7 +279,7 @@ Column
|
||||||
{
|
{
|
||||||
id: variantRow
|
id: variantRow
|
||||||
height: UM.Theme.getSize("sidebar_setup").height
|
height: UM.Theme.getSize("sidebar_setup").height
|
||||||
visible: Cura.MachineManager.hasVariants && !sidebar.monitoringPrint && !sidebar.hideSettings
|
visible: Cura.MachineManager.hasBuildPlateVariant && !sidebar.monitoringPrint && !sidebar.hideSettings
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
|
@ -314,6 +314,46 @@ Column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Buildplate row
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: buildplateRow
|
||||||
|
height: UM.Theme.getSize("sidebar_setup").height
|
||||||
|
visible: Cura.MachineManager.hasVariantBuildplates && !sidebar.monitoringPrint && !sidebar.hideSettings
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: bulidplateLabel
|
||||||
|
text: catalog.i18nc("@label","Buildplate");
|
||||||
|
width: Math.floor(parent.width * 0.45 - UM.Theme.getSize("default_margin").width)
|
||||||
|
font: UM.Theme.getFont("default");
|
||||||
|
color: UM.Theme.getColor("text");
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton {
|
||||||
|
id: buildplateSelection
|
||||||
|
text: Cura.MachineManager.activeVariantBuildplateName
|
||||||
|
tooltip: Cura.MachineManager.activeVariantBuildplateName
|
||||||
|
visible: Cura.MachineManager.hasVariantBuildplates
|
||||||
|
|
||||||
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
width: Math.floor(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width)
|
||||||
|
anchors.right: parent.right
|
||||||
|
style: UM.Theme.styles.sidebar_header_button
|
||||||
|
activeFocusOnPress: true;
|
||||||
|
|
||||||
|
menu: BuildplateMenu
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Material info row
|
// Material info row
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue