Merge branch 'feature_custom_gcode_commands'

This commit is contained in:
Ghostkeeper 2018-03-20 13:44:23 +01:00
commit f15eb4be2d
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
7 changed files with 142 additions and 6 deletions

View file

@ -64,6 +64,9 @@ class GenericOutputController(PrinterOutputController):
def homeBed(self, printer):
self._output_device.sendCommand("G28 Z")
def sendRawCommand(self, printer: "PrinterOutputModel", command: str):
self._output_device.sendCommand(command)
def setJobState(self, job: "PrintJobOutputModel", state: str):
if state == "pause":
self._output_device.pausePrint()

View file

@ -16,6 +16,7 @@ class PrinterOutputController:
self.can_abort = True
self.can_pre_heat_bed = True
self.can_pre_heat_hotends = True
self.can_send_raw_gcode = True
self.can_control_manually = True
self._output_device = output_device
@ -46,8 +47,11 @@ class PrinterOutputController:
def moveHead(self, printer: "PrinterOutputModel", x, y, z, speed):
Logger.log("w", "Move head not implemented in controller")
def homeBed(self, printer):
def homeBed(self, printer: "PrinterOutputModel"):
Logger.log("w", "Home bed not implemented in controller")
def homeHead(self, printer):
Logger.log("w", "Home head not implemented in controller")
def homeHead(self, printer: "PrinterOutputModel"):
Logger.log("w", "Home head not implemented in controller")
def sendRawCommand(self, printer: "PrinterOutputModel", command: str):
Logger.log("w", "Custom command not implemented in controller")

View file

@ -110,6 +110,10 @@ class PrinterOutputModel(QObject):
def homeBed(self):
self._controller.homeBed(self)
@pyqtSlot(str)
def sendRawCommand(self, command: str):
self._controller.sendRawCommand(self, command)
@pyqtProperty("QVariantList", constant = True)
def extruders(self):
return self._extruders
@ -245,6 +249,13 @@ class PrinterOutputModel(QObject):
return self._controller.can_pre_heat_hotends
return False
# Does the printer support sending raw G-code at all
@pyqtProperty(bool, constant=True)
def canSendRawGcode(self):
if self._controller:
return self._controller.can_send_raw_gcode
return False
# Does the printer support pause at all
@pyqtProperty(bool, constant=True)
def canPause(self):