Пример #1
0
    def __init__(self,
                 output_controller: "PrinterOutputController",
                 number_of_extruders: int = 1,
                 parent=None,
                 firmware_version="") -> None:
        super().__init__(parent)
        self._bed_temperature = -1  # type: float  # Use -1 for no heated bed.
        self._target_bed_temperature = 0  # type: float
        self._name = ""
        self._key = ""  # Unique identifier
        self._controller = output_controller
        self._controller.canUpdateFirmwareChanged.connect(
            self._onControllerCanUpdateFirmwareChanged)
        self._extruders = [
            ExtruderOutputModel(printer=self, position=i)
            for i in range(number_of_extruders)
        ]
        self._printer_configuration = PrinterConfigurationModel(
        )  # Indicates the current configuration setup in this printer
        self._head_position = Vector(0, 0, 0)
        self._active_print_job = None  # type: Optional[PrintJobOutputModel]
        self._firmware_version = firmware_version
        self._printer_state = "unknown"
        self._is_preheating = False
        self._printer_type = ""
        self._buildplate = ""

        self._printer_configuration.extruderConfigurations = [
            extruder.extruderConfiguration for extruder in self._extruders
        ]

        self._camera_url = QUrl()  # type: QUrl
    def updateOutputModel(self, model: ExtruderOutputModel) -> None:
        if self.print_core_id is not None:
            model.updateHotendID(self.print_core_id)

        if self.material:
            active_material = model.activeMaterial
            if active_material is None or active_material.guid != self.material.guid:
                material = self.material.createOutputModel()
                model.updateActiveMaterial(material)
        else:
            model.updateActiveMaterial(None)
    def updateOutputModel(self, model: ExtruderOutputModel) -> None:
        if self.print_core_id is not None:
            model.updateHotendID(self.print_core_id)

        if self.material:
            active_material = model.activeMaterial
            if active_material is None or active_material.guid != self.material.guid:
                material = self.material.createOutputModel()
                model.updateActiveMaterial(material)
        else:
            model.updateActiveMaterial(None)
    def updateOutputModel(self, model: ExtruderOutputModel) -> None:
        """Updates the given output model.

        :param model: The output model to update.
        """

        if self.print_core_id is not None:
            model.updateHotendID(self.print_core_id)

        if self.material:
            active_material = model.activeMaterial
            if active_material is None or active_material.guid != self.material.guid:
                material = self.material.createOutputModel()
                model.updateActiveMaterial(material)
        else:
            model.updateActiveMaterial(None)