mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
Prevent auto selecting an invalid printer
CURA-6483
This commit is contained in:
parent
5b9c4e402e
commit
7d4c821551
2 changed files with 17 additions and 4 deletions
|
@ -76,15 +76,28 @@ Item
|
|||
|
||||
Component.onCompleted:
|
||||
{
|
||||
// Select the first one that's not "unknown" by default.
|
||||
var toSelectIndex = -1
|
||||
// Select the first one that's not "unknown" and is the host a group by default.
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
if (!model[i].isUnknownMachineType)
|
||||
if (!model[i].isUnknownMachineType && model[i].isHostOfGroup)
|
||||
{
|
||||
currentIndex = i
|
||||
toSelectIndex = i
|
||||
break
|
||||
}
|
||||
}
|
||||
currentIndex = toSelectIndex
|
||||
}
|
||||
|
||||
// CURA-6483 For some reason currentIndex can be reset to 0. This check is here to prevent automatically
|
||||
// selecting an unknown or non-host printer.
|
||||
onCurrentIndexChanged:
|
||||
{
|
||||
var item = model[currentIndex]
|
||||
if (!item || item.isUnknownMachineType || !item.isHostOfGroup)
|
||||
{
|
||||
currentIndex = -1
|
||||
}
|
||||
}
|
||||
|
||||
Component
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue