diff --git a/cura/MachineActionManager.py b/cura/MachineActionManager.py index 287ed89891..c26d38331c 100644 --- a/cura/MachineActionManager.py +++ b/cura/MachineActionManager.py @@ -89,6 +89,7 @@ class MachineActionManager(QObject): ## Add a (unique) MachineAction # if the Key of the action is not unique, an exception is raised. def addMachineAction(self, action): + print("ADDING ACTIOONNN", action) if action.getKey() not in self._machine_actions: self._machine_actions[action.getKey()] = action else: diff --git a/plugins/UltimakerMachineActions/BedLevelMachineAction.qml b/plugins/UltimakerMachineActions/BedLevelMachineAction.qml index 5d1140e03d..381c79b076 100644 --- a/plugins/UltimakerMachineActions/BedLevelMachineAction.qml +++ b/plugins/UltimakerMachineActions/BedLevelMachineAction.qml @@ -53,7 +53,7 @@ Cura.MachineAction anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.horizontalCenter: parent.horizontalCenter height: skipBedlevelingButton.height - width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height < wizardPage.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height : wizardPage.width + width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height < bedLevelMachineAction.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height : bedLevelMachineAction.width Button { id: bedlevelingButton @@ -69,10 +69,10 @@ Cura.MachineAction Button { id: skipBedlevelingButton - anchors.top: parent.width < wizardPage.width ? parent.top : bedlevelingButton.bottom - anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.getSize("default_margin").height/2 - anchors.left: parent.width < wizardPage.width ? bedlevelingButton.right : parent.left - anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.getSize("default_margin").width : 0 + anchors.top: parent.width < bedLevelMachineAction.width ? parent.top : bedlevelingButton.bottom + anchors.topMargin: parent.width < bedLevelMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2 + anchors.left: parent.width < bedLevelMachineAction.width ? bedlevelingButton.right : parent.left + anchors.leftMargin: parent.width < bedLevelMachineAction.width ? UM.Theme.getSize("default_margin").width : 0 text: catalog.i18nc("@action:button","Skip bed leveling"); onClicked: { diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/AddMachineDialog.qml index 9d2d1a24ff..38221030ea 100644 --- a/resources/qml/AddMachineDialog.qml +++ b/resources/qml/AddMachineDialog.qml @@ -18,6 +18,7 @@ UM.Dialog title: catalog.i18nc("@title:window", "Add Printer") property string activeManufacturer: "Ultimaker"; + signal machineAdded(string id) function getMachineName() { var name = machineList.model.getItem(machineList.currentIndex).name @@ -162,6 +163,7 @@ UM.Dialog base.visible = false var item = machineList.model.getItem(machineList.currentIndex); Cura.MachineManager.addMachine(machineName.text, item.id) + base.machineAdded(item.id) // Emit signal that the user added a machine. } } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 6dd57e17c8..90143f4817 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -771,6 +771,41 @@ UM.MainWindow AddMachineDialog { id: addMachineDialog + onMachineAdded: + { + firstRunWizard.start(id) + } + } + + // Dialog to handle first run machine actions + UM.Wizard + { + id: firstRunWizard; + + title: catalog.i18nc("@title:window", "Add Printer") + property var machine; + + function start(id) + { + var actions = Cura.MachineActionManager.getFirstStartActions(id) + resetPages() // Remove previous pages + + for (var i = 0; i < actions.length; i++) + { + firstRunWizard.appendPage(actions[i].displayItem, catalog.i18nc("@title", actions[i].label)); + //firstRunWizard.appendPage(actions[i].displayItem, catalog.i18nc("@title","blarg")); + console.log("ZOMGIE", i, actions[i].displayItem) + //firstRunWizard.appendPage(test, catalog.i18nc("@title", "Add Printer")); + } + + //Only start if there are actions to perform. + if (actions.length > 0) + { + firstRunWizard.currentPage = 0; + console.log(firstRunWizard.currentPage) + show() + } + } } Connections