First run actions are now properly handled

CURA-1385
This commit is contained in:
Jaime van Kessel 2016-06-22 11:49:35 +02:00
parent 6f6d70ad0f
commit 8cfc0737ac
4 changed files with 43 additions and 5 deletions

View file

@ -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:

View file

@ -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:
{

View file

@ -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.
}
}

View file

@ -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