mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-06 00:06:03 +08:00
Handle deleting profiles better
When deleting profiles, the current item is set to null. The Activate button was checking if the current profile was already active, and disabling the button if it was. But the button was still enabled if the current item is null because isCurrentItemActivated is only true if there is a current item. So to properly disable the button we need to check also if there is a current item. The onItemsChanged signal can also trigger if the item that matches the toSelectItemName has no quality_changes_group, i.e. a built-in profile. Probably fixes Sentry issue CURA-43.
This commit is contained in:
parent
58369822fc
commit
1f9b4c3964
@ -83,10 +83,10 @@ Item
|
||||
id: activateMenuButton
|
||||
text: catalog.i18nc("@action:button", "Activate")
|
||||
iconName: "list-activate"
|
||||
enabled: !isCurrentItemActivated
|
||||
enabled: !isCurrentItemActivated && base.currentItem
|
||||
onClicked:
|
||||
{
|
||||
if (base.currentItem.is_read_only)
|
||||
if(base.currentItem.is_read_only)
|
||||
{
|
||||
Cura.IntentManager.selectIntent(base.currentItem.intent_category, base.currentItem.quality_type);
|
||||
}
|
||||
@ -232,14 +232,17 @@ Item
|
||||
for (var idx = 0; idx < base.qualityManagementModel.count; ++idx)
|
||||
{
|
||||
var item = base.qualityManagementModel.getItem(idx);
|
||||
if (item.name == toSelectItemName)
|
||||
if (item && item.name == toSelectItemName)
|
||||
{
|
||||
// Switch to the newly created profile if needed
|
||||
newIdx = idx;
|
||||
if (base.toActivateNewQuality)
|
||||
{
|
||||
// Activate this custom quality if required
|
||||
Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group);
|
||||
if(item.quality_changes_group)
|
||||
{
|
||||
Cura.MachineManager.setQualityChangesGroup(item.quality_changes_group);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user