diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 1c61504103..d380915633 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -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 diff --git a/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py b/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py index ef8a212b76..7136d8b93f 100644 --- a/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py +++ b/plugins/UM3NetworkPrinting/src/ConfigurationChangeModel.py @@ -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 \ No newline at end of file