mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Merge pull request #2334 from fieldOfView/feature_target_hotend_temperature
Show target hotend temperatures
This commit is contained in:
commit
7c637029b6
2 changed files with 53 additions and 8 deletions
|
@ -313,6 +313,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self.targetBedTemperatureChanged.emit()
|
self.targetBedTemperatureChanged.emit()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
## Updates the target hotend temperature from the printer, and emit a signal if it was changed.
|
||||||
|
#
|
||||||
|
# /param index The index of the hotend.
|
||||||
|
# /param temperature The new target temperature of the hotend.
|
||||||
|
# /return boolean, True if the temperature was changed, false if the new temperature has the same value as the already stored temperature
|
||||||
|
def _updateTargetHotendTemperature(self, index, temperature):
|
||||||
|
if self._target_hotend_temperatures[index] == temperature:
|
||||||
|
return False
|
||||||
|
self._target_hotend_temperatures[index] = temperature
|
||||||
|
self.targetHotendTemperaturesChanged.emit()
|
||||||
|
return True
|
||||||
|
|
||||||
def _stopCamera(self):
|
def _stopCamera(self):
|
||||||
if self._camera_timer.isActive():
|
if self._camera_timer.isActive():
|
||||||
self._camera_timer.stop()
|
self._camera_timer.stop()
|
||||||
|
@ -535,8 +547,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
def _spliceJSONData(self):
|
def _spliceJSONData(self):
|
||||||
# Check for hotend temperatures
|
# Check for hotend temperatures
|
||||||
for index in range(0, self._num_extruders):
|
for index in range(0, self._num_extruders):
|
||||||
temperature = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]["current"]
|
temperatures = self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["temperature"]
|
||||||
self._setHotendTemperature(index, temperature)
|
self._setHotendTemperature(index, temperatures["current"])
|
||||||
|
self._updateTargetHotendTemperature(index, temperatures["target"])
|
||||||
try:
|
try:
|
||||||
material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"]
|
material_id = self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -548,10 +561,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
hotend_id = ""
|
hotend_id = ""
|
||||||
self._setHotendId(index, hotend_id)
|
self._setHotendId(index, hotend_id)
|
||||||
|
|
||||||
bed_temperature = self._json_printer_state["bed"]["temperature"]["current"]
|
bed_temperatures = self._json_printer_state["bed"]["temperature"]
|
||||||
self._setBedTemperature(bed_temperature)
|
self._setBedTemperature(bed_temperatures["current"])
|
||||||
target_bed_temperature = self._json_printer_state["bed"]["temperature"]["target"]
|
self._updateTargetBedTemperature(bed_temperatures["target"])
|
||||||
self._updateTargetBedTemperature(target_bed_temperature)
|
|
||||||
|
|
||||||
head_x = self._json_printer_state["heads"][0]["position"]["x"]
|
head_x = self._json_printer_state["heads"][0]["position"]["x"]
|
||||||
head_y = self._json_printer_state["heads"][0]["position"]["y"]
|
head_y = self._json_printer_state["heads"][0]["position"]["y"]
|
||||||
|
|
|
@ -94,13 +94,46 @@ Column
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text //Target temperature.
|
||||||
|
{
|
||||||
|
id: extruderTargetTemperature
|
||||||
|
text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.targetHotendTemperatures[index] != null) ? Math.round(connectedPrinter.targetHotendTemperatures[index]) + "°C" : ""
|
||||||
|
font: UM.Theme.getFont("small")
|
||||||
|
color: UM.Theme.getColor("text_inactive")
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
anchors.bottom: extruderTemperature.bottom
|
||||||
|
|
||||||
|
MouseArea //For tooltip.
|
||||||
|
{
|
||||||
|
id: extruderTargetTemperatureTooltipArea
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
onHoveredChanged:
|
||||||
|
{
|
||||||
|
if (containsMouse)
|
||||||
|
{
|
||||||
|
base.showTooltip(
|
||||||
|
base,
|
||||||
|
{x: 0, y: extruderTargetTemperature.mapToItem(base, 0, -parent.height / 4).y},
|
||||||
|
catalog.i18nc("@tooltip", "The target temperature of the hotend. The hotend will heat up or cool down towards this temperature. If this is 0, the hotend heating is turned off.")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.hideTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Text //Temperature indication.
|
Text //Temperature indication.
|
||||||
{
|
{
|
||||||
id: extruderTemperature
|
id: extruderTemperature
|
||||||
text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.hotendTemperatures[index] != null) ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : ""
|
text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.hotendTemperatures[index] != null) ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : ""
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("large")
|
||||||
anchors.right: parent.right
|
anchors.right: extruderTargetTemperature.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
@ -116,7 +149,7 @@ Column
|
||||||
base.showTooltip(
|
base.showTooltip(
|
||||||
base,
|
base,
|
||||||
{x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y},
|
{x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y},
|
||||||
catalog.i18nc("@tooltip", "The current temperature of this extruder.")
|
catalog.i18nc("@tooltip", "The current temperature of this hotend.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue