Beispiel #1
0
 def percent_changed_cb(self, widget, name, number_widget):
     if self.changing_percent_internally: return
     v = widget.get_value()
     if not v: return
     if number_widget:
         rda = RECOMMENDED_INTAKE.get(name, None) * 2000
         if rda:
             self.changing_number_internally = True
             number_widget.set_value(v * 0.01 * rda)
             self.changing_number_internally = False
Beispiel #2
0
 def number_changed_cb (self, widget, name, percent_widget):
     v = widget.get_value()
     self.nutrition_info[name]=v
     if not v: return
     if self.changing_number_internally: return
     if percent_widget:
         rda = RECOMMENDED_INTAKE.get(name,None)*2000
         if rda:
             self.changing_percent_internally = True
             percent_widget.set_value((float(v)/rda)*100)
             self.changing_percent_internally = False
Beispiel #3
0
 def percent_changed_cb (self, widget, name, number_widget):
     if self.changing_percent_internally: return
     v = widget.get_value()
     if not v: return
     if number_widget:
         rda = RECOMMENDED_INTAKE.get(name,None)*2000
         if rda:
             self.changing_number_internally = True
             number_widget.set_value(
                 v*0.01*rda
                 )
             self.changing_number_internally = False