mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Make sure a machine is always selected on the Printers page
CURA-2085
This commit is contained in:
parent
fcfcfa37fb
commit
c60ddbecfb
1 changed files with 23 additions and 9 deletions
|
|
@ -18,7 +18,10 @@ UM.ManagementPage
|
||||||
}
|
}
|
||||||
|
|
||||||
activeId: Cura.MachineManager.activeMachineId
|
activeId: Cura.MachineManager.activeMachineId
|
||||||
activeIndex: {
|
activeIndex: activeMachineIndex()
|
||||||
|
|
||||||
|
function activeMachineIndex()
|
||||||
|
{
|
||||||
for(var i = 0; i < model.rowCount(); i++) {
|
for(var i = 0; i < model.rowCount(); i++) {
|
||||||
if (model.getItem(i).id == Cura.MachineManager.activeMachineId) {
|
if (model.getItem(i).id == Cura.MachineManager.activeMachineId) {
|
||||||
return i;
|
return i;
|
||||||
|
|
@ -145,10 +148,12 @@ UM.ManagementPage
|
||||||
onYes:
|
onYes:
|
||||||
{
|
{
|
||||||
Cura.MachineManager.removeMachine(base.currentItem.id);
|
Cura.MachineManager.removeMachine(base.currentItem.id);
|
||||||
//Reselect current item to update details panel
|
if(!base.currentItem)
|
||||||
var index = objectList.currentIndex
|
{
|
||||||
objectList.currentIndex = -1
|
objectList.currentIndex = activeMachineIndex()
|
||||||
objectList.currentIndex = index
|
}
|
||||||
|
//Force updating currentItem and the details panel
|
||||||
|
objectList.onCurrentIndexChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,11 +164,20 @@ UM.ManagementPage
|
||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim());
|
Cura.MachineManager.renameMachine(base.currentItem.id, newName.trim());
|
||||||
//Reselect current item to update details panel
|
//Force updating currentItem and the details panel
|
||||||
var index = objectList.currentIndex
|
objectList.onCurrentIndexChanged()
|
||||||
objectList.currentIndex = -1
|
|
||||||
objectList.currentIndex = index
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: Cura.MachineManager
|
||||||
|
onGlobalContainerChanged:
|
||||||
|
{
|
||||||
|
objectList.currentIndex = activeMachineIndex()
|
||||||
|
objectList.onCurrentIndexChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue