diff options
author | Jaime van Kessel <nallath@gmail.com> | 2019-02-21 23:09:49 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2019-02-21 23:09:49 +0300 |
commit | 198ea3c74ff42d5430acd7e54eba114e972313e4 (patch) | |
tree | b5cf80bc003bdf615ca302b70e3b0e06ee7d29e3 /plugins | |
parent | 41f2a0e22217bb4d98df6fbf95f4355938427e75 (diff) |
Ensure the model checker doesn't update a gazillion times on multiply
CURA-6237
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ModelChecker/ModelChecker.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/ModelChecker/ModelChecker.py b/plugins/ModelChecker/ModelChecker.py index 1913f39d96..0619c95d67 100644 --- a/plugins/ModelChecker/ModelChecker.py +++ b/plugins/ModelChecker/ModelChecker.py @@ -3,7 +3,7 @@ import os -from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal, pyqtProperty +from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal, pyqtProperty, QTimer from UM.Application import Application from UM.Extension import Extension @@ -30,18 +30,22 @@ class ModelChecker(QObject, Extension): lifetime = 0, title = catalog.i18nc("@info:title", "3D Model Assistant")) + self._change_timer = QTimer() + self._change_timer.setInterval(200) + self._change_timer.setSingleShot(True) + self._change_timer.timeout.connect(self.onChanged) + Application.getInstance().initializationFinished.connect(self._pluginsInitialized) Application.getInstance().getController().getScene().sceneChanged.connect(self._onChanged) Application.getInstance().globalContainerStackChanged.connect(self._onChanged) - ## Pass-through to allow UM.Signal to connect with a pyqtSignal. def _onChanged(self, *args, **kwargs): # Ignore camera updates. if len(args) == 0: - self.onChanged.emit() + self._change_timer.start() return if not isinstance(args[0], Camera): - self.onChanged.emit() + self._change_timer.start() ## Called when plug-ins are initialized. # |