mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Signals are now only emitted when setting changed instead of always.
This commit is contained in:
parent
6197a5b77a
commit
544941e33e
1 changed files with 17 additions and 11 deletions
|
@ -150,8 +150,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
@pyqtSlot(int)
|
@pyqtSlot(int)
|
||||||
def setTargetBedTemperature(self, temperature):
|
def setTargetBedTemperature(self, temperature):
|
||||||
self._setTargetBedTemperature(temperature)
|
self._setTargetBedTemperature(temperature)
|
||||||
self._target_bed_temperature = temperature
|
if self._target_bed_temperature != temperature:
|
||||||
self.targetBedTemperatureChanged.emit()
|
self._target_bed_temperature = temperature
|
||||||
|
self.targetBedTemperatureChanged.emit()
|
||||||
|
|
||||||
## Time the print has been printing.
|
## Time the print has been printing.
|
||||||
# Note that timeTotal - timeElapsed should give time remaining.
|
# Note that timeTotal - timeElapsed should give time remaining.
|
||||||
|
@ -212,8 +213,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# This simply sets the bed temperature, but ensures that a signal is emitted.
|
# This simply sets the bed temperature, but ensures that a signal is emitted.
|
||||||
# /param temperature temperature of the bed.
|
# /param temperature temperature of the bed.
|
||||||
def _setBedTemperature(self, temperature):
|
def _setBedTemperature(self, temperature):
|
||||||
self._bed_temperature = temperature
|
if self._bed_temperature != temperature:
|
||||||
self.bedTemperatureChanged.emit()
|
self._bed_temperature = temperature
|
||||||
|
self.bedTemperatureChanged.emit()
|
||||||
|
|
||||||
## Get the target bed temperature if connected printer (if any)
|
## Get the target bed temperature if connected printer (if any)
|
||||||
@pyqtProperty(int, notify = targetBedTemperatureChanged)
|
@pyqtProperty(int, notify = targetBedTemperatureChanged)
|
||||||
|
@ -228,8 +230,10 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
@pyqtSlot(int, int)
|
@pyqtSlot(int, int)
|
||||||
def setTargetHotendTemperature(self, index, temperature):
|
def setTargetHotendTemperature(self, index, temperature):
|
||||||
self._setTargetHotendTemperature(index, temperature)
|
self._setTargetHotendTemperature(index, temperature)
|
||||||
self._target_hotend_temperatures[index] = temperature
|
|
||||||
self.targetHotendTemperaturesChanged.emit()
|
if self._target_hotend_temperatures[index] != temperature:
|
||||||
|
self._target_hotend_temperatures[index] = temperature
|
||||||
|
self.targetHotendTemperaturesChanged.emit()
|
||||||
|
|
||||||
## Implementation function of setTargetHotendTemperature.
|
## Implementation function of setTargetHotendTemperature.
|
||||||
# /param index Index of the hotend to set the temperature of
|
# /param index Index of the hotend to set the temperature of
|
||||||
|
@ -251,8 +255,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# /param index Index of the hotend
|
# /param index Index of the hotend
|
||||||
# /param temperature temperature of the hotend (in deg C)
|
# /param temperature temperature of the hotend (in deg C)
|
||||||
def _setHotendTemperature(self, index, temperature):
|
def _setHotendTemperature(self, index, temperature):
|
||||||
self._hotend_temperatures[index] = temperature
|
if self._hotend_temperatures[index] != temperature:
|
||||||
self.hotendTemperaturesChanged.emit()
|
self._hotend_temperatures[index] = temperature
|
||||||
|
self.hotendTemperaturesChanged.emit()
|
||||||
|
|
||||||
@pyqtProperty("QVariantList", notify = materialIdChanged)
|
@pyqtProperty("QVariantList", notify = materialIdChanged)
|
||||||
def materialIds(self):
|
def materialIds(self):
|
||||||
|
@ -267,7 +272,6 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._material_ids[index] = material_id
|
self._material_ids[index] = material_id
|
||||||
self.materialIdChanged.emit(index, material_id)
|
self.materialIdChanged.emit(index, material_id)
|
||||||
|
|
||||||
|
|
||||||
@pyqtProperty("QVariantList", notify = hotendIdChanged)
|
@pyqtProperty("QVariantList", notify = hotendIdChanged)
|
||||||
def hotendIds(self):
|
def hotendIds(self):
|
||||||
return self._hotend_ids
|
return self._hotend_ids
|
||||||
|
@ -302,8 +306,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
## Set the connection state of this output device.
|
## Set the connection state of this output device.
|
||||||
# /param connection_state ConnectionState enum.
|
# /param connection_state ConnectionState enum.
|
||||||
def setConnectionState(self, connection_state):
|
def setConnectionState(self, connection_state):
|
||||||
self._connection_state = connection_state
|
if self._connection_state != connection_state:
|
||||||
self.connectionStateChanged.emit(self._id)
|
self._connection_state = connection_state
|
||||||
|
self.connectionStateChanged.emit(self._id)
|
||||||
|
|
||||||
@pyqtProperty(str, notify = connectionTextChanged)
|
@pyqtProperty(str, notify = connectionTextChanged)
|
||||||
def connectionText(self):
|
def connectionText(self):
|
||||||
|
@ -351,6 +356,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
if self._head_z != z:
|
if self._head_z != z:
|
||||||
self._head_z = z
|
self._head_z = z
|
||||||
position_changed = True
|
position_changed = True
|
||||||
|
|
||||||
if position_changed:
|
if position_changed:
|
||||||
self.headPositionChanged.emit()
|
self.headPositionChanged.emit()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue