mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
CURA-4870 Add printer type selector that show the unique name list of
all the types of printers in a group.
This commit is contained in:
parent
ac635ba748
commit
3aa3729635
7 changed files with 62 additions and 17 deletions
|
@ -6,7 +6,7 @@ from UM.Logger import Logger
|
|||
MYPY = False
|
||||
if MYPY:
|
||||
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
||||
from cura.PrinterOutput.ExtruderOuputModel import ExtruderOuputModel
|
||||
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel
|
||||
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@ class PrinterOutputController:
|
|||
self.can_control_manually = True
|
||||
self._output_device = output_device
|
||||
|
||||
def setTargetHotendTemperature(self, printer: "PrinterOutputModel", extruder: "ExtruderOuputModel", temperature: int):
|
||||
def setTargetHotendTemperature(self, printer: "PrinterOutputModel", extruder: "ExtruderOutputModel", temperature: int):
|
||||
Logger.log("w", "Set target hotend temperature not implemented in controller")
|
||||
|
||||
def setTargetBedTemperature(self, printer: "PrinterOutputModel", temperature: int):
|
||||
|
|
|
@ -5,7 +5,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant, pyqtSlot
|
|||
from UM.Logger import Logger
|
||||
from typing import Optional, List
|
||||
from UM.Math.Vector import Vector
|
||||
from cura.PrinterOutput.ExtruderOuputModel import ExtruderOutputModel
|
||||
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel
|
||||
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
|
|
|
@ -33,7 +33,7 @@ ItemDelegate
|
|||
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
|
||||
radius: Math.round(width / 2)
|
||||
|
||||
color: control.model.getItem(index).color
|
||||
color: model.color
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,25 @@ ComboBox
|
|||
|
||||
property var panelWidth: control.width
|
||||
|
||||
model: Cura.ExtrudersModel { }
|
||||
model: ListModel {
|
||||
|
||||
ListElement {
|
||||
name: "Configuration 1"
|
||||
color: "yellow"
|
||||
}
|
||||
ListElement {
|
||||
name: "Configuration 2"
|
||||
color: "black"
|
||||
}
|
||||
ListElement {
|
||||
name: "Configuration 3"
|
||||
color: "green"
|
||||
}
|
||||
ListElement {
|
||||
name: "Configuration 4"
|
||||
color: "red"
|
||||
}
|
||||
}
|
||||
|
||||
textRole: "name"
|
||||
|
||||
|
@ -85,7 +103,7 @@ ComboBox
|
|||
implicitHeight: contentItem.implicitHeight
|
||||
padding: UM.Theme.getSize("default_lining").width
|
||||
|
||||
contentItem: GridView {
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
model: control.popup.visible ? control.delegateModel : null
|
||||
|
@ -103,7 +121,7 @@ ComboBox
|
|||
delegate: ConfigurationItem
|
||||
{
|
||||
width: panelWidth - 2 * UM.Theme.getSize("default_lining").width
|
||||
height: control.height
|
||||
height: control.height - 2 * UM.Theme.getSize("default_lining").height
|
||||
highlighted: control.highlightedIndex == index
|
||||
}
|
||||
}
|
36
resources/qml/Menus/PrinterTypeMenu.qml
Normal file
36
resources/qml/Menus/PrinterTypeMenu.qml
Normal file
|
@ -0,0 +1,36 @@
|
|||
// 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.3 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
id: menu
|
||||
title: "Printer type"
|
||||
property var outputDevice: Cura.MachineManager.printerOutputDevices[0]
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: printerTypeInstantiator
|
||||
model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : null
|
||||
|
||||
MenuItem {
|
||||
text: modelData.machine_type
|
||||
checkable: true
|
||||
checked: false
|
||||
exclusiveGroup: group
|
||||
// onTriggered:
|
||||
// {
|
||||
// TODO
|
||||
// }
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group }
|
||||
}
|
|
@ -71,16 +71,7 @@ Column
|
|||
anchors.right: parent.right
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
activeFocusOnPress: true;
|
||||
menu: Menu {
|
||||
MenuItem
|
||||
{
|
||||
text: "Printer type 1"
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text: "Printer type 2"
|
||||
}
|
||||
}
|
||||
menu: PrinterTypeMenu { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue