mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 18:26:00 +08:00
Put override logic in Python instead of QML
Contributes to CL-1259
This commit is contained in:
parent
d70acc793f
commit
3cf2e19692
@ -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 = False if self._type_of_change in BLOCKING_CHANGE_TYPES else True
|
||||
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…
x
Reference in New Issue
Block a user