From 23bc6b8df7c82a736716dc0aaf9713537fc1ee38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 10 Nov 2014 13:11:46 +0100 Subject: [PATCH] Added keywords arguments to pause_print to disable toggle and only resume or pause If the printer is paused and the method is called with only_pause=True, nothing will happen. If the printer is printing and the method is called with only_resume=True, nothing will happen. --- src/octoprint/comm/protocol/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/octoprint/comm/protocol/__init__.py b/src/octoprint/comm/protocol/__init__.py index ee47b5db0..926aeb80a 100644 --- a/src/octoprint/comm/protocol/__init__.py +++ b/src/octoprint/comm/protocol/__init__.py @@ -96,18 +96,18 @@ class Protocol(MessageReceiver, StateReceiver, LogReceiver): "origin": self._current_file.getFileLocation() }) - def pause_print(self): + def pause_print(self, only_pause=None, only_resume=None): payload = { "file": self._current_file.getFilename(), "filename": os.path.basename(self._current_file.getFilename()), "origin": self._current_file.getFileLocation() } - if self._state == State.PRINTING: + if self._state == State.PRINTING and not only_resume: self._changeState(State.PAUSED) eventManager().fire(Events.PRINT_PAUSED, payload) - elif self._state == State.PAUSED: + elif self._state == State.PAUSED and not only_pause: self._changeState(State.PRINTING) eventManager().fire(Events.PRINT_RESUMED, payload)