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.
This commit is contained in:
1 parent
69bea0f5b0
commit
23bc6b8df7
1 file changed
+3
-3
@@ -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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user