Check multiple settings per update of event loop

It seems that in Qt5, the update loop was triggered a lot more often than in qt6.
Since we used that to handle the error checking, this made it so that you sometimes had to wait
for quite some time untill the slicing would start (as that is blocked by the error checker)
This commit is contained in:
Jaime van Kessel 2022-04-19 17:00:06 +02:00
parent 965ecb744d
commit ffa0106937

View file

@ -53,6 +53,8 @@ class MachineErrorChecker(QObject):
self._keys_to_check = set() # type: Set[str] self._keys_to_check = set() # type: Set[str]
self._num_keys_to_check_per_update = 10
def initialize(self) -> None: def initialize(self) -> None:
self._error_check_timer.timeout.connect(self._rescheduleCheck) self._error_check_timer.timeout.connect(self._rescheduleCheck)
@ -162,6 +164,7 @@ class MachineErrorChecker(QObject):
self._check_in_progress = True self._check_in_progress = True
for i in range(self._num_keys_to_check_per_update):
# If there is nothing to check any more, it means there is no error. # If there is nothing to check any more, it means there is no error.
if not self._stacks_and_keys_to_check: if not self._stacks_and_keys_to_check:
# Finish # Finish
@ -173,8 +176,7 @@ class MachineErrorChecker(QObject):
enabled = stack.getProperty(key, "enabled") enabled = stack.getProperty(key, "enabled")
if not enabled: if not enabled:
self._application.callLater(self._checkStack) continue
return
validation_state = stack.getProperty(key, "validationState") validation_state = stack.getProperty(key, "validationState")
if validation_state is None: if validation_state is None:
@ -192,7 +194,7 @@ class MachineErrorChecker(QObject):
keys_to_recheck = {setting_key for stack, setting_key in self._stacks_and_keys_to_check} keys_to_recheck = {setting_key for stack, setting_key in self._stacks_and_keys_to_check}
keys_to_recheck.add(key) keys_to_recheck.add(key)
self._setResult(True, keys_to_recheck = keys_to_recheck) self._setResult(True, keys_to_recheck = keys_to_recheck)
return continue
# Schedule the check for the next key # Schedule the check for the next key
self._application.callLater(self._checkStack) self._application.callLater(self._checkStack)