Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfieldOfView <aldo@fieldofview.com>2016-07-04 12:49:27 +0300
committerfieldOfView <aldo@fieldofview.com>2016-07-04 12:49:27 +0300
commita1a751831708804d3e94fbb6824be9749f84d3a2 (patch)
tree62004600ae8c30c46ca1a6aefa1a04324708cad9 /cura/PrinterOutputDevice.py
parent0c23c26ac91b7bcdccfa7525686e8317bcaa14f9 (diff)
Switch materials/nozzle when the printer signals a material/nozzle change
CURA-491
Diffstat (limited to 'cura/PrinterOutputDevice.py')
-rw-r--r--cura/PrinterOutputDevice.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py
index 7f6e51e1fd..6504de9cdd 100644
--- a/cura/PrinterOutputDevice.py
+++ b/cura/PrinterOutputDevice.py
@@ -24,6 +24,8 @@ class PrinterOutputDevice(QObject, OutputDevice):
self._num_extruders = 1
self._hotend_temperatures = [0] * self._num_extruders
self._target_hotend_temperatures = [0] * self._num_extruders
+ self._material_ids = [""] * self._num_extruders
+ self._hotend_ids = [""] * self._num_extruders
self._progress = 0
self._head_x = 0
self._head_y = 0
@@ -57,6 +59,12 @@ class PrinterOutputDevice(QObject, OutputDevice):
# Signal to be emitted when head position is changed (x,y,z)
headPositionChanged = pyqtSignal()
+ # Signal to be emitted when either of the material ids is changed
+ MaterialIdChanged = pyqtSignal(int, str, arguments = ["index", "id"])
+
+ # Signal to be emitted when either of the hotend ids is changed
+ HotendIdChanged = pyqtSignal(int, str, arguments = ["index", "id"])
+
# Signal that is emitted every time connection state is changed.
# it also sends it's own device_id (for convenience sake)
connectionStateChanged = pyqtSignal(str)
@@ -212,6 +220,34 @@ class PrinterOutputDevice(QObject, OutputDevice):
self._hotend_temperatures[index] = temperature
self.hotendTemperaturesChanged.emit()
+ @pyqtProperty("QVariantList", notify = MaterialIdChanged)
+ def materialIds(self):
+ return self._material_ids
+
+ ## Protected setter for the current material id.
+ # /param index Index of the extruder
+ # /param material_id id of the material
+ def _setMaterialId(self, index, material_id):
+ if material_id and material_id != "" and material_id != self._material_ids[index]:
+ Logger.log("d", "Setting material id of hotend %d to %s" % (index, material_id))
+ self._material_ids[index] = material_id
+ self.MaterialIdChanged.emit(index, material_id)
+
+
+ @pyqtProperty("QVariantList", notify = HotendIdChanged)
+ def hotendIds(self):
+ return self._hotend_ids
+
+ ## Protected setter for the current hotend id.
+ # /param index Index of the extruder
+ # /param hotend_id id of the hotend
+ def _setHotendId(self, index, hotend_id):
+ if hotend_id and hotend_id != "" and hotend_id != self._hotend_ids[index]:
+ Logger.log("d", "Setting hotend id of hotend %d to %s" % (index, hotend_id))
+ self._hotend_ids[index] = hotend_id
+ self.HotendIdChanged.emit(index, hotend_id)
+
+
## Attempt to establish connection
def connect(self):
raise NotImplementedError("connect needs to be implemented")