Add a connection string to the printmonitor

CURA-2091
This commit is contained in:
fieldOfView 2016-08-09 18:43:09 +02:00
parent a0df0c76de
commit e551898e04
3 changed files with 29 additions and 5 deletions

View file

@ -31,6 +31,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
self._head_y = 0
self._head_z = 0
self._connection_state = ConnectionState.closed
self._connection_text = ""
self._time_elapsed = 0
self._time_total = 0
self._job_state = ""
@ -71,6 +72,8 @@ class PrinterOutputDevice(QObject, OutputDevice):
# it also sends it's own device_id (for convenience sake)
connectionStateChanged = pyqtSignal(str)
connectionTextChanged = pyqtSignal()
timeElapsedChanged = pyqtSignal()
timeTotalChanged = pyqtSignal()
@ -292,6 +295,16 @@ class PrinterOutputDevice(QObject, OutputDevice):
self._connection_state = connection_state
self.connectionStateChanged.emit(self._id)
@pyqtProperty(str, notify = connectionTextChanged)
def connectionText(self):
return self._connection_text
## Set a text that is shown on top of the print monitor tab
def setConnectionText(self, connection_text):
if self._connection_text != connection_text:
self._connection_text = connection_text
self.connectionTextChanged.emit()
## Ensure that close gets called when object is destroyed
def __del__(self):
self.close()