mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Fix merge conflicts, add can_send_raw_gcode ability, rename to sendRawCommand, small fixes
This commit is contained in:
commit
d4d9a58d04
13 changed files with 602 additions and 139 deletions
|
@ -18,6 +18,7 @@ class ExtruderOutputModel(QObject):
|
||||||
hotendTemperatureChanged = pyqtSignal()
|
hotendTemperatureChanged = pyqtSignal()
|
||||||
activeMaterialChanged = pyqtSignal()
|
activeMaterialChanged = pyqtSignal()
|
||||||
extruderConfigurationChanged = pyqtSignal()
|
extruderConfigurationChanged = pyqtSignal()
|
||||||
|
isPreheatingChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, printer: "PrinterOutputModel", position, parent=None):
|
def __init__(self, printer: "PrinterOutputModel", position, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -30,6 +31,21 @@ class ExtruderOutputModel(QObject):
|
||||||
self._extruder_configuration = ExtruderConfigurationModel()
|
self._extruder_configuration = ExtruderConfigurationModel()
|
||||||
self._extruder_configuration.position = self._position
|
self._extruder_configuration.position = self._position
|
||||||
|
|
||||||
|
self._is_preheating = False
|
||||||
|
|
||||||
|
def getPrinter(self):
|
||||||
|
return self._printer
|
||||||
|
|
||||||
|
def getPosition(self):
|
||||||
|
return self._position
|
||||||
|
|
||||||
|
# Does the printer support pre-heating the bed at all
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def canPreHeatHotends(self):
|
||||||
|
if self._printer:
|
||||||
|
return self._printer.canPreHeatHotends
|
||||||
|
return False
|
||||||
|
|
||||||
@pyqtProperty(QObject, notify = activeMaterialChanged)
|
@pyqtProperty(QObject, notify = activeMaterialChanged)
|
||||||
def activeMaterial(self) -> "MaterialOutputModel":
|
def activeMaterial(self) -> "MaterialOutputModel":
|
||||||
return self._active_material
|
return self._active_material
|
||||||
|
@ -82,3 +98,25 @@ class ExtruderOutputModel(QObject):
|
||||||
if self._extruder_configuration.isValid():
|
if self._extruder_configuration.isValid():
|
||||||
return self._extruder_configuration
|
return self._extruder_configuration
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def updateIsPreheating(self, pre_heating):
|
||||||
|
if self._is_preheating != pre_heating:
|
||||||
|
self._is_preheating = pre_heating
|
||||||
|
self.isPreheatingChanged.emit()
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify=isPreheatingChanged)
|
||||||
|
def isPreheating(self):
|
||||||
|
return self._is_preheating
|
||||||
|
|
||||||
|
## Pre-heats the extruder before printer.
|
||||||
|
#
|
||||||
|
# \param temperature The temperature to heat the extruder to, in degrees
|
||||||
|
# Celsius.
|
||||||
|
# \param duration How long the bed should stay warm, in seconds.
|
||||||
|
@pyqtSlot(float, float)
|
||||||
|
def preheatHotend(self, temperature, duration):
|
||||||
|
self._printer._controller.preheatHotend(self, temperature, duration)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def cancelPreheatHotend(self):
|
||||||
|
self._printer._controller.cancelPreheatHotend(self)
|
154
cura/PrinterOutput/GenericOutputController.py
Normal file
154
cura/PrinterOutput/GenericOutputController.py
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
|
||||||
|
from PyQt5.QtCore import QTimer
|
||||||
|
|
||||||
|
MYPY = False
|
||||||
|
if MYPY:
|
||||||
|
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
||||||
|
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
||||||
|
|
||||||
|
|
||||||
|
class GenericOutputController(PrinterOutputController):
|
||||||
|
def __init__(self, output_device):
|
||||||
|
super().__init__(output_device)
|
||||||
|
|
||||||
|
self._preheat_bed_timer = QTimer()
|
||||||
|
self._preheat_bed_timer.setSingleShot(True)
|
||||||
|
self._preheat_bed_timer.timeout.connect(self._onPreheatBedTimerFinished)
|
||||||
|
self._preheat_printer = None
|
||||||
|
|
||||||
|
self._preheat_hotends_timer = QTimer()
|
||||||
|
self._preheat_hotends_timer.setSingleShot(True)
|
||||||
|
self._preheat_hotends_timer.timeout.connect(self._onPreheatHotendsTimerFinished)
|
||||||
|
self._preheat_hotends = set()
|
||||||
|
|
||||||
|
self._output_device.printersChanged.connect(self._onPrintersChanged)
|
||||||
|
self._active_printer = None
|
||||||
|
|
||||||
|
def _onPrintersChanged(self):
|
||||||
|
if self._active_printer:
|
||||||
|
self._active_printer.stateChanged.disconnect(self._onPrinterStateChanged)
|
||||||
|
self._active_printer.targetBedTemperatureChanged.disconnect(self._onTargetBedTemperatureChanged)
|
||||||
|
for extruder in self._active_printer.extruders:
|
||||||
|
extruder.targetHotendTemperatureChanged.disconnect(self._onTargetHotendTemperatureChanged)
|
||||||
|
|
||||||
|
self._active_printer = self._output_device.activePrinter
|
||||||
|
if self._active_printer:
|
||||||
|
self._active_printer.stateChanged.connect(self._onPrinterStateChanged)
|
||||||
|
self._active_printer.targetBedTemperatureChanged.connect(self._onTargetBedTemperatureChanged)
|
||||||
|
for extruder in self._active_printer.extruders:
|
||||||
|
extruder.targetHotendTemperatureChanged.connect(self._onTargetHotendTemperatureChanged)
|
||||||
|
|
||||||
|
def _onPrinterStateChanged(self):
|
||||||
|
if self._active_printer.state != "idle":
|
||||||
|
if self._preheat_bed_timer.isActive():
|
||||||
|
self._preheat_bed_timer.stop()
|
||||||
|
self._preheat_printer.updateIsPreheating(False)
|
||||||
|
if self._preheat_hotends_timer.isActive():
|
||||||
|
self._preheat_hotends_timer.stop()
|
||||||
|
for extruder in self._preheat_hotends:
|
||||||
|
extruder.updateIsPreheating(False)
|
||||||
|
self._preheat_hotends = set()
|
||||||
|
|
||||||
|
def moveHead(self, printer: "PrinterOutputModel", x, y, z, speed):
|
||||||
|
self._output_device.sendCommand("G91")
|
||||||
|
self._output_device.sendCommand("G0 X%s Y%s Z%s F%s" % (x, y, z, speed))
|
||||||
|
self._output_device.sendCommand("G90")
|
||||||
|
|
||||||
|
def homeHead(self, printer):
|
||||||
|
self._output_device.sendCommand("G28 X")
|
||||||
|
self._output_device.sendCommand("G28 Y")
|
||||||
|
|
||||||
|
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()
|
||||||
|
job.updateState("paused")
|
||||||
|
elif state == "print":
|
||||||
|
self._output_device.resumePrint()
|
||||||
|
job.updateState("printing")
|
||||||
|
elif state == "abort":
|
||||||
|
self._output_device.cancelPrint()
|
||||||
|
pass
|
||||||
|
|
||||||
|
def setTargetBedTemperature(self, printer: "PrinterOutputModel", temperature: int):
|
||||||
|
self._output_device.sendCommand("M140 S%s" % temperature)
|
||||||
|
|
||||||
|
def _onTargetBedTemperatureChanged(self):
|
||||||
|
if self._preheat_bed_timer.isActive() and self._preheat_printer.targetBedTemperature == 0:
|
||||||
|
self._preheat_bed_timer.stop()
|
||||||
|
self._preheat_printer.updateIsPreheating(False)
|
||||||
|
|
||||||
|
def preheatBed(self, printer: "PrinterOutputModel", temperature, duration):
|
||||||
|
try:
|
||||||
|
temperature = round(temperature) # The API doesn't allow floating point.
|
||||||
|
duration = round(duration)
|
||||||
|
except ValueError:
|
||||||
|
return # Got invalid values, can't pre-heat.
|
||||||
|
|
||||||
|
self.setTargetBedTemperature(printer, temperature=temperature)
|
||||||
|
self._preheat_bed_timer.setInterval(duration * 1000)
|
||||||
|
self._preheat_bed_timer.start()
|
||||||
|
self._preheat_printer = printer
|
||||||
|
printer.updateIsPreheating(True)
|
||||||
|
|
||||||
|
def cancelPreheatBed(self, printer: "PrinterOutputModel"):
|
||||||
|
self.setTargetBedTemperature(printer, temperature=0)
|
||||||
|
self._preheat_bed_timer.stop()
|
||||||
|
printer.updateIsPreheating(False)
|
||||||
|
|
||||||
|
def _onPreheatBedTimerFinished(self):
|
||||||
|
self.setTargetBedTemperature(self._preheat_printer, 0)
|
||||||
|
self._preheat_printer.updateIsPreheating(False)
|
||||||
|
|
||||||
|
def setTargetHotendTemperature(self, printer: "PrinterOutputModel", position: int, temperature: int):
|
||||||
|
self._output_device.sendCommand("M104 S%s T%s" % (temperature, position))
|
||||||
|
|
||||||
|
def _onTargetHotendTemperatureChanged(self):
|
||||||
|
if not self._preheat_hotends_timer.isActive():
|
||||||
|
return
|
||||||
|
|
||||||
|
for extruder in self._active_printer.extruders:
|
||||||
|
if extruder in self._preheat_hotends and extruder.targetHotendTemperature == 0:
|
||||||
|
extruder.updateIsPreheating(False)
|
||||||
|
self._preheat_hotends.remove(extruder)
|
||||||
|
if not self._preheat_hotends:
|
||||||
|
self._preheat_hotends_timer.stop()
|
||||||
|
|
||||||
|
def preheatHotend(self, extruder: "ExtruderOutputModel", temperature, duration):
|
||||||
|
position = extruder.getPosition()
|
||||||
|
number_of_extruders = len(extruder.getPrinter().extruders)
|
||||||
|
if position >= number_of_extruders:
|
||||||
|
return # Got invalid extruder nr, can't pre-heat.
|
||||||
|
|
||||||
|
try:
|
||||||
|
temperature = round(temperature) # The API doesn't allow floating point.
|
||||||
|
duration = round(duration)
|
||||||
|
except ValueError:
|
||||||
|
return # Got invalid values, can't pre-heat.
|
||||||
|
|
||||||
|
self.setTargetHotendTemperature(extruder.getPrinter(), position, temperature=temperature)
|
||||||
|
self._preheat_hotends_timer.setInterval(duration * 1000)
|
||||||
|
self._preheat_hotends_timer.start()
|
||||||
|
self._preheat_hotends.add(extruder)
|
||||||
|
extruder.updateIsPreheating(True)
|
||||||
|
|
||||||
|
def cancelPreheatHotend(self, extruder: "ExtruderOutputModel"):
|
||||||
|
self.setTargetHotendTemperature(extruder.getPrinter(), extruder.getPosition(), temperature=0)
|
||||||
|
if extruder in self._preheat_hotends:
|
||||||
|
extruder.updateIsPreheating(False)
|
||||||
|
self._preheat_hotends.remove(extruder)
|
||||||
|
if not self._preheat_hotends and self._preheat_hotends_timer.isActive():
|
||||||
|
self._preheat_hotends_timer.stop()
|
||||||
|
|
||||||
|
def _onPreheatHotendsTimerFinished(self):
|
||||||
|
for extruder in self._preheat_hotends:
|
||||||
|
self.setTargetHotendTemperature(extruder.getPrinter(), extruder.getPosition(), 0)
|
||||||
|
self._preheat_hotends = set()
|
|
@ -15,6 +15,8 @@ class PrinterOutputController:
|
||||||
self.can_pause = True
|
self.can_pause = True
|
||||||
self.can_abort = True
|
self.can_abort = True
|
||||||
self.can_pre_heat_bed = 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.can_control_manually = True
|
||||||
self._output_device = output_device
|
self._output_device = output_device
|
||||||
|
|
||||||
|
@ -33,6 +35,12 @@ class PrinterOutputController:
|
||||||
def preheatBed(self, printer: "PrinterOutputModel", temperature, duration):
|
def preheatBed(self, printer: "PrinterOutputModel", temperature, duration):
|
||||||
Logger.log("w", "Preheat bed not implemented in controller")
|
Logger.log("w", "Preheat bed not implemented in controller")
|
||||||
|
|
||||||
|
def cancelPreheatHotend(self, extruder: "ExtruderOutputModel"):
|
||||||
|
Logger.log("w", "Cancel preheat hotend not implemented in controller")
|
||||||
|
|
||||||
|
def preheatHotend(self, extruder: "ExtruderOutputModel", temperature, duration):
|
||||||
|
Logger.log("w", "Preheat hotend not implemented in controller")
|
||||||
|
|
||||||
def setHeadPosition(self, printer: "PrinterOutputModel", x, y, z, speed):
|
def setHeadPosition(self, printer: "PrinterOutputModel", x, y, z, speed):
|
||||||
Logger.log("w", "Set head position not implemented in controller")
|
Logger.log("w", "Set head position not implemented in controller")
|
||||||
|
|
||||||
|
@ -45,5 +53,5 @@ class PrinterOutputController:
|
||||||
def homeHead(self, printer: "PrinterOutputModel"):
|
def homeHead(self, printer: "PrinterOutputModel"):
|
||||||
Logger.log("w", "Home head not implemented in controller")
|
Logger.log("w", "Home head not implemented in controller")
|
||||||
|
|
||||||
def sendCustomCommand(self, printer: "PrinterOutputModel", command: str):
|
def sendRawCommand(self, printer: "PrinterOutputModel", command: str):
|
||||||
Logger.log("w", "Custom command not implemented in controller")
|
Logger.log("w", "Custom command not implemented in controller")
|
||||||
|
|
|
@ -111,8 +111,8 @@ class PrinterOutputModel(QObject):
|
||||||
self._controller.homeBed(self)
|
self._controller.homeBed(self)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def sendCustomCommand(self, command: str):
|
def sendRawCommand(self, command: str):
|
||||||
self._controller.sendCustomCommand(self, command)
|
self._controller.sendRawCommand(self, command)
|
||||||
|
|
||||||
@pyqtProperty("QVariantList", constant = True)
|
@pyqtProperty("QVariantList", constant = True)
|
||||||
def extruders(self):
|
def extruders(self):
|
||||||
|
@ -242,6 +242,20 @@ class PrinterOutputModel(QObject):
|
||||||
return self._controller.can_pre_heat_bed
|
return self._controller.can_pre_heat_bed
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Does the printer support pre-heating the bed at all
|
||||||
|
@pyqtProperty(bool, constant=True)
|
||||||
|
def canPreHeatHotends(self):
|
||||||
|
if self._controller:
|
||||||
|
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
|
# Does the printer support pause at all
|
||||||
@pyqtProperty(bool, constant=True)
|
@pyqtProperty(bool, constant=True)
|
||||||
def canPause(self):
|
def canPause(self):
|
||||||
|
|
|
@ -163,7 +163,16 @@ Item {
|
||||||
id: addedSettingsModel;
|
id: addedSettingsModel;
|
||||||
containerId: Cura.MachineManager.activeDefinitionId
|
containerId: Cura.MachineManager.activeDefinitionId
|
||||||
expanded: [ "*" ]
|
expanded: [ "*" ]
|
||||||
exclude: {
|
filter:
|
||||||
|
{
|
||||||
|
if (printSequencePropertyProvider.properties.value == "one_at_a_time")
|
||||||
|
{
|
||||||
|
return {"settable_per_meshgroup": true};
|
||||||
|
}
|
||||||
|
return {"settable_per_mesh": true};
|
||||||
|
}
|
||||||
|
exclude:
|
||||||
|
{
|
||||||
var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ];
|
var excluded_settings = [ "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ];
|
||||||
|
|
||||||
if(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh")
|
if(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type == "support_mesh")
|
||||||
|
@ -375,7 +384,6 @@ Item {
|
||||||
title: catalog.i18nc("@title:window", "Select Settings to Customize for this model")
|
title: catalog.i18nc("@title:window", "Select Settings to Customize for this model")
|
||||||
width: screenScaleFactor * 360
|
width: screenScaleFactor * 360
|
||||||
|
|
||||||
property string labelFilter: ""
|
|
||||||
property var additional_excluded_settings
|
property var additional_excluded_settings
|
||||||
|
|
||||||
onVisibilityChanged:
|
onVisibilityChanged:
|
||||||
|
@ -386,11 +394,33 @@ Item {
|
||||||
// Set skip setting, it will prevent from resetting selected mesh_type
|
// Set skip setting, it will prevent from resetting selected mesh_type
|
||||||
contents.model.visibilityHandler.addSkipResetSetting(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type)
|
contents.model.visibilityHandler.addSkipResetSetting(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type)
|
||||||
listview.model.forceUpdate()
|
listview.model.forceUpdate()
|
||||||
|
|
||||||
|
updateFilter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateFilter()
|
||||||
|
{
|
||||||
|
var new_filter = {};
|
||||||
|
if (printSequencePropertyProvider.properties.value == "one_at_a_time")
|
||||||
|
{
|
||||||
|
new_filter["settable_per_meshgroup"] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_filter["settable_per_mesh"] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(filterInput.text != "")
|
||||||
|
{
|
||||||
|
new_filter["i18n_label"] = "*" + filterInput.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
listview.model.filter = new_filter;
|
||||||
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: filter
|
id: filterInput
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
@ -401,17 +431,7 @@ Item {
|
||||||
|
|
||||||
placeholderText: catalog.i18nc("@label:textbox", "Filter...");
|
placeholderText: catalog.i18nc("@label:textbox", "Filter...");
|
||||||
|
|
||||||
onTextChanged:
|
onTextChanged: settingPickDialog.updateFilter()
|
||||||
{
|
|
||||||
if(text != "")
|
|
||||||
{
|
|
||||||
listview.model.filter = {"settable_per_mesh": true, "i18n_label": "*" + text}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
listview.model.filter = {"settable_per_mesh": true}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox
|
CheckBox
|
||||||
|
@ -437,7 +457,7 @@ Item {
|
||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: filter.bottom;
|
top: filterInput.bottom;
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
right: parent.right;
|
||||||
bottom: parent.bottom;
|
bottom: parent.bottom;
|
||||||
|
@ -449,10 +469,6 @@ Item {
|
||||||
{
|
{
|
||||||
id: definitionsModel;
|
id: definitionsModel;
|
||||||
containerId: Cura.MachineManager.activeDefinitionId
|
containerId: Cura.MachineManager.activeDefinitionId
|
||||||
filter:
|
|
||||||
{
|
|
||||||
"settable_per_mesh": true
|
|
||||||
}
|
|
||||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
|
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
|
||||||
expanded: [ "*" ]
|
expanded: [ "*" ]
|
||||||
exclude:
|
exclude:
|
||||||
|
@ -484,6 +500,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: settingPickDialog.updateFilter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,6 +524,16 @@ Item {
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: printSequencePropertyProvider
|
||||||
|
|
||||||
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
|
key: "print_sequence"
|
||||||
|
watchedProperties: [ "value" ]
|
||||||
|
storeIndex: 0
|
||||||
|
}
|
||||||
|
|
||||||
SystemPalette { id: palette; }
|
SystemPalette { id: palette; }
|
||||||
|
|
||||||
Component
|
Component
|
||||||
|
|
|
@ -13,7 +13,9 @@ class ClusterUM3PrinterOutputController(PrinterOutputController):
|
||||||
def __init__(self, output_device):
|
def __init__(self, output_device):
|
||||||
super().__init__(output_device)
|
super().__init__(output_device)
|
||||||
self.can_pre_heat_bed = False
|
self.can_pre_heat_bed = False
|
||||||
|
self.can_pre_heat_hotends = False
|
||||||
self.can_control_manually = False
|
self.can_control_manually = False
|
||||||
|
self.can_send_raw_gcode = False
|
||||||
|
|
||||||
def setJobState(self, job: "PrintJobOutputModel", state: str):
|
def setJobState(self, job: "PrintJobOutputModel", state: str):
|
||||||
data = "{\"action\": \"%s\"}" % state
|
data = "{\"action\": \"%s\"}" % state
|
||||||
|
|
|
@ -20,6 +20,7 @@ class LegacyUM3PrinterOutputController(PrinterOutputController):
|
||||||
self._preheat_printer = None
|
self._preheat_printer = None
|
||||||
|
|
||||||
self.can_control_manually = False
|
self.can_control_manually = False
|
||||||
|
self.can_send_raw_gcode = False
|
||||||
|
|
||||||
# Are we still waiting for a response about preheat?
|
# Are we still waiting for a response about preheat?
|
||||||
# We need this so we can already update buttons, so it feels more snappy.
|
# We need this so we can already update buttons, so it feels more snappy.
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
# Copyright (c) 2017 Ultimaker B.V.
|
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
|
||||||
|
|
||||||
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
|
|
||||||
from PyQt5.QtCore import QTimer
|
|
||||||
|
|
||||||
MYPY = False
|
|
||||||
if MYPY:
|
|
||||||
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
|
||||||
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
|
||||||
|
|
||||||
|
|
||||||
class USBPrinterOutputController(PrinterOutputController):
|
|
||||||
def __init__(self, output_device):
|
|
||||||
super().__init__(output_device)
|
|
||||||
|
|
||||||
self._preheat_bed_timer = QTimer()
|
|
||||||
self._preheat_bed_timer.setSingleShot(True)
|
|
||||||
self._preheat_bed_timer.timeout.connect(self._onPreheatBedTimerFinished)
|
|
||||||
self._preheat_printer = None
|
|
||||||
|
|
||||||
def moveHead(self, printer: "PrinterOutputModel", x, y, z, speed):
|
|
||||||
self._output_device.sendCommand("G91")
|
|
||||||
self._output_device.sendCommand("G0 X%s Y%s Z%s F%s" % (x, y, z, speed))
|
|
||||||
self._output_device.sendCommand("G90")
|
|
||||||
|
|
||||||
def homeHead(self, printer):
|
|
||||||
self._output_device.sendCommand("G28 X")
|
|
||||||
self._output_device.sendCommand("G28 Y")
|
|
||||||
|
|
||||||
def homeBed(self, printer):
|
|
||||||
self._output_device.sendCommand("G28 Z")
|
|
||||||
|
|
||||||
def sendCustomCommand(self, printer, command):
|
|
||||||
self._output_device.sendCommand(str(command))
|
|
||||||
|
|
||||||
def setJobState(self, job: "PrintJobOutputModel", state: str):
|
|
||||||
if state == "pause":
|
|
||||||
self._output_device.pausePrint()
|
|
||||||
job.updateState("paused")
|
|
||||||
elif state == "print":
|
|
||||||
self._output_device.resumePrint()
|
|
||||||
job.updateState("printing")
|
|
||||||
elif state == "abort":
|
|
||||||
self._output_device.cancelPrint()
|
|
||||||
pass
|
|
||||||
|
|
||||||
def preheatBed(self, printer: "PrinterOutputModel", temperature, duration):
|
|
||||||
try:
|
|
||||||
temperature = round(temperature) # The API doesn't allow floating point.
|
|
||||||
duration = round(duration)
|
|
||||||
except ValueError:
|
|
||||||
return # Got invalid values, can't pre-heat.
|
|
||||||
|
|
||||||
self.setTargetBedTemperature(printer, temperature=temperature)
|
|
||||||
self._preheat_bed_timer.setInterval(duration * 1000)
|
|
||||||
self._preheat_bed_timer.start()
|
|
||||||
self._preheat_printer = printer
|
|
||||||
printer.updateIsPreheating(True)
|
|
||||||
|
|
||||||
def cancelPreheatBed(self, printer: "PrinterOutputModel"):
|
|
||||||
self.preheatBed(printer, temperature=0, duration=0)
|
|
||||||
self._preheat_bed_timer.stop()
|
|
||||||
printer.updateIsPreheating(False)
|
|
||||||
|
|
||||||
def setTargetBedTemperature(self, printer: "PrinterOutputModel", temperature: int):
|
|
||||||
self._output_device.sendCommand("M140 S%s" % temperature)
|
|
||||||
|
|
||||||
def _onPreheatBedTimerFinished(self):
|
|
||||||
self.setTargetBedTemperature(self._preheat_printer, 0)
|
|
||||||
self._preheat_printer.updateIsPreheating(False)
|
|
|
@ -10,9 +10,9 @@ from UM.PluginRegistry import PluginRegistry
|
||||||
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
|
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
|
||||||
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
|
||||||
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
from cura.PrinterOutput.PrintJobOutputModel import PrintJobOutputModel
|
||||||
|
from cura.PrinterOutput.GenericOutputController import GenericOutputController
|
||||||
|
|
||||||
from .AutoDetectBaudJob import AutoDetectBaudJob
|
from .AutoDetectBaudJob import AutoDetectBaudJob
|
||||||
from .USBPrinterOutputController import USBPrinterOutputController
|
|
||||||
from .avr_isp import stk500v2, intelHex
|
from .avr_isp import stk500v2, intelHex
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty
|
from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty
|
||||||
|
@ -240,7 +240,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
container_stack = Application.getInstance().getGlobalContainerStack()
|
container_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
num_extruders = container_stack.getProperty("machine_extruder_count", "value")
|
num_extruders = container_stack.getProperty("machine_extruder_count", "value")
|
||||||
# Ensure that a printer is created.
|
# Ensure that a printer is created.
|
||||||
self._printers = [PrinterOutputModel(output_controller=USBPrinterOutputController(self), number_of_extruders=num_extruders)]
|
self._printers = [PrinterOutputModel(output_controller=GenericOutputController(self), number_of_extruders=num_extruders)]
|
||||||
self._printers[0].updateName(container_stack.getName())
|
self._printers[0].updateName(container_stack.getName())
|
||||||
self.setConnectionState(ConnectionState.connected)
|
self.setConnectionState(ConnectionState.connected)
|
||||||
self._update_thread.start()
|
self._update_thread.start()
|
||||||
|
@ -372,7 +372,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
elapsed_time = int(time() - self._print_start_time)
|
elapsed_time = int(time() - self._print_start_time)
|
||||||
print_job = self._printers[0].activePrintJob
|
print_job = self._printers[0].activePrintJob
|
||||||
if print_job is None:
|
if print_job is None:
|
||||||
print_job = PrintJobOutputModel(output_controller = USBPrinterOutputController(self), name= Application.getInstance().getPrintInformation().jobName)
|
print_job = PrintJobOutputModel(output_controller = GenericOutputController(self), name= Application.getInstance().getPrintInformation().jobName)
|
||||||
print_job.updateState("printing")
|
print_job.updateState("printing")
|
||||||
self._printers[0].updateActivePrintJob(print_job)
|
self._printers[0].updateActivePrintJob(print_job)
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,20 @@ Item
|
||||||
property alias color: background.color
|
property alias color: background.color
|
||||||
property var extruderModel
|
property var extruderModel
|
||||||
property var position: index
|
property var position: index
|
||||||
//width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : Math.floor(extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2)
|
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
implicitHeight: UM.Theme.getSize("sidebar_extruder_box").height
|
implicitHeight: UM.Theme.getSize("sidebar_extruder_box").height
|
||||||
|
|
||||||
|
UM.SettingPropertyProvider
|
||||||
|
{
|
||||||
|
id: extruderTemperature
|
||||||
|
containerStackId: Cura.ExtruderManager.extruderIds[position]
|
||||||
|
key: "material_print_temperature"
|
||||||
|
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||||
|
storeIndex: 0
|
||||||
|
|
||||||
|
property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: background
|
id: background
|
||||||
|
@ -34,12 +45,11 @@ Item
|
||||||
{
|
{
|
||||||
id: extruderTargetTemperature
|
id: extruderTargetTemperature
|
||||||
text: Math.round(extruderModel.targetHotendTemperature) + "°C"
|
text: Math.round(extruderModel.targetHotendTemperature) + "°C"
|
||||||
//text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null && connectedPrinter.targetHotendTemperatures[index] != null) ? Math.round(connectedPrinter.targetHotendTemperatures[index]) + "°C" : ""
|
|
||||||
font: UM.Theme.getFont("small")
|
font: UM.Theme.getFont("small")
|
||||||
color: UM.Theme.getColor("text_inactive")
|
color: UM.Theme.getColor("text_inactive")
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
anchors.bottom: extruderTemperature.bottom
|
anchors.bottom: extruderCurrentTemperature.bottom
|
||||||
|
|
||||||
MouseArea //For tooltip.
|
MouseArea //For tooltip.
|
||||||
{
|
{
|
||||||
|
@ -52,7 +62,7 @@ Item
|
||||||
{
|
{
|
||||||
base.showTooltip(
|
base.showTooltip(
|
||||||
base,
|
base,
|
||||||
{x: 0, y: extruderTargetTemperature.mapToItem(base, 0, -parent.height / 4).y},
|
{x: 0, y: extruderTargetTemperature.mapToItem(base, 0, Math.floor(-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.")
|
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.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -65,9 +75,8 @@ Item
|
||||||
}
|
}
|
||||||
Label //Temperature indication.
|
Label //Temperature indication.
|
||||||
{
|
{
|
||||||
id: extruderTemperature
|
id: extruderCurrentTemperature
|
||||||
text: Math.round(extruderModel.hotendTemperature) + "°C"
|
text: Math.round(extruderModel.hotendTemperature) + "°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: extruderTargetTemperature.left
|
anchors.right: extruderTargetTemperature.left
|
||||||
|
@ -76,7 +85,7 @@ Item
|
||||||
|
|
||||||
MouseArea //For tooltip.
|
MouseArea //For tooltip.
|
||||||
{
|
{
|
||||||
id: extruderTemperatureTooltipArea
|
id: extruderCurrentTemperatureTooltipArea
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onHoveredChanged:
|
onHoveredChanged:
|
||||||
|
@ -85,8 +94,8 @@ Item
|
||||||
{
|
{
|
||||||
base.showTooltip(
|
base.showTooltip(
|
||||||
base,
|
base,
|
||||||
{x: 0, y: parent.mapToItem(base, 0, -parent.height / 4).y},
|
{x: 0, y: parent.mapToItem(base, 0, Math.floor(-parent.height / 4)).y},
|
||||||
catalog.i18nc("@tooltip", "The current temperature of this extruder.")
|
catalog.i18nc("@tooltip", "The current temperature of this hotend.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -97,6 +106,272 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle //Input field for pre-heat temperature.
|
||||||
|
{
|
||||||
|
id: preheatTemperatureControl
|
||||||
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled") : showError ? UM.Theme.getColor("setting_validation_error_background") : UM.Theme.getColor("setting_validation_ok")
|
||||||
|
property var showError:
|
||||||
|
{
|
||||||
|
if(extruderTemperature.properties.maximum_value != "None" && extruderTemperature.properties.maximum_value < Math.floor(preheatTemperatureInput.text))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enabled:
|
||||||
|
{
|
||||||
|
if (extruderModel == null)
|
||||||
|
{
|
||||||
|
return false; //Can't preheat if not connected.
|
||||||
|
}
|
||||||
|
if (!connectedPrinter.acceptsCommands)
|
||||||
|
{
|
||||||
|
return false; //Not allowed to do anything.
|
||||||
|
}
|
||||||
|
if (connectedPrinter.activePrinter && connectedPrinter.activePrinter.activePrintJob)
|
||||||
|
{
|
||||||
|
if((["printing", "pre_print", "resuming", "pausing", "paused", "error", "offline"]).indexOf(connectedPrinter.activePrinter.activePrintJob.state) != -1)
|
||||||
|
{
|
||||||
|
return false; //Printer is in a state where it can't react to pre-heating.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : preheatTemperatureInputMouseArea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
||||||
|
anchors.right: preheatButton.left
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
width: UM.Theme.getSize("monitor_preheat_temperature_control").width
|
||||||
|
height: UM.Theme.getSize("monitor_preheat_temperature_control").height
|
||||||
|
visible: extruderModel != null ? enabled && extruderModel.canPreHeatHotends && !extruderModel.isPreheating : true
|
||||||
|
Rectangle //Highlight of input field.
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: UM.Theme.getSize("default_lining").width
|
||||||
|
color: UM.Theme.getColor("setting_control_highlight")
|
||||||
|
opacity: preheatTemperatureControl.hovered ? 1.0 : 0
|
||||||
|
}
|
||||||
|
MouseArea //Change cursor on hovering.
|
||||||
|
{
|
||||||
|
id: preheatTemperatureInputMouseArea
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
|
||||||
|
onHoveredChanged:
|
||||||
|
{
|
||||||
|
if (containsMouse)
|
||||||
|
{
|
||||||
|
base.showTooltip(
|
||||||
|
base,
|
||||||
|
{x: 0, y: preheatTemperatureInputMouseArea.mapToItem(base, 0, 0).y},
|
||||||
|
catalog.i18nc("@tooltip of temperature input", "The temperature to pre-heat the hotend to.")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.hideTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: unit
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
text: "°C";
|
||||||
|
color: UM.Theme.getColor("setting_unit")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
}
|
||||||
|
TextInput
|
||||||
|
{
|
||||||
|
id: preheatTemperatureInput
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||||
|
selectByMouse: true
|
||||||
|
maximumLength: 5
|
||||||
|
enabled: parent.enabled
|
||||||
|
validator: RegExpValidator { regExp: /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } //Floating point regex.
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||||
|
anchors.right: unit.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
if (!extruderTemperature.properties.value)
|
||||||
|
{
|
||||||
|
text = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = extruderTemperature.properties.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button //The pre-heat button.
|
||||||
|
{
|
||||||
|
id: preheatButton
|
||||||
|
height: UM.Theme.getSize("setting_control").height
|
||||||
|
visible: extruderModel != null ? extruderModel.canPreHeatHotends: true
|
||||||
|
enabled:
|
||||||
|
{
|
||||||
|
if (!preheatTemperatureControl.enabled)
|
||||||
|
{
|
||||||
|
return false; //Not connected, not authenticated or printer is busy.
|
||||||
|
}
|
||||||
|
if (extruderModel.isPreheating)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (extruderTemperature.properties.minimum_value != "None" && Math.floor(preheatTemperatureInput.text) < Math.floor(extruderTemperature.properties.minimum_value))
|
||||||
|
{
|
||||||
|
return false; //Target temperature too low.
|
||||||
|
}
|
||||||
|
if (extruderTemperature.properties.maximum_value != "None" && Math.floor(preheatTemperatureInput.text) > Math.floor(extruderTemperature.properties.maximum_value))
|
||||||
|
{
|
||||||
|
return false; //Target temperature too high.
|
||||||
|
}
|
||||||
|
if (Math.floor(preheatTemperatureInput.text) == 0)
|
||||||
|
{
|
||||||
|
return false; //Setting the temperature to 0 is not allowed (since that cancels the pre-heating).
|
||||||
|
}
|
||||||
|
return true; //Preconditions are met.
|
||||||
|
}
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2)
|
||||||
|
border.color:
|
||||||
|
{
|
||||||
|
if(!control.enabled)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled_border");
|
||||||
|
}
|
||||||
|
else if(control.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_active_border");
|
||||||
|
}
|
||||||
|
else if(control.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered_border");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_border");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
color:
|
||||||
|
{
|
||||||
|
if(!control.enabled)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled");
|
||||||
|
}
|
||||||
|
else if(control.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_active");
|
||||||
|
}
|
||||||
|
else if(control.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Behavior on color
|
||||||
|
{
|
||||||
|
ColorAnimation
|
||||||
|
{
|
||||||
|
duration: 50
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: actualLabel
|
||||||
|
anchors.centerIn: parent
|
||||||
|
color:
|
||||||
|
{
|
||||||
|
if(!control.enabled)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_disabled_text");
|
||||||
|
}
|
||||||
|
else if(control.pressed)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_active_text");
|
||||||
|
}
|
||||||
|
else if(control.hovered)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_hovered_text");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("action_button_text");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
font: UM.Theme.getFont("action_button")
|
||||||
|
text:
|
||||||
|
{
|
||||||
|
if(extruderModel == null)
|
||||||
|
{
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if(extruderModel.isPreheating )
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@button Cancel pre-heating", "Cancel")
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@button", "Pre-heat")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
if (!extruderModel.isPreheating)
|
||||||
|
{
|
||||||
|
extruderModel.preheatHotend(preheatTemperatureInput.text, 900);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
extruderModel.cancelPreheatHotend();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onHoveredChanged:
|
||||||
|
{
|
||||||
|
if (hovered)
|
||||||
|
{
|
||||||
|
base.showTooltip(
|
||||||
|
base,
|
||||||
|
{x: 0, y: preheatButton.mapToItem(base, 0, 0).y},
|
||||||
|
catalog.i18nc("@tooltip of pre-heat", "Heat the hotend in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the hotend to heat up when you're ready to print.")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.hideTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle //Material colour indication.
|
Rectangle //Material colour indication.
|
||||||
{
|
{
|
||||||
id: materialColor
|
id: materialColor
|
||||||
|
|
|
@ -118,21 +118,24 @@ Item
|
||||||
{
|
{
|
||||||
return false; //Not allowed to do anything.
|
return false; //Not allowed to do anything.
|
||||||
}
|
}
|
||||||
if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "paused" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline")
|
if (connectedPrinter.activePrinter && connectedPrinter.activePrinter.activePrintJob)
|
||||||
|
{
|
||||||
|
if((["printing", "pre_print", "resuming", "pausing", "paused", "error", "offline"]).indexOf(connectedPrinter.activePrinter.activePrintJob.state) != -1)
|
||||||
{
|
{
|
||||||
return false; //Printer is in a state where it can't react to pre-heating.
|
return false; //Printer is in a state where it can't react to pre-heating.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : preheatTemperatureInputMouseArea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : preheatTemperatureInputMouseArea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
||||||
anchors.left: parent.left
|
anchors.right: preheatButton.left
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
width: UM.Theme.getSize("setting_control").width
|
width: UM.Theme.getSize("monitor_preheat_temperature_control").width
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("monitor_preheat_temperature_control").height
|
||||||
visible: printerModel != null ? printerModel.canPreHeatBed: true
|
visible: printerModel != null ? enabled && printerModel.canPreHeatBed && !printerModel.isPreheating : true
|
||||||
Rectangle //Highlight of input field.
|
Rectangle //Highlight of input field.
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -163,18 +166,29 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: unit
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
text: "°C";
|
||||||
|
color: UM.Theme.getColor("setting_unit")
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
}
|
||||||
TextInput
|
TextInput
|
||||||
{
|
{
|
||||||
id: preheatTemperatureInput
|
id: preheatTemperatureInput
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
maximumLength: 10
|
maximumLength: 5
|
||||||
enabled: parent.enabled
|
enabled: parent.enabled
|
||||||
validator: RegExpValidator { regExp: /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } //Floating point regex.
|
validator: RegExpValidator { regExp: /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } //Floating point regex.
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
|
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||||
anchors.right: parent.right
|
anchors.right: unit.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
|
|
|
@ -100,30 +100,29 @@ Item
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
// enabled:
|
enabled:
|
||||||
// {
|
{
|
||||||
// if (printerModel == null)
|
if (printerModel == null)
|
||||||
// {
|
{
|
||||||
// return false; //Can't control the printer if not connected
|
return false; //Can't control the printer if not connected
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (!connectedDevice.acceptsCommands)
|
|
||||||
// {
|
|
||||||
// return false; //Not allowed to do anything.
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(activePrintJob == null)
|
|
||||||
// {
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (activePrintJob.state == "printing" || activePrintJob.state == "resuming" || activePrintJob.state == "pausing" || activePrintJob.state == "error" || activePrintJob.state == "offline")
|
|
||||||
// {
|
|
||||||
// return false; //Printer is in a state where it can't react to manual control
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
if (!connectedDevice.acceptsCommands)
|
||||||
|
{
|
||||||
|
return false; //Not allowed to do anything.
|
||||||
|
}
|
||||||
|
|
||||||
|
if(activePrintJob == null)
|
||||||
|
{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activePrintJob.state == "printing" || activePrintJob.state == "resuming" || activePrintJob.state == "pausing" || activePrintJob.state == "error" || activePrintJob.state == "offline")
|
||||||
|
{
|
||||||
|
return false; //Printer is in a state where it can't react to manual control
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
MonitorSection
|
MonitorSection
|
||||||
{
|
{
|
||||||
|
@ -458,7 +457,7 @@ Item
|
||||||
id: customCommandControl
|
id: customCommandControl
|
||||||
|
|
||||||
// state
|
// state
|
||||||
visible: printerModel != null ? printerModel.canPreHeatBed: true
|
visible: printerModel != null ? printerModel.canSendRawGcode: true
|
||||||
enabled: {
|
enabled: {
|
||||||
if (printerModel == null) {
|
if (printerModel == null) {
|
||||||
return false // Can't preheat if not connected
|
return false // Can't preheat if not connected
|
||||||
|
@ -534,7 +533,7 @@ Item
|
||||||
// we also clear the text field
|
// we also clear the text field
|
||||||
Keys.onReturnPressed:
|
Keys.onReturnPressed:
|
||||||
{
|
{
|
||||||
printerModel.sendCustomCommand(customCommandControlInput.text)
|
printerModel.sendRawCommand(customCommandControlInput.text)
|
||||||
customCommandControlInput.text = ""
|
customCommandControlInput.text = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,6 +411,8 @@
|
||||||
"save_button_save_to_button": [0.3, 2.7],
|
"save_button_save_to_button": [0.3, 2.7],
|
||||||
"save_button_specs_icons": [1.4, 1.4],
|
"save_button_specs_icons": [1.4, 1.4],
|
||||||
|
|
||||||
|
"monitor_preheat_temperature_control": [4.5, 2.0],
|
||||||
|
|
||||||
"modal_window_minimum": [60.0, 45],
|
"modal_window_minimum": [60.0, 45],
|
||||||
"license_window_minimum": [45, 45],
|
"license_window_minimum": [45, 45],
|
||||||
"wizard_progress": [10.0, 0.0],
|
"wizard_progress": [10.0, 0.0],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue