mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 15:57:52 -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
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
||||||
from cura.PrinterOutput.ExtruderOuputModel import ExtruderOuputModel
|
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel
|
||||||
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class PrinterOutputController:
|
||||||
self.can_control_manually = True
|
self.can_control_manually = True
|
||||||
self._output_device = output_device
|
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")
|
Logger.log("w", "Set target hotend temperature not implemented in controller")
|
||||||
|
|
||||||
def setTargetBedTemperature(self, printer: "PrinterOutputModel", temperature: int):
|
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 UM.Logger import Logger
|
||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
from cura.PrinterOutput.ExtruderOuputModel import ExtruderOutputModel
|
from cura.PrinterOutput.ExtruderOutputModel import ExtruderOutputModel
|
||||||
|
|
||||||
MYPY = False
|
MYPY = False
|
||||||
if MYPY:
|
if MYPY:
|
||||||
|
|
|
@ -33,7 +33,7 @@ ItemDelegate
|
||||||
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
|
border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
|
||||||
radius: Math.round(width / 2)
|
radius: Math.round(width / 2)
|
||||||
|
|
||||||
color: control.model.getItem(index).color
|
color: model.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,25 @@ ComboBox
|
||||||
|
|
||||||
property var panelWidth: control.width
|
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"
|
textRole: "name"
|
||||||
|
|
||||||
|
@ -85,7 +103,7 @@ ComboBox
|
||||||
implicitHeight: contentItem.implicitHeight
|
implicitHeight: contentItem.implicitHeight
|
||||||
padding: UM.Theme.getSize("default_lining").width
|
padding: UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
contentItem: GridView {
|
contentItem: ListView {
|
||||||
clip: true
|
clip: true
|
||||||
implicitHeight: contentHeight
|
implicitHeight: contentHeight
|
||||||
model: control.popup.visible ? control.delegateModel : null
|
model: control.popup.visible ? control.delegateModel : null
|
||||||
|
@ -103,7 +121,7 @@ ComboBox
|
||||||
delegate: ConfigurationItem
|
delegate: ConfigurationItem
|
||||||
{
|
{
|
||||||
width: panelWidth - 2 * UM.Theme.getSize("default_lining").width
|
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
|
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
|
anchors.right: parent.right
|
||||||
style: UM.Theme.styles.sidebar_header_button
|
style: UM.Theme.styles.sidebar_header_button
|
||||||
activeFocusOnPress: true;
|
activeFocusOnPress: true;
|
||||||
menu: Menu {
|
menu: PrinterTypeMenu { }
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text: "Printer type 1"
|
|
||||||
}
|
|
||||||
MenuItem
|
|
||||||
{
|
|
||||||
text: "Printer type 2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue