@@ -393,9 +393,26 @@ def __init__(self, parent, printer, *args, **kwargs):
393393 self .ZMButton .clicked .connect (self .moveZM )
394394 controls_move .addWidget (self .ZMButton )
395395
396+ controls_job = QHBoxLayout ()
397+ box .addLayout (controls_job , 0 )
398+
399+ self .PauseButton = QPushButton ("Pause/Resume" )
400+ self .PauseButton .clicked .connect (self .pauseResume )
401+ controls_job .addWidget (self .PauseButton )
402+
403+ self .CancelButton = QPushButton ("Cancel Job" )
404+ self .CancelButton .clicked .connect (self .cancelJob )
405+ controls_job .addWidget (self .CancelButton )
406+
396407 self .loadImage ()
397408 self .loadStatus ()
398409
410+ def pauseResume (self ):
411+ self .parent .printerPauseResume (self .printer )
412+
413+ def cancelJob (self ):
414+ self .parent .printerJobCancel (self .printer )
415+
399416 def moveXP (self ):
400417 self .parent .printerMoveAction (self .printer , "x" , int (self .parent .jogMoveLength ), True )
401418
@@ -1041,6 +1058,20 @@ def printerMoveAction(self, printer, axis, dist, relative = True):
10411058
10421059 self .sendPostRequest (printer [0 ], printer [1 ], "printer/printhead" , '{ "command": "jog", "' + str (axis ) + '": ' + str (dist ) + ', "speed": ' + str (self .jogMoveSpeed ) + absolute + ' }' )
10431060
1061+ def printerPauseResume (self , printer ):
1062+ state = self .getState (printer [0 ], printer [1 ])
1063+ if state in self .statesWithWarning :
1064+ if self .showDialog ("OctoTray Warning" , "The printer seems to be running currently!" , "Do you really want to pause/resume?" , True , True ) == False :
1065+ return
1066+ self .sendPostRequest (printer [0 ], printer [1 ], "job" , '{ "command": "pause", "action": "toggle" }' )
1067+
1068+ def printerJobCancel (self , printer ):
1069+ state = self .getState (printer [0 ], printer [1 ])
1070+ if state in self .statesWithWarning :
1071+ if self .showDialog ("OctoTray Warning" , "The printer seems to be running currently!" , "Do you really want to cancel?" , True , True ) == False :
1072+ return
1073+ self .sendPostRequest (printer [0 ], printer [1 ], "job" , '{ "command": "cancel" }' )
1074+
10441075 def printerWebAction (self , item ):
10451076 self .openBrowser (item [0 ])
10461077
0 commit comments