diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d973b6..8ffb9f61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Version 3 +### 3.8.2 + +- Fixed a bug: the popover on upcoming relay switch could not appear in some cases. + - In case a postponed switch is configured for PRINTING_STARTED or PRINTING_STOPPED event, but no switch is + configured to happen immediately, the UI did not have an update. + - Thanks to [@backupartist](https://github.com/backupartist) for reporting and elaborating to fix this issue. + ### 3.8.1 - A couple fixes for the upcoming switch popover: diff --git a/octoprint_octorelay/__init__.py b/octoprint_octorelay/__init__.py index 7c22f9f2..f68f559b 100755 --- a/octoprint_octorelay/__init__.py +++ b/octoprint_octorelay/__init__.py @@ -202,6 +202,7 @@ def handle_plugin_event(self, event, scope = RELAY_INDEXES): self.tasks.append(task) task.timer.start() self._logger.debug(f"The task registered: {task}") + self.update_ui() # issue 190 def toggle_relay(self, index, target: Optional[bool] = None): settings = self._settings.get([index], merged=True) # expensive diff --git a/tests/test_init.py b/tests/test_init.py index 344020e3..4c0f503f 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -626,6 +626,7 @@ def test_handle_plugin_event(self): { "event": "STARTUP", "state": False, "expectedCall": True, "delay": 0 }, ] for case in cases: + self.plugin_instance.update_ui = Mock() self.plugin_instance.cancel_tasks = Mock() self.plugin_instance.tasks = [] utilMock.ResettableTimer.reset_mock() @@ -652,6 +653,7 @@ def test_handle_plugin_event(self): case["delay"], self.plugin_instance.toggle_relay, ["r8", case["state"]] ) timerMock.start.assert_called_with() + self.plugin_instance.update_ui.assert_called_with() # issue 190 self.assertEqual(len(self.plugin_instance.tasks), 8) for index in range(0,8): self.assertIsInstance(self.plugin_instance.tasks[index], Task) @@ -664,6 +666,7 @@ def test_handle_plugin_event(self): utilMock.ResettableTimer.assert_not_called() timerMock.start.assert_not_called() self.plugin_instance.toggle_relay.assert_not_called() + self.plugin_instance.update_ui.assert_not_called() def test_cancel_tasks(self): # Should remove the tasks for the certain relay and cancel its timer