diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2012-02-16 05:30:50 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2012-02-16 05:30:50 (GMT) |
commit | 1c42ccbef2c58e007a56c2046033767f7713f9c6 (patch) | |
tree | 779c4b7c5405b2b8329729aee9997f6a811f86bb | |
parent | a55d02baa42af0d8740776eb1792e7166a5c1037 (diff) | |
parent | 7b1c84065d4ad2d16b02fb4fe9e024965dd69fad (diff) |
Merge branch 'master' of git.sugarlabs.org:simplegraph/simplegraph
-rw-r--r-- | activity.py | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/activity.py b/activity.py index 0f907e4..ee445ce 100644 --- a/activity.py +++ b/activity.py @@ -341,9 +341,11 @@ class SimpleGraph(activity.Activity): self.show_all() def _add_value(self, widget, label="", value="0.0"): - pos = self.labels_and_values.add_value(label, value) - self.chart_data.insert(pos, (label, float(value))) - self._update_chart_data() + data = (label, float(value)) + if not data in self.chart_data: + pos = self.labels_and_values.add_value(label, value) + self.chart_data.insert(pos, data) + self._update_chart_data() def _remove_value(self, widget): path = self.labels_and_values.remove_selected_value() @@ -485,47 +487,46 @@ class SimpleGraph(activity.Activity): return boolean, file_path, metadata['title'] def __import_stopwatch_cb(self, widget): - boolean, file_path, title = self._object_chooser( + boolean, file_path, title = self._object_chooser( STOPWATCH_MIME_TYPE, - "StopWatch") - - if boolean: - f = open(file_path) - reader = StopWatch(f) + _('StopWatch')) - stopwatchs_list, count = reader.get_stopwatchs_with_marks() + if boolean: + f = open(file_path) + reader = StopWatch(f) - self.labels_and_values.model.clear() - self.chart_data = [] + stopwatchs_list, count = reader.get_stopwatchs_with_marks() - self.v_label.entry.set_text("Time") + self.labels_and_values.model.clear() + self.chart_data = [] - if count == 1: - num, name = stopwatchs_list[0] + self.v_label.entry.set_text(_('Time')) - self.h_label.entry.set_text(_("Number")) + if count == 1: + num, name = stopwatchs_list[0] + self.h_label.entry.set_text(_('Mark')) - self.set_title(name) - chart_data = reader.marks_to_chart_data(num - 1) + self.set_title(name) + chart_data = reader.marks_to_chart_data(num - 1) - elif count == 0 or count > 1: - self.set_title(title) - self.h_label.entry.set_text(_("Names")) + elif count == 0 or count > 1: + self.set_title(title) + self.h_label.entry.set_text(_('StopWatch')) - chart_data = reader.times_to_chart_data() + chart_data = reader.times_to_chart_data() - # Load the data - for row in chart_data: - self._add_value(None, - label=row[0], value=float(row[1])) + # Load the data + for row in chart_data: + self._add_value(None, + label=row[0], value=float(row[1])) - self.update_chart() + self.update_chart() - f.close() + f.close() def __import_measure_cb(self, widget): boolean, file_path, title = self._object_chooser(CSV_MIME_TYPE, - 'Measure') + _('Measure')) if boolean: f = open(file_path) |