mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-05 23:04:30 +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;
|
||||
restart();
|
||||
}
|
||||
else if(UM.MachineManager.activeMachineInstance == "")
|
||||
else if(Cura.MachineManager.activeMachineName == "")
|
||||
{
|
||||
addMachineDialog.firstRun = true;
|
||||
addMachineDialog.open();
|
||||
|
@ -7,15 +7,16 @@ import QtQuick.Controls.Styles 1.1
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import UM 1.1 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Rectangle {
|
||||
id: base;
|
||||
|
||||
property bool activity: Printer.getPlatformActivity;
|
||||
property string fileBaseName
|
||||
property variant activeMachineInstance: UM.MachineManager.activeMachineInstance
|
||||
property variant activeMachineName: Cura.MachineManager.activeMachineName
|
||||
|
||||
onActiveMachineInstanceChanged:
|
||||
onActiveMachineNameChanged:
|
||||
{
|
||||
base.createFileName()
|
||||
}
|
||||
@ -28,27 +29,34 @@ Rectangle {
|
||||
height: childrenRect.height
|
||||
color: "transparent"
|
||||
|
||||
function createFileName(){
|
||||
var splitMachineName = UM.MachineManager.activeMachineInstance.split(" ")
|
||||
var abbrMachine = ''
|
||||
for (var i = 0; i < splitMachineName.length; i++){
|
||||
if (splitMachineName[i].search(/ultimaker/i) != -1){
|
||||
abbrMachine += 'UM'
|
||||
}
|
||||
else{
|
||||
if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
|
||||
abbrMachine += splitMachineName[i].charAt(0)
|
||||
}
|
||||
var regExpAdditives = /[0-9\+]/g;
|
||||
var resultAdditives = splitMachineName[i].match(regExpAdditives);
|
||||
if (resultAdditives != null){
|
||||
for (var j = 0; j < resultAdditives.length; j++){
|
||||
abbrMachine += resultAdditives[j]
|
||||
|
||||
}
|
||||
function createFileName()
|
||||
{
|
||||
var splitMachineName = Cura.MachineManager.activeMachineName.split(" ");
|
||||
var abbrMachine = '';
|
||||
for (var i = 0; i < splitMachineName.length; i++)
|
||||
{
|
||||
if (splitMachineName[i].search(/ultimaker/i) != -1)
|
||||
{
|
||||
abbrMachine += 'UM';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
|
||||
{
|
||||
abbrMachine += splitMachineName[i].charAt(0);
|
||||
}
|
||||
}
|
||||
printJobTextfield.text = abbrMachine + '_' + base.fileBaseName
|
||||
var regExpAdditives = /[0-9\+]/g;
|
||||
var resultAdditives = splitMachineName[i].match(regExpAdditives);
|
||||
if (resultAdditives != null)
|
||||
{
|
||||
for (var j = 0; j < resultAdditives.length; j++)
|
||||
{
|
||||
abbrMachine += resultAdditives[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
printJobTextfield.text = abbrMachine + '_' + base.fileBaseName;
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
Loading…
x
Reference in New Issue
Block a user