mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
First run actions are now properly handled
CURA-1385
This commit is contained in:
parent
6f6d70ad0f
commit
8cfc0737ac
4 changed files with 43 additions and 5 deletions
|
@ -89,6 +89,7 @@ class MachineActionManager(QObject):
|
||||||
## Add a (unique) MachineAction
|
## Add a (unique) MachineAction
|
||||||
# if the Key of the action is not unique, an exception is raised.
|
# if the Key of the action is not unique, an exception is raised.
|
||||||
def addMachineAction(self, action):
|
def addMachineAction(self, action):
|
||||||
|
print("ADDING ACTIOONNN", action)
|
||||||
if action.getKey() not in self._machine_actions:
|
if action.getKey() not in self._machine_actions:
|
||||||
self._machine_actions[action.getKey()] = action
|
self._machine_actions[action.getKey()] = action
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -53,7 +53,7 @@ Cura.MachineAction
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
height: skipBedlevelingButton.height
|
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
|
Button
|
||||||
{
|
{
|
||||||
id: bedlevelingButton
|
id: bedlevelingButton
|
||||||
|
@ -69,10 +69,10 @@ Cura.MachineAction
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: skipBedlevelingButton
|
id: skipBedlevelingButton
|
||||||
anchors.top: parent.width < wizardPage.width ? parent.top : bedlevelingButton.bottom
|
anchors.top: parent.width < bedLevelMachineAction.width ? parent.top : bedlevelingButton.bottom
|
||||||
anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.getSize("default_margin").height/2
|
anchors.topMargin: parent.width < bedLevelMachineAction.width ? 0 : UM.Theme.getSize("default_margin").height/2
|
||||||
anchors.left: parent.width < wizardPage.width ? bedlevelingButton.right : parent.left
|
anchors.left: parent.width < bedLevelMachineAction.width ? bedlevelingButton.right : parent.left
|
||||||
anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.getSize("default_margin").width : 0
|
anchors.leftMargin: parent.width < bedLevelMachineAction.width ? UM.Theme.getSize("default_margin").width : 0
|
||||||
text: catalog.i18nc("@action:button","Skip bed leveling");
|
text: catalog.i18nc("@action:button","Skip bed leveling");
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@ UM.Dialog
|
||||||
title: catalog.i18nc("@title:window", "Add Printer")
|
title: catalog.i18nc("@title:window", "Add Printer")
|
||||||
property string activeManufacturer: "Ultimaker";
|
property string activeManufacturer: "Ultimaker";
|
||||||
|
|
||||||
|
signal machineAdded(string id)
|
||||||
function getMachineName()
|
function getMachineName()
|
||||||
{
|
{
|
||||||
var name = machineList.model.getItem(machineList.currentIndex).name
|
var name = machineList.model.getItem(machineList.currentIndex).name
|
||||||
|
@ -162,6 +163,7 @@ UM.Dialog
|
||||||
base.visible = false
|
base.visible = false
|
||||||
var item = machineList.model.getItem(machineList.currentIndex);
|
var item = machineList.model.getItem(machineList.currentIndex);
|
||||||
Cura.MachineManager.addMachine(machineName.text, item.id)
|
Cura.MachineManager.addMachine(machineName.text, item.id)
|
||||||
|
base.machineAdded(item.id) // Emit signal that the user added a machine.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -771,6 +771,41 @@ UM.MainWindow
|
||||||
AddMachineDialog
|
AddMachineDialog
|
||||||
{
|
{
|
||||||
id: 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
|
Connections
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue