mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
CURA-4870 Match the printer type in the dropdown with one of the
available printer types in the group
This commit is contained in:
parent
be8fc9f3f1
commit
3629c3959e
5 changed files with 72 additions and 49 deletions
|
@ -451,6 +451,12 @@ class MachineManager(QObject):
|
||||||
def stacksHaveErrors(self) -> bool:
|
def stacksHaveErrors(self) -> bool:
|
||||||
return bool(self._stacks_have_errors)
|
return bool(self._stacks_have_errors)
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify = globalContainerChanged)
|
||||||
|
def activeMachineDefinitionName(self) -> str:
|
||||||
|
if self._global_container_stack:
|
||||||
|
return self._global_container_stack.definition.getName()
|
||||||
|
return ""
|
||||||
|
|
||||||
@pyqtProperty(str, notify = globalContainerChanged)
|
@pyqtProperty(str, notify = globalContainerChanged)
|
||||||
def activeMachineName(self) -> str:
|
def activeMachineName(self) -> str:
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
|
@ -1024,6 +1030,17 @@ class MachineManager(QObject):
|
||||||
self._setMaterial(position, new_material)
|
self._setMaterial(position, new_material)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
def switchPrinterType(self, machine_type):
|
||||||
|
container_registry = ContainerRegistry.getInstance()
|
||||||
|
machine_definition = container_registry.findDefinitionContainers(name = machine_type)[0]
|
||||||
|
self._global_container_stack.definition = machine_definition
|
||||||
|
self.globalContainerChanged.emit()
|
||||||
|
# machine_stack = CuraStackBuilder.createMachine("ultimaker_s5" + "_instance", "ultimaker_s5")
|
||||||
|
# # if not machine_stack:
|
||||||
|
# # raise Exception("No machine found for ID {}".format(machine_id))
|
||||||
|
# Logger.log("d", "Setting active machine to %s", machine_stack.getId())
|
||||||
|
# self.setActiveMachine(machine_stack.getId())
|
||||||
|
|
||||||
@pyqtSlot(QObject)
|
@pyqtSlot(QObject)
|
||||||
def applyRemoteConfiguration(self, configuration: ConfigurationModel):
|
def applyRemoteConfiguration(self, configuration: ConfigurationModel):
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
|
|
|
@ -57,7 +57,7 @@ Column
|
||||||
section.criteria: ViewSection.FullString
|
section.criteria: ViewSection.FullString
|
||||||
section.delegate: sectionHeading
|
section.delegate: sectionHeading
|
||||||
|
|
||||||
model: outputDevice.uniqueConfigurations
|
model: (ouputDevice != null) ? outputDevice.uniqueConfigurations : []
|
||||||
delegate: ConfigurationItem
|
delegate: ConfigurationItem
|
||||||
{
|
{
|
||||||
width: parent.width - UM.Theme.getSize("default_margin").width
|
width: parent.width - UM.Theme.getSize("default_margin").width
|
||||||
|
|
|
@ -18,13 +18,16 @@ Button
|
||||||
|
|
||||||
function updateOnSync()
|
function updateOnSync()
|
||||||
{
|
{
|
||||||
for (var index in outputDevice.uniqueConfigurations)
|
if (outputDevice != undefined)
|
||||||
{
|
{
|
||||||
var configuration = outputDevice.uniqueConfigurations[index]
|
for (var index in outputDevice.uniqueConfigurations)
|
||||||
if (Cura.MachineManager.matchesConfiguration(configuration))
|
|
||||||
{
|
{
|
||||||
base.text = catalog.i18nc("@label:sync indicator", "Matched")
|
var configuration = outputDevice.uniqueConfigurations[index]
|
||||||
return
|
if (Cura.MachineManager.matchesConfiguration(configuration))
|
||||||
|
{
|
||||||
|
base.text = catalog.i18nc("@label:sync indicator", "Matched")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base.text = catalog.i18nc("@label:sync indicator", "No match")
|
base.text = catalog.i18nc("@label:sync indicator", "No match")
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Copyright (c) 2018 Ultimaker B.V.
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.4
|
||||||
|
|
||||||
import UM 1.3 as UM
|
import UM 1.3 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
@ -16,12 +16,12 @@ Menu
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
id: printerTypeInstantiator
|
id: printerTypeInstantiator
|
||||||
model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : null
|
model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : []
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: modelData.machine_type
|
text: modelData.machine_type
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: false
|
checked: Cura.MachineManager.activeMachineDefinitionName == modelData.machine_type
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
// onTriggered:
|
// onTriggered:
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -17,6 +17,7 @@ Column
|
||||||
property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex;
|
property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex;
|
||||||
property bool currentExtruderVisible: extrudersList.visible;
|
property bool currentExtruderVisible: extrudersList.visible;
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
|
property bool hasManyPrinterTypes: printerConnected ? Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount.length > 1 : false
|
||||||
|
|
||||||
spacing: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.9)
|
spacing: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.9)
|
||||||
|
|
||||||
|
@ -35,45 +36,6 @@ Column
|
||||||
width: height
|
width: height
|
||||||
}
|
}
|
||||||
|
|
||||||
// Printer Type Row
|
|
||||||
Item
|
|
||||||
{
|
|
||||||
id: printerTypeSelectionRow
|
|
||||||
height: UM.Theme.getSize("sidebar_setup").height
|
|
||||||
visible: printerConnected && !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: configurationLabel
|
|
||||||
text: catalog.i18nc("@label", "Printer type");
|
|
||||||
width: Math.round(parent.width * 0.4 - UM.Theme.getSize("default_margin").width)
|
|
||||||
height: parent.height
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
font: UM.Theme.getFont("default");
|
|
||||||
color: UM.Theme.getColor("text");
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolButton
|
|
||||||
{
|
|
||||||
id: printerTypeSelection
|
|
||||||
text: catalog.i18nc("@label", "Printer type");
|
|
||||||
height: UM.Theme.getSize("setting_control").height
|
|
||||||
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width
|
|
||||||
anchors.right: parent.right
|
|
||||||
style: UM.Theme.styles.sidebar_header_button
|
|
||||||
activeFocusOnPress: true;
|
|
||||||
menu: PrinterTypeMenu { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extruder Row
|
// Extruder Row
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
@ -264,6 +226,47 @@ Column
|
||||||
visible: !extruderSelectionRow.visible
|
visible: !extruderSelectionRow.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Printer Type Row
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: printerTypeSelectionRow
|
||||||
|
height: UM.Theme.getSize("sidebar_setup").height
|
||||||
|
visible: printerConnected && hasManyPrinterTypes && !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: configurationLabel
|
||||||
|
text: catalog.i18nc("@label", "Printer type");
|
||||||
|
width: Math.round(parent.width * 0.4 - UM.Theme.getSize("default_margin").width)
|
||||||
|
height: parent.height
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
font: UM.Theme.getFont("default");
|
||||||
|
color: UM.Theme.getColor("text");
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton
|
||||||
|
{
|
||||||
|
id: printerTypeSelection
|
||||||
|
text: Cura.MachineManager.activeMachineDefinitionName
|
||||||
|
tooltip: Cura.MachineManager.activeMachineDefinitionName
|
||||||
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("sidebar_margin").width
|
||||||
|
anchors.right: parent.right
|
||||||
|
style: UM.Theme.styles.sidebar_header_button
|
||||||
|
activeFocusOnPress: true;
|
||||||
|
|
||||||
|
menu: PrinterTypeMenu { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Material Row
|
// Material Row
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue