Add kPa unit

yahoo_weather
Neroth 12 years ago
parent 2aed4f13dc
commit bee81035f4
  1. 14
      src/extension.js
  2. 9
      src/org.gnome.shell.extensions.weather.gschema.xml.in
  3. 2
      src/weather-settings.js.in

@ -90,10 +90,11 @@ const WeatherPressureUnits = {
inHg: 1, inHg: 1,
bar: 2, bar: 2,
Pa: 3, Pa: 3,
atm: 4, kPa: 4,
at: 5, atm: 5,
Torr: 6, at: 6,
psi: 7 Torr: 7,
psi: 8
} }
const WeatherPosition = { const WeatherPosition = {
@ -1099,6 +1100,11 @@ const WeatherMenuButton = new Lang.Class({
pressure_unit = "Pa"; pressure_unit = "Pa";
break; break;
case WeatherPressureUnits.kPa:
pressure = Math.round(this.toPascal(pressure,temperature)/1000);
pressure_unit = "kPa";
break;
case WeatherPressureUnits.atm: case WeatherPressureUnits.atm:
pressure = Math.round((this.toPascal(pressure,temperature)*0.00000986923267)*100000)/100000; pressure = Math.round((this.toPascal(pressure,temperature)*0.00000986923267)*100000)/100000;
pressure_unit = "atm"; pressure_unit = "atm";

@ -14,10 +14,11 @@
<value nick="inHg" value="1" /> <value nick="inHg" value="1" />
<value nick="bar" value="2" /> <value nick="bar" value="2" />
<value nick="Pa" value="3" /> <value nick="Pa" value="3" />
<value nick="atm" value="4" /> <value nick="kPa" value="4" />
<value nick="at" value="5" /> <value nick="atm" value="5" />
<value nick="Torr" value="6" /> <value nick="at" value="6" />
<value nick="psi" value="7" /> <value nick="Torr" value="7" />
<value nick="psi" value="8" />
</enum> </enum>
<enum id="org.gnome.shell.extensions.weather.wind-speed-unit"> <enum id="org.gnome.shell.extensions.weather.wind-speed-unit">
<value nick="kph" value="0" /> <value nick="kph" value="0" />

@ -695,7 +695,7 @@ WeatherSetting.prototype =
this.addLabel(_("Wind Speed Unit")); this.addLabel(_("Wind Speed Unit"));
this.addComboBox(["km/h","mph","m/s","kn","ft/s","Beaufort"],"wind_speed_unit"); this.addComboBox(["km/h","mph","m/s","kn","ft/s","Beaufort"],"wind_speed_unit");
this.addLabel(_("Pressure Unit")); this.addLabel(_("Pressure Unit"));
this.addComboBox(["hPa","inHg","bar","Pa","atm","at","Torr","psi"],"pressure_unit"); this.addComboBox(["hPa","inHg","bar","Pa","kPa","atm","at","Torr","psi"],"pressure_unit");
this.addLabel(_("Position in Panel")); this.addLabel(_("Position in Panel"));
this.addComboBox([_("Center"),_("Right"),_("Left")],"position_in_panel"); this.addComboBox([_("Center"),_("Right"),_("Left")],"position_in_panel");
this.addLabel(_("Wind Direction by Arrows")); this.addLabel(_("Wind Direction by Arrows"));

Loading…
Cancel
Save