mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Merge pull request #5762 from Ultimaker/CL-1259_hide_useless_override_button
CL-1259 hide useless override button
This commit is contained in:
commit
0dc49a66f1
2 changed files with 18 additions and 4 deletions
|
@ -32,18 +32,23 @@ UM.Dialog
|
|||
}
|
||||
visible:
|
||||
{
|
||||
// Don't show the button if we're missing a printer or print job
|
||||
if (!printer || !printer.activePrintJob)
|
||||
{
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
var canOverride = false
|
||||
// Check each required change...
|
||||
for (var i = 0; i < printer.activePrintJob.configurationChanges.length; i++)
|
||||
{
|
||||
var change = printer.activePrintJob.configurationChanges[i]
|
||||
canOverride = canOverride || change.typeOfChange === "material_change";
|
||||
// If that type of change is in the list of blocking changes, hide the button
|
||||
if (!change.canOverride)
|
||||
{
|
||||
return false
|
||||
}
|
||||
return canOverride
|
||||
}
|
||||
return true
|
||||
}
|
||||
},
|
||||
Button
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
|
||||
|
||||
BLOCKING_CHANGE_TYPES = [
|
||||
"material_insert", "buildplate_change"
|
||||
]
|
||||
|
||||
class ConfigurationChangeModel(QObject):
|
||||
def __init__(self, type_of_change: str, index: int, target_name: str, origin_name: str) -> None:
|
||||
super().__init__()
|
||||
self._type_of_change = type_of_change
|
||||
# enum = ["material", "print_core_change"]
|
||||
self._can_override = self._type_of_change not in BLOCKING_CHANGE_TYPES
|
||||
self._index = index
|
||||
self._target_name = target_name
|
||||
self._origin_name = origin_name
|
||||
|
@ -27,3 +32,7 @@ class ConfigurationChangeModel(QObject):
|
|||
@pyqtProperty(str, constant = True)
|
||||
def originName(self) -> str:
|
||||
return self._origin_name
|
||||
|
||||
@pyqtProperty(bool, constant = True)
|
||||
def canOverride(self) -> bool:
|
||||
return self._can_override
|
Loading…
Add table
Add a link
Reference in a new issue