mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Heated bed timeout time now hides correctly if time ran out
CURA-3360
This commit is contained in:
parent
2f3998b9db
commit
356d4f9288
2 changed files with 6 additions and 3 deletions
|
@ -47,8 +47,8 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
self._job_name = ""
|
self._job_name = ""
|
||||||
self._error_text = ""
|
self._error_text = ""
|
||||||
self._accepts_commands = True
|
self._accepts_commands = True
|
||||||
self._preheat_bed_timeout = 900 #Default time-out for pre-heating the bed, in seconds.
|
self._preheat_bed_timeout = 900 # Default time-out for pre-heating the bed, in seconds.
|
||||||
self._preheat_bed_timer = QTimer() #Timer that tracks how long to preheat still.
|
self._preheat_bed_timer = QTimer() # Timer that tracks how long to preheat still.
|
||||||
self._preheat_bed_timer.setSingleShot(True)
|
self._preheat_bed_timer.setSingleShot(True)
|
||||||
self._preheat_bed_timer.timeout.connect(self.cancelPreheatBed)
|
self._preheat_bed_timer.timeout.connect(self.cancelPreheatBed)
|
||||||
|
|
||||||
|
@ -232,11 +232,15 @@ class PrinterOutputDevice(QObject, OutputDevice):
|
||||||
# \return The duration of the time-out to pre-heat the bed, formatted.
|
# \return The duration of the time-out to pre-heat the bed, formatted.
|
||||||
@pyqtProperty(str, notify = preheatBedRemainingTimeChanged)
|
@pyqtProperty(str, notify = preheatBedRemainingTimeChanged)
|
||||||
def preheatBedRemainingTime(self):
|
def preheatBedRemainingTime(self):
|
||||||
|
if not self._preheat_bed_timer.isActive():
|
||||||
|
return ""
|
||||||
period = self._preheat_bed_timer.remainingTime()
|
period = self._preheat_bed_timer.remainingTime()
|
||||||
if period <= 0:
|
if period <= 0:
|
||||||
return ""
|
return ""
|
||||||
minutes, period = divmod(period, 60000) #60000 milliseconds in a minute.
|
minutes, period = divmod(period, 60000) #60000 milliseconds in a minute.
|
||||||
seconds, _ = divmod(period, 1000) #1000 milliseconds in a second.
|
seconds, _ = divmod(period, 1000) #1000 milliseconds in a second.
|
||||||
|
if minutes <= 0 and seconds <= 0:
|
||||||
|
return ""
|
||||||
return "%d:%02d" % (minutes, seconds)
|
return "%d:%02d" % (minutes, seconds)
|
||||||
|
|
||||||
## Time the print has been printing.
|
## Time the print has been printing.
|
||||||
|
|
|
@ -558,7 +558,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
self._preheat_bed_timer.stop()
|
self._preheat_bed_timer.stop()
|
||||||
self.preheatBedRemainingTimeChanged.emit()
|
self.preheatBedRemainingTimeChanged.emit()
|
||||||
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
Logger.log("d", "Closing connection of printer %s with ip %s", self._key, self._address)
|
Logger.log("d", "Closing connection of printer %s with ip %s", self._key, self._address)
|
||||||
self._updateJobState("")
|
self._updateJobState("")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue