mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-08 04:39:03 +08:00
Fix creating print job name
Also fixed up the code style of that bit. Perhaps this should've been done in Python, but that is for later. Contributes to issue CURA-1278.
This commit is contained in:
parent
332321b991
commit
c80455c6bc
@ -813,7 +813,7 @@ UM.MainWindow
|
|||||||
base.visible = true;
|
base.visible = true;
|
||||||
restart();
|
restart();
|
||||||
}
|
}
|
||||||
else if(UM.MachineManager.activeMachineInstance == "")
|
else if(Cura.MachineManager.activeMachineName == "")
|
||||||
{
|
{
|
||||||
addMachineDialog.firstRun = true;
|
addMachineDialog.firstRun = true;
|
||||||
addMachineDialog.open();
|
addMachineDialog.open();
|
||||||
|
@ -7,15 +7,16 @@ import QtQuick.Controls.Styles 1.1
|
|||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: base;
|
id: base;
|
||||||
|
|
||||||
property bool activity: Printer.getPlatformActivity;
|
property bool activity: Printer.getPlatformActivity;
|
||||||
property string fileBaseName
|
property string fileBaseName
|
||||||
property variant activeMachineInstance: UM.MachineManager.activeMachineInstance
|
property variant activeMachineName: Cura.MachineManager.activeMachineName
|
||||||
|
|
||||||
onActiveMachineInstanceChanged:
|
onActiveMachineNameChanged:
|
||||||
{
|
{
|
||||||
base.createFileName()
|
base.createFileName()
|
||||||
}
|
}
|
||||||
@ -28,27 +29,34 @@ Rectangle {
|
|||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
function createFileName(){
|
function createFileName()
|
||||||
var splitMachineName = UM.MachineManager.activeMachineInstance.split(" ")
|
{
|
||||||
var abbrMachine = ''
|
var splitMachineName = Cura.MachineManager.activeMachineName.split(" ");
|
||||||
for (var i = 0; i < splitMachineName.length; i++){
|
var abbrMachine = '';
|
||||||
if (splitMachineName[i].search(/ultimaker/i) != -1){
|
for (var i = 0; i < splitMachineName.length; i++)
|
||||||
abbrMachine += 'UM'
|
{
|
||||||
|
if (splitMachineName[i].search(/ultimaker/i) != -1)
|
||||||
|
{
|
||||||
|
abbrMachine += 'UM';
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
|
if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
|
||||||
abbrMachine += splitMachineName[i].charAt(0)
|
{
|
||||||
|
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 + '_' + base.fileBaseName
|
printJobTextfield.text = abbrMachine + '_' + base.fileBaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user