Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activity.py
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2012-03-09 13:59:14 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-03-09 13:59:14 (GMT)
commit7bfe9246498b483495f163536ff9f1f3385211f6 (patch)
tree8ab8e423c8a6a4f4e8fd35e8d1e4a3d2b9889d34 /activity.py
parent0d488062920a9e84aee8d695ac261455bf2b154d (diff)
Choose measure channel
Diffstat (limited to 'activity.py')
-rw-r--r--activity.py31
1 files changed, 28 insertions, 3 deletions
diff --git a/activity.py b/activity.py
index a9c0844..cee3b06 100644
--- a/activity.py
+++ b/activity.py
@@ -135,12 +135,16 @@ class SimpleGraph(activity.Activity):
import_stopwatch = ToolButton("import-stopwatch")
import_stopwatch.connect("clicked", self.__import_stopwatch_cb)
+ import_stopwatch.set_tooltip(_("Read StopWatch data"))
activity_btn_toolbar.insert(import_stopwatch, -1)
import_stopwatch.show()
import_measure = ToolButton("import-measure")
- import_measure.connect("clicked", self.__import_measure_cb)
+ import_measure.set_tooltip(_("Read Measure data"))
+ import_measure.connect("clicked", self._measure_btn_clicked)
+ self._create_measure_palette(import_measure)
+
activity_btn_toolbar.insert(import_measure, -1)
import_measure.show()
@@ -319,6 +323,27 @@ class SimpleGraph(activity.Activity):
self.show_all()
+ def _create_measure_palette(self, button):
+ palette = button.get_palette()
+ hbox = gtk.HBox()
+
+ channel1 = ToolButton("measure-channel-1")
+ channel1.connect("clicked", self.__import_measure_cb, 1)
+
+ channel2 = ToolButton("measure-channel-2")
+ channel2.connect("clicked", self.__import_measure_cb, 2)
+
+ hbox.pack_start(channel1, False, True, 0)
+ hbox.pack_end(channel2, False, True, 0)
+
+ hbox.show_all()
+
+ palette.set_content(hbox)
+
+ def _measure_btn_clicked(self, button):
+ palette = button.get_palette()
+ palette.popup()
+
def _add_value(self, widget, label="", value="0.0"):
data = (label, float(value))
if not data in self.chart_data:
@@ -507,14 +532,14 @@ class SimpleGraph(activity.Activity):
f.close()
- def __import_measure_cb(self, widget):
+ def __import_measure_cb(self, widget, channel=1):
matches_mime_type, file_path, title = self._object_chooser(
_CSV_MIME_TYPE,
_('Measure'))
if matches_mime_type:
f = open(file_path)
- reader = MeasureReader(f)
+ reader = MeasureReader(f, channel)
self._graph_from_reader(reader)
f.close()