Support Fahrenheit display.
This commit is contained in:
parent
5af78de226
commit
e2d2a6f5a4
5 changed files with 18 additions and 4 deletions
|
|
@ -207,6 +207,7 @@ default_settings = {
|
|||
"color": "default",
|
||||
"colorTransparent": False,
|
||||
"defaultLanguage": "_default",
|
||||
"showFahrenheitAlso": False,
|
||||
"components": {
|
||||
"order": {
|
||||
"navbar": ["settings", "systemmenu", "login"],
|
||||
|
|
|
|||
|
|
@ -411,9 +411,13 @@ function cleanTemperature(temp) {
|
|||
return temp;
|
||||
}
|
||||
|
||||
function formatTemperature(temp) {
|
||||
function formatTemperature(temp, showF) {
|
||||
if (!temp || temp < 10) return gettext("off");
|
||||
return _.sprintf("%.1f°C (%.1f°F)", temp, temp * 9 / 5 + 32);
|
||||
if (showF) {
|
||||
return _.sprintf("%.1f°C (%.1f°F)", temp, temp * 9 / 5 + 32);
|
||||
} else {
|
||||
return _.sprintf("%.1f°C", temp);
|
||||
}
|
||||
}
|
||||
|
||||
function pnotifyAdditionalInfo(inner) {
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ $(function() {
|
|||
self.appearance_color = ko.observable(undefined);
|
||||
self.appearance_colorTransparent = ko.observable();
|
||||
self.appearance_defaultLanguage = ko.observable();
|
||||
self.appearance_showFahrenheitAlso = ko.observable(undefined);
|
||||
|
||||
self.printer_defaultExtrusionLength = ko.observable(undefined);
|
||||
|
||||
|
|
|
|||
|
|
@ -248,8 +248,9 @@ $(function() {
|
|||
targets = self.temperatures[type].target;
|
||||
}
|
||||
|
||||
var actualTemp = actuals && actuals.length ? formatTemperature(actuals[actuals.length - 1][1]) : "-";
|
||||
var targetTemp = targets && targets.length ? formatTemperature(targets[targets.length - 1][1]) : "-";
|
||||
var showFahrenheit = self.settingsViewModel.settings.appearance.showFahrenheitAlso();
|
||||
var actualTemp = actuals && actuals.length ? formatTemperature(actuals[actuals.length - 1][1], showFahrenheit) : "-";
|
||||
var targetTemp = targets && targets.length ? formatTemperature(targets[targets.length - 1][1], showFahrenheit) : "-";
|
||||
|
||||
data.push({
|
||||
label: gettext("Actual") + " " + heaterOptions[type].name + ": " + actualTemp,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@
|
|||
<span class="help-inline">{{ _('Changes to the default interface language will only become active after a reload of the page and only be active if not overridden by the user''s language settings.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" data-bind="checked: appearance_showFahrenheitAlso" id="settings-appearanceShowFahrenheitAlso"> {{ _('Show temperatures in Fahrenheit as well as Celcius') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div id="settings_appearance_managelanguagesdialog" class="modal hide fade">
|
||||
|
|
|
|||
Loading…
Reference in a new issue