Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Cura/gui/printWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,15 @@ def __doPrinterConnectionUpdate(self, connection, extraInfo):
self._progressBar.SetValue(0)
info = connection.getStatusString()
info += '\n'
if self._printerConnection.getTemperature(0) is not None:
info += 'Temperature: %d' % (self._printerConnection.getTemperature(0))
if self._printerConnection.getBedTemperature() > 0:
info += ' Bed: %d' % (self._printerConnection.getBedTemperature())
value = self._printerConnection.getTemperature(0)
if value is not None:
info += 'Temperature: %d' % (value)
value = self._printerConnection.getBedTemperature()
if value is not None:
info += ' Bed: %d' % (value)
value = self._printerConnection.getZ()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for readability I changed this to only get the value once

if value is not None:
info += ' Z: %.2f' % (value)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the last 'if' could be extended, e.g. checking if we are printing, or simply check if z=0, or we could check this in serialConnection instead

if self._infoText is not None:
self._infoText.SetLabel(info)
else:
Expand Down
3 changes: 3 additions & 0 deletions Cura/util/printerConnection/printerConnectionBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def getTemperature(self, extruder):
def getBedTemperature(self):
return None

def getZ(self):
return 0.0

# Get the connection status string. This is displayed to the user and can be used to communicate
# various information to the user.
def getStatusString(self):
Expand Down
7 changes: 7 additions & 0 deletions Cura/util/printerConnection/serialConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __init__(self, port):
self._targetTemperature = []
self._bedTemperature = 0
self._targetBedTemperature = 0
self._z = 0.0
self._log = []

self._commState = None
Expand Down Expand Up @@ -157,6 +158,9 @@ def getTemperature(self, extruder):
def getBedTemperature(self):
return self._bedTemperature

def getZ(self):
return self._z

#Are we able to send a direct command with sendCommand at this moment in time.
def isAbleToSendDirectCommand(self):
return self.isActiveConnectionOpen()
Expand Down Expand Up @@ -212,6 +216,9 @@ def _serialCommunicationThread(self):
elif line[0] == 'progress':
self._printProgress = int(line[1])
self._doCallback()
elif line[0] == 'changeZ':
self._z = float(line[1])
self._doCallback()
else:
print line
line = self._process.stdout.readline()
Expand Down