mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 01:35:53 +08:00
15.10 rework of the automatic filename functionality
Contributes to: issue CURA-60
This commit is contained in:
parent
546872aa87
commit
a839371832
@ -15,33 +15,48 @@ Rectangle {
|
|||||||
property bool activity: Printer.getPlatformActivity;
|
property bool activity: Printer.getPlatformActivity;
|
||||||
Behavior on progress { NumberAnimation { duration: 250; } }
|
Behavior on progress { NumberAnimation { duration: 250; } }
|
||||||
property int totalHeight: childrenRect.height
|
property int totalHeight: childrenRect.height
|
||||||
|
property string fileBaseName
|
||||||
|
property variant activeMachineInstance: UM.MachineManager.activeMachineInstance
|
||||||
|
|
||||||
|
onActiveMachineInstanceChanged:
|
||||||
|
{
|
||||||
|
base.createFileName()
|
||||||
|
}
|
||||||
|
|
||||||
UM.I18nCatalog { id: catalog; name:"cura"}
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
||||||
|
|
||||||
property variant printDuration: PrintInformation.currentPrintTime;
|
property variant printDuration: PrintInformation.currentPrintTime;
|
||||||
property real printMaterialAmount: PrintInformation.materialAmount;
|
property real printMaterialAmount: PrintInformation.materialAmount;
|
||||||
|
|
||||||
function createFileName(baseName){
|
function createFileName(){
|
||||||
var splitMachineName = UM.Application.machineName.split(" ")
|
var splitMachineName = UM.MachineManager.activeMachineInstance.split(" ")
|
||||||
var abbrMachine = ''
|
var abbrMachine = ''
|
||||||
for (var i = 0; i < splitMachineName.length; i++){
|
for (var i = 0; i < splitMachineName.length; i++){
|
||||||
if (splitMachineName[i].search(/ultimaker/i) != -1)
|
if (splitMachineName[i].search(/ultimaker/i) != -1){
|
||||||
abbrMachine += 'UM'
|
abbrMachine += 'UM'
|
||||||
else
|
}
|
||||||
abbrMachine += splitMachineName[i].charAt(0)
|
else{
|
||||||
|
if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
|
||||||
|
abbrMachine += splitMachineName[i].charAt(0)
|
||||||
|
}
|
||||||
var regExpAdditives = /[0-9\+]/g;
|
var regExpAdditives = /[0-9\+]/g;
|
||||||
var resultAdditives = splitMachineName[i].match(regExpAdditives);
|
var resultAdditives = splitMachineName[i].match(regExpAdditives);
|
||||||
if (resultAdditives != null){
|
if (resultAdditives != null){
|
||||||
for (var j = 0; j < resultAdditives.length; j++){ abbrMachine += resultAdditives[j] }
|
for (var j = 0; j < resultAdditives.length; j++){
|
||||||
|
abbrMachine += resultAdditives[j]
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printJobTextfield.text = abbrMachine + '_' + baseName
|
printJobTextfield.text = abbrMachine + '_' + base.fileBaseName
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: openDialog
|
target: openDialog
|
||||||
onHasMesh: base.createFileName(name)
|
onHasMesh: {
|
||||||
|
base.fileBaseName = name
|
||||||
|
base.createFileName()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user