mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 06:33:55 -06:00
CURA-4461 Read buildplate id from the printer and set the automatic
option
This commit is contained in:
parent
a2089c6afd
commit
de98a62dc8
3 changed files with 50 additions and 29 deletions
|
@ -36,6 +36,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._target_hotend_temperatures = [0] * self._num_extruders
|
self._target_hotend_temperatures = [0] * self._num_extruders
|
||||||
self._material_ids = [""] * self._num_extruders
|
self._material_ids = [""] * self._num_extruders
|
||||||
self._hotend_ids = [""] * self._num_extruders
|
self._hotend_ids = [""] * self._num_extruders
|
||||||
|
self._buildplate_id = ""
|
||||||
self._progress = 0
|
self._progress = 0
|
||||||
self._head_x = 0
|
self._head_x = 0
|
||||||
self._head_y = 0
|
self._head_y = 0
|
||||||
|
@ -99,6 +100,9 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# Signal to be emitted when either of the hotend ids is changed
|
# Signal to be emitted when either of the hotend ids is changed
|
||||||
hotendIdChanged = pyqtSignal(int, str, arguments = ["index", "id"])
|
hotendIdChanged = pyqtSignal(int, str, arguments = ["index", "id"])
|
||||||
|
|
||||||
|
# Signal to be emitted when the buildplate is changed
|
||||||
|
buildplateChanged = pyqtSignal()
|
||||||
|
|
||||||
# Signal that is emitted every time connection state is changed.
|
# Signal that is emitted every time connection state is changed.
|
||||||
# it also sends it's own device_id (for convenience sake)
|
# it also sends it's own device_id (for convenience sake)
|
||||||
connectionStateChanged = pyqtSignal(str)
|
connectionStateChanged = pyqtSignal(str)
|
||||||
|
@ -495,6 +499,22 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._hotend_ids[index] = None
|
self._hotend_ids[index] = None
|
||||||
self.hotendIdChanged.emit(index, None)
|
self.hotendIdChanged.emit(index, None)
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify = buildplateChanged)
|
||||||
|
def buildplateId(self):
|
||||||
|
return self._buildplate_id
|
||||||
|
|
||||||
|
## Protected setter for the current buildplate id.
|
||||||
|
# /param buildplate_id id of the buildplate
|
||||||
|
def _setBuildplateId(self, buildplate_id):
|
||||||
|
if buildplate_id and buildplate_id != self._buildplate_id:
|
||||||
|
Logger.log("d", "Setting buildplate id to %s." % (buildplate_id))
|
||||||
|
self._buildplate_id = buildplate_id
|
||||||
|
self.buildplateChanged.emit(buildplate_id)
|
||||||
|
elif not buildplate_id:
|
||||||
|
Logger.log("d", "Removing buildplate id.")
|
||||||
|
self._buildplate_id = None
|
||||||
|
self.buildplateChanged.emit(None)
|
||||||
|
|
||||||
## Let the user decide if the hotends and/or material should be synced with the printer
|
## Let the user decide if the hotends and/or material should be synced with the printer
|
||||||
# NB: the UX needs to be implemented by the plugin
|
# NB: the UX needs to be implemented by the plugin
|
||||||
def materialHotendChangedMessage(self, callback):
|
def materialHotendChangedMessage(self, callback):
|
||||||
|
|
|
@ -583,6 +583,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
hotend_id = ""
|
hotend_id = ""
|
||||||
self._setHotendId(index, hotend_id)
|
self._setHotendId(index, hotend_id)
|
||||||
|
|
||||||
|
# TODO Set the buildplate id depending on the info from the printer. To be discussed...
|
||||||
|
|
||||||
bed_temperatures = self._json_printer_state["bed"]["temperature"]
|
bed_temperatures = self._json_printer_state["bed"]["temperature"]
|
||||||
self._setBedTemperature(bed_temperatures["current"])
|
self._setBedTemperature(bed_temperatures["current"])
|
||||||
self._updateTargetBedTemperature(bed_temperatures["target"])
|
self._updateTargetBedTemperature(bed_temperatures["target"])
|
||||||
|
|
|
@ -12,7 +12,6 @@ Menu
|
||||||
id: menu
|
id: menu
|
||||||
title: "Build plate"
|
title: "Build plate"
|
||||||
|
|
||||||
property int extruderIndex: 0
|
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
||||||
property bool isClusterPrinter:
|
property bool isClusterPrinter:
|
||||||
{
|
{
|
||||||
|
@ -29,34 +28,34 @@ Menu
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MenuItem
|
MenuItem
|
||||||
// {
|
{
|
||||||
// id: automaticBuildplate
|
id: automaticBuildplate
|
||||||
// text:
|
text:
|
||||||
// {
|
{
|
||||||
// if(printerConnected && Cura.MachineManager.buildplateIds.length > buildplateIndex && !isClusterPrinter)
|
if(printerConnected && Cura.MachineManager.printerOutputDevices[0].buildplateId != "" && !isClusterPrinter)
|
||||||
// {
|
{
|
||||||
// var buildplateName = Cura.MachineManager.buildplateIds[buildplateIndex]
|
var buildplateName = Cura.MachineManager.printerOutputDevices[0].buildplateId
|
||||||
// return catalog.i18nc("@title:menuitem %1 is the buildplate currently loaded in the printer", "Automatic: %1").arg(buildplateName)
|
return catalog.i18nc("@title:menuitem %1 is the buildplate currently loaded in the printer", "Automatic: %1").arg(buildplateName)
|
||||||
// }
|
}
|
||||||
// return ""
|
return ""
|
||||||
// }
|
}
|
||||||
// visible: printerConnected && Cura.MachineManager.buildplateIds.length > buildplateIndex && !isClusterPrinter
|
visible: printerConnected && Cura.MachineManager.printerOutputDevices[0].buildplateId != "" && !isClusterPrinter
|
||||||
// onTriggered:
|
onTriggered:
|
||||||
// {
|
{
|
||||||
// var buildplateId = Cura.MachineManager.buildplateIds[buildplateIndex]
|
var buildplateId = Cura.MachineManager.printerOutputDevices[0].buildplateId
|
||||||
// var itemIndex = buildplateInstantiator.model.find("name", buildplateId);
|
var itemIndex = buildplateInstantiator.model.find("name", buildplateId)
|
||||||
// if(itemIndex > -1)
|
if(itemIndex > -1)
|
||||||
// {
|
{
|
||||||
// Cura.MachineManager.setActiveVariantBuildplate(buildplateInstantiator.model.getItem(itemIndex).id);
|
Cura.MachineManager.setActiveVariantBuildplate(buildplateInstantiator.model.getItem(itemIndex).id)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// MenuSeparator
|
MenuSeparator
|
||||||
// {
|
{
|
||||||
// visible: automaticBuildplate.visible
|
visible: automaticBuildplate.visible
|
||||||
// }
|
}
|
||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue