Fix bug #5347 - Weight button showing wrong unit
[pedometerwidget] / src / usr / lib / hildon-desktop / pedometer_widget_home.py
index 293d592..586690c 100644 (file)
@@ -1406,6 +1406,7 @@ class PedometerHomePlugin(hildondesktop.HomePluginItem):
                 self.heightPicker_English.show()
                 self.heightPicker.hide()
 
+            update_weight_button()
 
         def selectorUI_changed(selector, data):
             widget.aspect = selectorUI.get_active(0)
@@ -1421,6 +1422,10 @@ class PedometerHomePlugin(hildondesktop.HomePluginItem):
             widget.client.set_bool(NOIDLETIME, widget.no_idle_time)
             widget.controller.set_no_idle_time(widget.no_idle_time)
 
+        def update_weight_button():
+            weightButton.set_value(str(self.controller.get_weight()) + \
+                                           " " + self.controller.get_str_weight_unit() )
+
         def weight_dialog(button):
             dialog = gtk.Dialog("Weight", self.dialog)
             dialog.add_button("OK", gtk.RESPONSE_OK)
@@ -1448,8 +1453,7 @@ class PedometerHomePlugin(hildondesktop.HomePluginItem):
                         raise ValueError
                     self.controller.set_weight(value)
                     self.client.set_int(WEIGHT, value)
-                    weightButton.set_value(str(self.controller.get_weight()) + \
-                                           " " + self.controller.get_str_weight_unit() )
+                    update_weight_button()
                     break
                 except:
                     hildon.hildon_banner_show_information(self, "None", "Invalid weight")