mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 14:34:01 -06:00
Merge branch 'feature_add_printer_layout' of https://github.com/fieldOfView/Cura
This commit is contained in:
commit
6256e3f24b
37 changed files with 112 additions and 60 deletions
|
@ -45,10 +45,46 @@ UM.Dialog
|
|||
}
|
||||
|
||||
signal machineAdded(string id)
|
||||
|
||||
function getMachineName()
|
||||
{
|
||||
var name = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : ""
|
||||
return name
|
||||
return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : "";
|
||||
}
|
||||
|
||||
function getMachineMetaDataEntry(key)
|
||||
{
|
||||
var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined;
|
||||
if (metadata)
|
||||
{
|
||||
return metadata[key];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
Label {
|
||||
id: titleLabel
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
topMargin: UM.Theme.getSize("default_margin")
|
||||
}
|
||||
text: catalog.i18nc("@title:tab", "Add a printer to Cura")
|
||||
|
||||
font.pointSize: 18
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: captionLabel
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
top: titleLabel.bottom
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
text: catalog.i18nc("@title:tab", "Select the printer you want to use from the list below.\n\nIf your printer is not in the list, use the \"Custom FFF Printer\" from the \"Custom\" category and match adjust the settings to match your printer in the next dialog.")
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
ScrollView
|
||||
|
@ -57,13 +93,21 @@ UM.Dialog
|
|||
|
||||
anchors
|
||||
{
|
||||
left: parent.left;
|
||||
top: parent.top;
|
||||
right: parent.right;
|
||||
bottom: machineNameRow.top;
|
||||
top: captionLabel.visible ? captionLabel.bottom : parent.top;
|
||||
topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0;
|
||||
bottom: addPrinterButton.top;
|
||||
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
|
||||
width: Math.round(parent.width * 0.45)
|
||||
|
||||
frameVisible: true;
|
||||
Rectangle {
|
||||
parent: viewport
|
||||
anchors.fill: parent
|
||||
color: palette.light
|
||||
}
|
||||
|
||||
ListView
|
||||
{
|
||||
id: machineList
|
||||
|
@ -184,32 +228,76 @@ UM.Dialog
|
|||
}
|
||||
}
|
||||
|
||||
Row
|
||||
Column
|
||||
{
|
||||
id: machineNameRow
|
||||
anchors.bottom:parent.bottom
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Label
|
||||
anchors
|
||||
{
|
||||
text: catalog.i18nc("@label", "Printer Name:")
|
||||
anchors.verticalCenter: machineName.verticalCenter
|
||||
top: machinesHolder.top
|
||||
left: machinesHolder.right
|
||||
right: parent.right
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
||||
TextField
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
Label
|
||||
{
|
||||
id: machineName
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: getMachineName()
|
||||
implicitWidth: UM.Theme.getSize("standard_list_input").width
|
||||
maximumLength: 40
|
||||
//validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed.
|
||||
validator: RegExpValidator
|
||||
font.pointSize: 16
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Grid
|
||||
{
|
||||
width: parent.width
|
||||
columns: 2
|
||||
rowSpacing: UM.Theme.getSize("default_lining").height
|
||||
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||
verticalItemAlignment: Grid.AlignVCenter
|
||||
|
||||
Label
|
||||
{
|
||||
regExp: {
|
||||
machineName.machine_name_validator.machineNameRegex
|
||||
}
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Manufacturer")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.floor(parent.width * 0.65)
|
||||
wrapMode: Text.WordWrap
|
||||
text: getMachineMetaDataEntry("manufacturer")
|
||||
}
|
||||
Label
|
||||
{
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Author")
|
||||
}
|
||||
Label
|
||||
{
|
||||
width: Math.floor(parent.width * 0.75)
|
||||
wrapMode: Text.WordWrap
|
||||
text: getMachineMetaDataEntry("author")
|
||||
}
|
||||
Label
|
||||
{
|
||||
wrapMode: Text.WordWrap
|
||||
text: catalog.i18nc("@label", "Printer Name")
|
||||
}
|
||||
TextField
|
||||
{
|
||||
id: machineName
|
||||
text: getMachineName()
|
||||
width: Math.floor(parent.width * 0.75)
|
||||
implicitWidth: UM.Theme.getSize("standard_list_input").width
|
||||
maximumLength: 40
|
||||
//validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed.
|
||||
validator: RegExpValidator
|
||||
{
|
||||
regExp: {
|
||||
machineName.machine_name_validator.machineNameRegex
|
||||
}
|
||||
}
|
||||
property var machine_name_validator: Cura.MachineNameValidator { }
|
||||
}
|
||||
property var machine_name_validator: Cura.MachineNameValidator { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue