self.steps = steps
self.calories = calories
self.dist = dist
- self.unit = unit
def __add__(self, other):
return PedoValues(self.time + other.time,
return strtime
def get_print_distance(self):
+ global unit
if self.dist > 1000:
- if self.unit == 0:
+ if unit == 0:
return "%.2f km" % (self.dist / 1000)
else:
return "%.2f mi" % (self.dist / 1609.344)
else:
- if self.unit == 0:
+ if unit == 0:
return "%d m" % self.dist
else:
return "%d ft" % int(self.dist * 3.2808)
def get_avg_speed(self):
+ global unit
conv = 0
- if self.unit:
+ if unit:
conv = 2.23693629
else:
conv = 3.6
return speed * conv
def get_print_avg_speed(self):
+ global unit
suffix = ""
conv = 0
- if self.unit:
+ if unit:
suffix = "mi/h"
conv = 2.23693629
else:
def reset_all_values(self):
self.repository.reset_values()
+ self.v[0] = PedoValues()
+ self.v[1] = PedoValues()
self.notify()
def stop_pedometer(self):
def set_mode(self, mode):
self.mode = mode
self.set_height(self.height_interval)
+ self.pedometerInterval.set_mode(self.mode)
self.notify()
def set_unit(self, new_unit):
self.unit = new_unit
+ global unit
unit = new_unit
+ self.notify()
def get_str_weight_unit(self):
if self.unit == 0:
else:
self.controller.start_pedometer()
self.button.set_icon(ICONSPATH + "stop.png")
+ hildon.hildon_banner_show_information(self, "None", "Keep the N900 in a pocket close to your hip for best results")
def do_expose_event(self, event):
cr = self.window.cairo_create()