self.pedometer.start()
self.notify(True)
+ def reset_all_values(self):
+ self.repository.reset_values()
+ self.notify()
+
def stop_pedometer(self):
self.is_running = False
self.pedometer.request_stop()
logger.error("ERROR: %s, %s" % (err, debug) )
def update(self, optional):
- print "alarm update"
diff = self.pedo_controller.get_first() - self.start_value
if self.type == 0 and diff.time >= self.interval * 60 or \
self.type == 1 and diff.steps >= self.interval or \
self.graph = graph
eventBoxGraph.connect("button-press-event", self.eventBoxGraph_clicked)
eventBoxGraph.connect("button-release-event", self.eventBoxGraph_clicked_release)
+ self.graphBox = eventBoxGraph
self.mainvbox = gtk.VBox()
new_labels[label] = l
def update_aspect(self):
- if self.aspect == 0:
+
+ if self.aspect > 0:
+ self.graphBox.hide_all()
+ else:
+ self.graphBox.show_all()
+
+ if self.aspect == 0 or self.aspect == 1:
self.currentBox.show_all()
self.totalBox.show_all()
- elif self.aspect == 1:
+ elif self.aspect == 2:
self.currentBox.show_all()
self.totalBox.hide_all()
else:
self.currentBox.hide_all()
self.totalBox.show_all()
+ x,y = self.size_request()
+ self.resize(x,y)
+
def update_ui_values(self, labels, values):
labels["timer"].set_label(values.get_print_time())
labels["count"].set_label(values.get_print_steps())
def show_settings(self, widget):
def reset_total_counter(arg):
- widget.totalCounter = 0
- widget.totalTime = 0
- widget.update_total()
- hildon.hildon_banner_show_information(self, "None", "Total counter was resetted")
+ note = hildon.hildon_note_new_confirmation(self.dialog, "Are you sure you want to delete all your pedometer history?")
+ ret = note.run()
+ if ret == gtk.RESPONSE_OK:
+ self.controller.reset_all_values()
+ hildon.hildon_banner_show_information(self, "None", "All history was deleted")
+ note.destroy()
def alarmButton_pressed(widget):
self.show_alarm_settings(widget)
dialog = gtk.Dialog()
dialog.set_title("Settings")
dialog.add_button("OK", gtk.RESPONSE_OK)
+ self.dialog = dialog
-
- button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
- button.set_title("Reset total counter")
- button.set_alignment(0, 0.8, 1, 1)
- button.connect("clicked", reset_total_counter)
+ resetButton = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
+ resetButton.set_title("Reset total counter")
+ resetButton.set_alignment(0, 0.8, 1, 1)
+ resetButton.connect("clicked", reset_total_counter)
alarmButton = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
alarmButton.set_title("Alarm")
selectorUI = hildon.TouchSelector(text=True)
selectorUI = hildon.TouchSelector(text=True)
selectorUI.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_SINGLE)
+ selectorUI.append_text("Show current + total + graph")
selectorUI.append_text("Show current + total")
selectorUI.append_text("Show only current")
selectorUI.append_text("Show only total")
pan_area = hildon.PannableArea()
vbox = gtk.VBox()
- vbox.add(button)
vbox.add(alarmButton)
vbox.add(modePicker)
vbox.add(heightPicker)
vbox.add(unitPicker)
vbox.add(UIPicker)
vbox.add(idleButton)
+ vbox.add(resetButton)
#vbox.add(logButton)
pan_area.add_with_viewport(vbox)
hd_plugin_type = PedometerHomePlugin
-# The code below is just for testing purposes.
-# It allows to run the widget as a standalone process.
-if __name__ == "__main__":
- import gobject
- gobject.type_register(hd_plugin_type)
- obj = gobject.new(hd_plugin_type, plugin_id="plugin_id")
- obj.show_all()
- gtk.main()
-
-############### old pedometer.py ###
import math
import logging
ch.setFormatter(formatter)
logger.addHandler(ch)
+# The code below is just for testing purposes.
+# It allows to run the widget as a standalone process.
+if __name__ == "__main__":
+ import gobject
+ gobject.type_register(hd_plugin_type)
+ obj = gobject.new(hd_plugin_type, plugin_id="plugin_id")
+ obj.show_all()
+ gtk.main()