From 28a515ba6a43d171e6c1ee0f47cc77def76c3e2b Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Thu, 14 Feb 2019 14:41:01 +0000 Subject: [PATCH 1/3] Always show unfuzzy times for total print time and time left in tooltip --- .../static/js/app/viewmodels/printerstate.js | 26 ++++++++++++++----- src/octoprint/templates/sidebar/state.jinja2 | 4 +-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/printerstate.js b/src/octoprint/static/js/app/viewmodels/printerstate.js index bd01a3c13..9939bef82 100644 --- a/src/octoprint/static/js/app/viewmodels/printerstate.js +++ b/src/octoprint/static/js/app/viewmodels/printerstate.js @@ -56,14 +56,20 @@ $(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.byteString = ko.pureComputed(function() { + self.estimatedPrintTimeExactString = ko.pureComputed(function() { + return estimatedPrintTimeStringHlpr(formatDuration); + }); + self.byteString = ko.pureComputed(function() { if (!self.filesize()) return "-"; var filepos = self.filepos() ? formatSize(self.filepos()) : "-"; @@ -79,16 +85,22 @@ $(function() { return "-"; return formatDuration(self.printTime()); }); - self.printTimeLeftString = ko.pureComputed(function() { - if (self.printTimeLeft() === undefined) { + var printTimeLeftStringHlpr = function (fmt) { + if (self.printTimeLeft() == undefined) { if (!self.printTime() || !(self.isPrinting() || self.isPaused())) { return "-"; } else { 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(); diff --git a/src/octoprint/templates/sidebar/state.jinja2 b/src/octoprint/templates/sidebar/state.jinja2 index 71ab5f2b7..30e4f9839 100644 --- a/src/octoprint/templates/sidebar/state.jinja2 +++ b/src/octoprint/templates/sidebar/state.jinja2 @@ -10,10 +10,10 @@
-{{ _('Approx. Total Print Time') }}:
+{{ _('Approx. Total Print Time') }}:

{{ _('Print Time') }}:
-{{ _('Print Time Left') }}:
+{{ _('Print Time Left') }}:
{{ _('Printed') }}:
From 38b7be0142947a47d1558913e3e682dd8b071aab Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Thu, 14 Feb 2019 14:52:24 +0000 Subject: [PATCH 2/3] Fix whitespace --- .../static/js/app/viewmodels/printerstate.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/octoprint/static/js/app/viewmodels/printerstate.js b/src/octoprint/static/js/app/viewmodels/printerstate.js index 9939bef82..e7163e749 100644 --- a/src/octoprint/static/js/app/viewmodels/printerstate.js +++ b/src/octoprint/static/js/app/viewmodels/printerstate.js @@ -56,20 +56,20 @@ $(function() { self.titlePrintButton = ko.observable(self.TITLE_PRINT_BUTTON_UNPAUSED); self.titlePauseButton = ko.observable(self.TITLE_PAUSE_BUTTON_UNPAUSED); - var estimatedPrintTimeStringHlpr = function (fmt) { + var estimatedPrintTimeStringHlpr = function (fmt) { if (self.lastPrintTime()) return fmt(self.lastPrintTime()); if (self.estimatedPrintTime()) return fmt(self.estimatedPrintTime()); return "-"; - } + } self.estimatedPrintTimeString = ko.pureComputed(function() { - return estimatedPrintTimeStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration); + return estimatedPrintTimeStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration); }); self.estimatedPrintTimeExactString = ko.pureComputed(function() { - return estimatedPrintTimeStringHlpr(formatDuration); + return estimatedPrintTimeStringHlpr(formatDuration); }); - self.byteString = ko.pureComputed(function() { + self.byteString = ko.pureComputed(function() { if (!self.filesize()) return "-"; var filepos = self.filepos() ? formatSize(self.filepos()) : "-"; @@ -85,7 +85,7 @@ $(function() { return "-"; return formatDuration(self.printTime()); }); - var printTimeLeftStringHlpr = function (fmt) { + var printTimeLeftStringHlpr = function (fmt) { if (self.printTimeLeft() == undefined) { if (!self.printTime() || !(self.isPrinting() || self.isPaused())) { return "-"; @@ -95,12 +95,12 @@ $(function() { } else { return fmt(self.printTimeLeft()); } - } + } self.printTimeLeftString = ko.pureComputed(function() { - return printTimeLeftStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration); + return printTimeLeftStringHlpr(self.settings.appearance_fuzzyTimes() ? formatFuzzyPrintTime : formatDuration); }); self.printTimeLeftExactString = ko.pureComputed(function() { - return printTimeLeftStringHlpr(formatDuration); + return printTimeLeftStringHlpr(formatDuration); }); self.printTimeLeftOriginString = ko.pureComputed(function() { var value = self.printTimeLeftOrigin(); From c5bf58e1ccf10adf708da3fb3b10373e426ab43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 14 Feb 2019 15:56:09 +0100 Subject: [PATCH 3/3] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=3D=3D=20->=20=3D=3D?= =?UTF-8?q?=3D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/static/js/app/viewmodels/printerstate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/js/app/viewmodels/printerstate.js b/src/octoprint/static/js/app/viewmodels/printerstate.js index e7163e749..27ae3b0a5 100644 --- a/src/octoprint/static/js/app/viewmodels/printerstate.js +++ b/src/octoprint/static/js/app/viewmodels/printerstate.js @@ -86,7 +86,7 @@ $(function() { return formatDuration(self.printTime()); }); var printTimeLeftStringHlpr = function (fmt) { - if (self.printTimeLeft() == undefined) { + if (self.printTimeLeft() === undefined) { if (!self.printTime() || !(self.isPrinting() || self.isPaused())) { return "-"; } else {