mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
CURA-4870 Create an extruder configuration model to store the extruder configuration.
Connect the signals coming from the printer to correctly update the UI
This commit is contained in:
parent
a992487589
commit
51686943e6
6 changed files with 82 additions and 17 deletions
42
cura/PrinterOutput/ExtruderConfigurationModel.py
Normal file
42
cura/PrinterOutput/ExtruderConfigurationModel.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal
|
||||
|
||||
|
||||
class ExtruderConfigurationModel(QObject):
|
||||
|
||||
extruderConfigurationChanged = pyqtSignal()
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._position = -1
|
||||
self._material = None
|
||||
self._hotend_id = None
|
||||
|
||||
def setPosition(self, position):
|
||||
self._position = position
|
||||
|
||||
@pyqtProperty(int, fset = setPosition, notify = extruderConfigurationChanged)
|
||||
def position(self):
|
||||
return self._position
|
||||
|
||||
def setMaterial(self, material):
|
||||
self._material = material
|
||||
|
||||
@pyqtProperty(str, fset = setMaterial, notify = extruderConfigurationChanged)
|
||||
def material(self):
|
||||
return self._material
|
||||
|
||||
def setHotendID(self, hotend_id):
|
||||
self._hotend_id = hotend_id
|
||||
|
||||
@pyqtProperty(str, fset = setHotendID, notify = extruderConfigurationChanged)
|
||||
def hotendID(self):
|
||||
return self._hotend_id
|
||||
|
||||
def __eq__(self, other):
|
||||
return hash(self) == hash(other)
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.position) ^ hash(self.material) ^ hash(self.hotendID)
|
Loading…
Add table
Add a link
Reference in a new issue