diff options
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/activity.py b/activity.py index 762d04f..85b5a40 100644 --- a/activity.py +++ b/activity.py @@ -47,11 +47,11 @@ from sugar3.graphics.icon import Icon from sugar3.graphics.alert import Alert from sugar3.datastore import datastore -from charts import Chart from readers import StopWatchReader from readers import MeasureReader from readers import ClipboardReader import charthelp +import chart # Mime types _STOPWATCH_MIME_TYPE = 'application/x-stopwatch-activity' @@ -189,7 +189,8 @@ class ChartActivity(activity.Activity): toolbarbox.toolbar.insert(separator, -1) add_vbar_chart = RadioToolButton() - add_vbar_chart.connect('clicked', self._add_chart_cb, 'vbar') + add_vbar_chart.connect('clicked', self._add_chart_cb, + chart.VERTICAL_BAR) add_vbar_chart.set_tooltip(_('Vertical Bar Chart')) add_vbar_chart.props.icon_name = 'vbar' charts_group = add_vbar_chart @@ -197,21 +198,22 @@ class ChartActivity(activity.Activity): toolbarbox.toolbar.insert(add_vbar_chart, -1) add_hbar_chart = RadioToolButton() - add_hbar_chart.connect('clicked', self._add_chart_cb, 'hbar') + add_hbar_chart.connect('clicked', self._add_chart_cb, + chart.HORIZONTAL_BAR) add_hbar_chart.set_tooltip(_('Horizontal Bar Chart')) add_hbar_chart.props.icon_name = 'hbar' add_hbar_chart.props.group = charts_group toolbarbox.toolbar.insert(add_hbar_chart, -1) add_line_chart = RadioToolButton() - add_line_chart.connect('clicked', self._add_chart_cb, 'line') + add_line_chart.connect('clicked', self._add_chart_cb, chart.LINE) add_line_chart.set_tooltip(_('Line Chart')) add_line_chart.props.icon_name = 'line' add_line_chart.props.group = charts_group toolbarbox.toolbar.insert(add_line_chart, -1) add_pie_chart = RadioToolButton() - add_pie_chart.connect('clicked', self._add_chart_cb, 'pie') + add_pie_chart.connect('clicked', self._add_chart_cb, chart.PIE) add_pie_chart.set_tooltip(_('Pie Chart')) add_pie_chart.props.icon_name = 'pie' add_pie_chart.props.group = charts_group @@ -389,8 +391,8 @@ class ChartActivity(activity.Activity): self.chart_data.remove(value) self._update_chart_data() - def _add_chart_cb(self, widget, type='vbar'): - self.current_chart = Chart(type) + def _add_chart_cb(self, widget, type=chart.VERTICAL_BAR): + self.current_chart = chart.Chart(type) self.update_chart() @@ -431,7 +433,7 @@ class ChartActivity(activity.Activity): self.current_chart.set_color_scheme(color=self.chart_color) self.current_chart.set_line_color(self.chart_line_color) - if self.current_chart.type == 'pie': + if self.current_chart.type == chart.PIE: self.current_chart.render(self) else: self.current_chart.render() @@ -619,16 +621,16 @@ class ChartActivity(activity.Activity): # Update charts buttons _type = data['current_chart.type'] - if _type == 'vbar': + if _type == chart.VERTICAL_BAR: self.chart_type_buttons[0].set_active(True) - elif _type == 'hbar': + elif _type == chart.HORIZONTAL_BAR: self.chart_type_buttons[1].set_active(True) - elif _type == 'line': + elif _type == chart.LINE: self.chart_type_buttons[2].set_active(True) - elif _type == 'pie': + elif _type == chart.PIE: self.chart_type_buttons[3].set_active(True) # Update the controls in the config subtoolbar |