mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
parent
084bd25e02
commit
783b75bcd9
1 changed files with 35 additions and 15 deletions
|
@ -12,7 +12,6 @@ import ".."
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: wizardPage
|
id: wizardPage
|
||||||
property string title
|
property string title
|
||||||
anchors.fill: parent
|
|
||||||
signal openFile(string fileName)
|
signal openFile(string fileName)
|
||||||
signal closeWizard()
|
signal closeWizard()
|
||||||
|
|
||||||
|
@ -34,11 +33,11 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
Layout.fillWidth: true;
|
|
||||||
ListView {
|
ListView {
|
||||||
id: machineList;
|
id: machineList;
|
||||||
model: UM.Models.availableMachinesModel
|
model: UM.Models.availableMachinesModel
|
||||||
delegate: RadioButton {
|
delegate: RadioButton {
|
||||||
|
id:machine_button
|
||||||
exclusiveGroup: printerGroup;
|
exclusiveGroup: printerGroup;
|
||||||
checked: ListView.view.currentIndex == index ? true : false
|
checked: ListView.view.currentIndex == index ? true : false
|
||||||
text: model.name;
|
text: model.name;
|
||||||
|
@ -50,39 +49,60 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr("Variation:");
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollView {
|
||||||
|
ListView {
|
||||||
|
id: variations_list
|
||||||
|
model: machineList.model.getItem(machineList.currentIndex).variations
|
||||||
|
delegate: RadioButton {
|
||||||
|
id: variation_radio_button
|
||||||
|
checked: ListView.view.currentIndex == index ? true : false
|
||||||
|
exclusiveGroup: variationGroup;
|
||||||
|
text: model.name;
|
||||||
|
onClicked: ListView.view.currentIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
//: Add Printer wizard field label
|
//: Add Printer wizard field label
|
||||||
text: qsTr("Printer Name:");
|
text: qsTr("Printer Name:");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
|
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
|
||||||
|
|
||||||
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
||||||
|
|
||||||
ExclusiveGroup { id: printerGroup; }
|
ExclusiveGroup { id: printerGroup; }
|
||||||
|
ExclusiveGroup { id: variationGroup; }
|
||||||
|
|
||||||
function getSpecialMachineType(machineId){
|
function getSpecialMachineType(machineId){
|
||||||
for (var i = 0; i < UM.Models.addMachinesModel.rowCount(); i++) {
|
for (var i = 0; i < UM.Models.addMachinesModel.rowCount(); i++) {
|
||||||
if (UM.Models.addMachinesModel.getItem(i).id == machineId){
|
if (UM.Models.addMachinesModel.getItem(i).name == machineId){
|
||||||
return UM.Models.addMachinesModel.getItem(i).file
|
return UM.Models.addMachinesModel.getItem(i).name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveMachine(){
|
function saveMachine(){
|
||||||
if(machineList.currentIndex != -1) {
|
if(machineList.currentIndex != -1) {
|
||||||
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text)
|
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, variations_list.currentIndex, machineName.text)
|
||||||
|
|
||||||
var chosenMachineType = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).type
|
var originalString = "Ultimaker Original"
|
||||||
var originalMachineType = getSpecialMachineType("ultimaker_original")
|
var originalPlusString = "Ultimaker Original+"
|
||||||
var orginalPlusMachineType = getSpecialMachineType("ultimaker_original_plus")
|
var originalMachineType = getSpecialMachineType(originalString)
|
||||||
|
|
||||||
if (chosenMachineType == originalMachineType)
|
if (UM.Models.availableMachinesModel.getItem(machineList.currentIndex).name == originalMachineType){
|
||||||
wizardPage.openFile(originalMachineType)
|
var variation = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).name
|
||||||
if (chosenMachineType == orginalPlusMachineType)
|
if (variation == originalString || variation == originalPlusString){
|
||||||
wizardPage.openFile(orginalPlusMachineType)
|
console.log(UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).type)
|
||||||
else
|
wizardPage.openFile(UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
wizardPage.closeWizard()
|
wizardPage.closeWizard()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue