Merge branch 'dev/fahrenheit' of https://github.com/therealbstern/OctoPrint into pr/therealbstern/dev/fahrenheit

Conflicts:
	AUTHORS.md
This commit is contained in:
Gina Häußge 2016-05-09 11:33:57 +02:00
commit 5ff16bcbf4
6 changed files with 19 additions and 4 deletions

View file

@ -62,6 +62,7 @@ date of first contribution):
* ["geoporalis"](https://github.com/geoporalis)
* [Andrew Malota](https://github.com/2bitoperations)
* [Alexander Leisentritt](https://github.com/Alex9779)
* [therealbstern](https://github.com/therealbstern)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and

View file

@ -212,6 +212,7 @@ default_settings = {
"color": "default",
"colorTransparent": False,
"defaultLanguage": "_default",
"showFahrenheitAlso": False,
"components": {
"order": {
"navbar": ["settings", "systemmenu", "login", "plugin_announcements"],

View file

@ -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&deg;C", temp);
if (showF) {
return _.sprintf("%.1f&deg;C (%.1f&deg;F)", temp, temp * 9 / 5 + 32);
} else {
return _.sprintf("%.1f&deg;C", temp);
}
}
function pnotifyAdditionalInfo(inner) {

View file

@ -101,6 +101,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);

View file

@ -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,

View file

@ -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">