Merge pull request #3051 from CapnBry/unfuzzy-timetips

Always show unfuzzy times for total print time and time left in tooltip
This commit is contained in:
Gina Häußge authored and GitHub committed 2019-02-14 15:59:34 +01:00
commit 0e482151fd
2 files changed
+19 -7

No files matched your search

@@ -56,12 +56,18 @@ $(function() {
self.titlePrintButton = ko.observable(self.TITLE_PRINT_BUTTON_UNPAUSED);
self.titlePauseButton = ko.observable(self.TITLE_PAUSE_BUTTON_UNPAUSED);
self.estimatedPrintTimeString = ko.pureComputed(function() {
var estimatedPrintTimeStringHlpr = function (fmt) {
if (self.lastPrintTime())
return self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime(self.lastPrintTime()) : formatDuration(self.lastPrintTime());
return fmt(self.lastPrintTime());
if (self.estimatedPrintTime())
return self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime(self.estimatedPrintTime()) : formatDuration(self.estimatedPrintTime());
return fmt(self.estimatedPrintTime());
return "-";
}
self.estimatedPrintTimeString = ko.pureComputed(function() {
return estimatedPrintTimeStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration);
});
self.estimatedPrintTimeExactString = ko.pureComputed(function() {
return estimatedPrintTimeStringHlpr(formatDuration);
});
self.byteString = ko.pureComputed(function() {
if (!self.filesize())
@@ -79,7 +85,7 @@ $(function() {
return "-";
return formatDuration(self.printTime());
});
self.printTimeLeftString = ko.pureComputed(function() {
var printTimeLeftStringHlpr = function (fmt) {
if (self.printTimeLeft() === undefined) {
if (!self.printTime() || !(self.isPrinting() || self.isPaused())) {
return "-";
@@ -87,8 +93,14 @@ $(function() {
return gettext("Still stabilizing...");
}
} else {
return self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime(self.printTimeLeft()) : formatDuration(self.printTimeLeft());
return fmt(self.printTimeLeft());
}
}
self.printTimeLeftString = ko.pureComputed(function() {
return printTimeLeftStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration);
});
self.printTimeLeftExactString = ko.pureComputed(function() {
return printTimeLeftStringHlpr(formatDuration);
});
self.printTimeLeftOriginString = ko.pureComputed(function() {
var value = self.printTimeLeftOrigin();
+2 -2
View File
@@ -10,10 +10,10 @@
<!-- ko foreach: filament -->
<span data-bind="text: 'Filament (' + name() + '): ', title: 'Filament usage for ' + name()"></span><strong data-bind="text: formatFilament(data())"></strong><br>
<!-- /ko -->
<span title="{{ _('Estimated total print time based on analysis of the file or past prints') }}">{{ _('Approx. Total Print Time') }}</span>: <strong data-bind="text: estimatedPrintTimeString"></strong><br>
<span title="{{ _('Estimated total print time based on analysis of the file or past prints') }}">{{ _('Approx. Total Print Time') }}</span>: <strong data-bind="text: estimatedPrintTimeString, attr: {title: estimatedPrintTimeExactString}"></strong><br>
<hr>
<span title="{{ _('Total print time so far') }}">{{ _('Print Time') }}</span>: <strong data-bind="text: printTimeString"></strong><br>
<span title="{{ _('Estimated time until the print job is done. This is only an estimate and accuracy depends heavily on various factors!') }}">{{ _('Print Time Left') }}</span>: <strong data-bind="text: printTimeLeftString"></strong> <span id="state_printtimeleft_popover" style="display: none" data-bind="visible: printTimeLeftOrigin, attr: {title: printTimeLeftOriginString}, css: printTimeLeftOriginClass">&#9679;</span><br>
<span title="{{ _('Estimated time until the print job is done. This is only an estimate and accuracy depends heavily on various factors!') }}">{{ _('Print Time Left') }}</span>: <strong data-bind="text: printTimeLeftString, attr: {title: printTimeLeftExactString}"></strong> <span id="state_printtimeleft_popover" style="display: none" data-bind="visible: printTimeLeftOrigin, attr: {title: printTimeLeftOriginString}, css: printTimeLeftOriginClass">&#9679;</span><br>
<span title="{{ _('Bytes printed vs total bytes of file') }}">{{ _('Printed') }}</span>: <strong data-bind="text: byteString"></strong><br>