From b100f65f5b12311a32f1dbaf29272d73a66a5fe7 Mon Sep 17 00:00:00 2001 From: Reid D McKenzie Date: Wed, 3 Aug 2022 10:10:50 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Fire=20action=20hooks=20on=20ALL=20?= =?UTF-8?q?actions,=20not=20just=20unhandled=20ones=20(#4591)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fire action hooks on ALL actions, not just unhandled ones * Add my name to the list Co-authored-by: Gina Häußge --- AUTHORS.md | 1 + src/octoprint/util/comm.py | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index e3c80cc1b..df96946b0 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -169,6 +169,7 @@ date of first contribution): * [Christian Bianchini](https://github.com/max246) * [Kestin Goforth](https://github.com/kforth) * [Dawid Pieper](https://github.com/dawidpieper) + * ["arrdem"](https://github.com/arrdem) OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by [Daid Braam](https://github.com/daid). Parts of its communication layer and diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index a41532c68..e14a112ce 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2404,25 +2404,25 @@ class MachineCom: level=logging.INFO, ) self.refreshSdFiles() - else: - for name, hook in self._printer_action_hooks.items(): - try: - hook( - self, - line, - action_command, - name=action_name, - params=action_params, - ) - except Exception: - self._logger.exception( - "Error while calling hook from plugin " - "{} with action command {}".format( - name, action_command - ), - extra={"plugin": name}, - ) - continue + + for name, hook in self._printer_action_hooks.items(): + try: + hook( + self, + line, + action_command, + name=action_name, + params=action_params, + ) + except Exception: + self._logger.exception( + "Error while calling hook from plugin " + "{} with action command {}".format( + name, action_command + ), + extra={"plugin": name}, + ) + continue if self._state not in ( self.STATE_CONNECTING,