diff options
author | Agustin Zubiaga <aguzubiaga97@gmail.com> | 2012-02-02 19:35:56 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguzubiaga97@gmail.com> | 2012-02-02 19:35:56 (GMT) |
commit | 57090e294249d20de98fc692163e82aa0813d64c (patch) | |
tree | 4844fa0fd8895585e210975db6ca18e89fc389f4 | |
parent | dabbcdd767db828f62a91897526bfea66cc44966 (diff) |
Small bugs fixed...
Changes:
* PieChart Button is now the default active button
* gettext bugs fixed
* pep8 & pylint fixes
Signed-off-by: Agustin Zubiaga <aguzubiaga97@gmail.com>
-rw-r--r-- | activity.py | 104 | ||||
-rw-r--r-- | charts.py | 5 | ||||
-rw-r--r-- | locale/SimpleGraph.pot | 82 | ||||
-rw-r--r-- | po/SimpleGraph.pot | 87 | ||||
-rw-r--r-- | po/es.po (renamed from locale/es/es.po) | 54 |
5 files changed, 178 insertions, 154 deletions
diff --git a/activity.py b/activity.py index eca4f46..4ba7af3 100644 --- a/activity.py +++ b/activity.py @@ -4,7 +4,7 @@ # activity.py by: # Agustin Zubiaga <aguz@sugarlabs.com> # Gonzalo Odiard <godiard@gmail.com> -# Manuel Quiñones <manuq@laptop.org> +# Manuel Quiñones <manuq@laptop.org> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,13 +27,8 @@ import os import gconf import logging -import gettext - -gettext.textdomain("SimpleGraph") -gettext.bindtextdomain("SimpleGraph", "./locale") - -_ = gettext.gettext +from gettext import gettext as _ from sugar.activity import activity from sugar.activity.widgets import ActivityToolbarButton @@ -150,7 +145,7 @@ class SimpleGraph(activity.Activity): add_vbar_chart.set_tooltip(_("Create a vertical bar chart")) add_vbar_chart.props.icon_name = "vbar" charts_group = add_vbar_chart - + toolbarbox.toolbar.insert(add_vbar_chart, -1) add_hbar_chart = RadioToolButton() @@ -172,12 +167,13 @@ class SimpleGraph(activity.Activity): add_pie_chart.set_tooltip(_("Create a pie chart")) add_pie_chart.props.icon_name = "pie" add_pie_chart.props.group = charts_group + add_pie_chart.set_active(True) toolbarbox.toolbar.insert(add_pie_chart, -1) - - self.chart_type_buttons = [add_vbar_chart, - add_hbar_chart, - add_line_chart, - add_pie_chart] + + self.chart_type_buttons = [add_vbar_chart, + add_hbar_chart, + add_line_chart, + add_pie_chart] separator = gtk.SeparatorToolItem() separator.set_draw(True) @@ -280,8 +276,8 @@ class SimpleGraph(activity.Activity): def _update_chart_labels(self): if self.current_chart is None: return - self.current_chart.set_x_label(self.x_label) - self.current_chart.set_y_label(self.y_label) + self.current_chart.set_x_label(self.x_label) + self.current_chart.set_y_label(self.y_label) self._render_chart() def update_chart(self): @@ -291,7 +287,7 @@ class SimpleGraph(activity.Activity): self.current_chart.set_x_label(self.x_label) self.current_chart.set_y_label(self.y_label) self.current_chart.connect("ready", lambda w, f: - self.charts_area.set_from_file(f)) + self.charts_area.set_from_file(f)) self._render_chart() def _label_changed(self, tw, path, new_label): @@ -306,19 +302,19 @@ class SimpleGraph(activity.Activity): def _set_h_label(self, options, label): self.x_label = label - self._update_chart_labels() + self._update_chart_labels() def _set_v_label(self, options, label): self.y_label = label - self._update_chart_labels() + self._update_chart_labels() def _set_chart_color(self, options, color): self.chart_color = color - self._render_chart() + self._render_chart() def _set_chart_line_color(self, options, color): self.chart_line_color = color - self._render_chart() + self._render_chart() def _save_as_image(self, widget): if self.current_chart: @@ -368,7 +364,7 @@ class SimpleGraph(activity.Activity): for line in jfile.readlines(): num += 1 - + if num != 7: num2 = 0 l = len(line) @@ -381,7 +377,7 @@ class SimpleGraph(activity.Activity): string += char line = string - + if num == 1: self.metadata["title"] = line @@ -395,13 +391,19 @@ class SimpleGraph(activity.Activity): elif num == 4: self.chart_color = line - self.options.chart_color.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(line)) - self.options.chart_color.modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.Color(line)) - + self.options.chart_color.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.Color(line)) + + self.options.chart_color.modify_bg(gtk.STATE_PRELIGHT, + gtk.gdk.Color(line)) + elif num == 5: self.chart_line_color = line - self.options.lines_color.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(line)) - self.options.lines_color.modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.Color(line)) + self.options.lines_color.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.Color(line)) + + self.options.lines_color.modify_bg(gtk.STATE_PRELIGHT, + gtk.gdk.Color(line)) elif num == 6: for x in line.split(","): @@ -411,16 +413,24 @@ class SimpleGraph(activity.Activity): value = float(data[1]) if data != ('',): self._add_value(None, label=label, value=value) - except: pass + except: + pass elif num == 7: type = line - - if type == "vbar": self.chart_type_buttons[0].set_active(True) - elif type == "hbar": self.chart_type_buttons[1].set_active(True) - elif type == "line": self.chart_type_buttons[2].set_active(True) - elif type == "pie": self.chart_type_buttons[3].set_active(True) - + + if type == "vbar": + self.chart_type_buttons[0].set_active(True) + + elif type == "hbar": + self.chart_type_buttons[1].set_active(True) + + elif type == "line": + self.chart_type_buttons[2].set_active(True) + + elif type == "pie": + self.chart_type_buttons[3].set_active(True) + self._add_chart_cb(None, type=type) jfile.close() @@ -466,11 +476,11 @@ class ChartData(gtk.TreeView): def add_value(self, label, value): iter = self.model.append([label, value]) - - self.set_cursor(self.model.get_path(iter), - self.get_column(1), - True) - + + self.set_cursor(self.model.get_path(iter), + self.get_column(1), + True) + logger.info("Added: %s, Value: %s" % (label, value)) def remove_selected_value(self): @@ -530,7 +540,7 @@ class Options(gtk.VBox): entry = gtk.Entry(max=0) entry.connect("changed", lambda w: self.emit("hlabel-changed", - w.get_text())) + w.get_text())) hbox.pack_end(entry, False, True, 5) self.hlabel_entry = entry @@ -543,7 +553,7 @@ class Options(gtk.VBox): entry = gtk.Entry(max=0) entry.connect("changed", lambda w: self.emit("vlabel-changed", - w.get_text())) + w.get_text())) hbox.pack_end(entry, False, True, 5) self.pack_start(hbox, False, True, 3) @@ -601,18 +611,22 @@ class Options(gtk.VBox): btn.set_property("tooltip-text", str(color).capitalize()) btn.color = gtk.gdk.Color(basic_colors[color]) btn.connect("clicked", lambda w: - selector.colorsel.set_current_color(w.color)) + selector.colorsel.set_current_color(w.color)) btn.modify_bg(gtk.STATE_NORMAL, btn.color) btn.modify_bg(gtk.STATE_PRELIGHT, btn.color) box.pack_start(btn, False, True, 1) selector.vbox.pack_end(box, False, True, 0) - selector.colorsel.set_current_color(gtk.gdk.Color(self.activity.chart_color)) + selector.colorsel.set_current_color( + gtk.gdk.Color(self.activity.chart_color)) + elif widget.id == 2: - selector.colorsel.set_current_color(gtk.gdk.Color(self.activity.chart_line_color)) + selector.colorsel.set_current_color( + gtk.gdk.Color(self.activity.chart_line_color)) selector.get_color_selection().connect("color-changed", - self._color_changed, widget) + self._color_changed, widget) + selector.ok_button.connect("clicked", lambda w: selector.destroy()) selector.cancel_button.destroy() selector.help_button.destroy() @@ -4,7 +4,7 @@ # charts.py by: # Agustin Zubiaga <aguzubiaga97@gmail.com> # Gonzalo Odiard <godiard@gmail.com> -# Manuel Quiñones <manuq@laptop.org> +# Manuel Quiñones <manuq@laptop.org> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -113,7 +113,8 @@ class Chart(gobject.GObject): self.options["legend"] = {"hide": "False"} chart = pycha.pie.PieChart(self.surface, self.options) print sg.chart_data - self.dataSet = [(data[0], [[0, data[1]]]) for data in sg.chart_data] + self.dataSet = [(data[0], + [[0, data[1]]]) for data in sg.chart_data] chart.addDataset(self.dataSet) chart.render() diff --git a/locale/SimpleGraph.pot b/locale/SimpleGraph.pot deleted file mode 100644 index b2f04f0..0000000 --- a/locale/SimpleGraph.pot +++ /dev/null @@ -1,82 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-02 00:07-0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: activity.py:112 -msgid "Save as image" -msgstr "" - -#: activity.py:127 -msgid "Add a value" -msgstr "" - -#: activity.py:133 -msgid "Remove the selected value" -msgstr "" - -#: activity.py:144 -msgid "Create a vertical bar chart" -msgstr "" - -#: activity.py:152 -msgid "Create a horizontal bar chart" -msgstr "" - -#: activity.py:159 -msgid "Create a line chart" -msgstr "" - -#: activity.py:166 -msgid "Create a pie chart" -msgstr "" - -#: activity.py:183 -msgid "Show or hide options" -msgstr "" - -#: activity.py:438 -msgid "Label" -msgstr "" - -#: activity.py:449 -msgid "Value" -msgstr "" - -#: activity.py:517 -msgid "Horizontal label:" -msgstr "" - -#: activity.py:530 -msgid "Vertical label:" -msgstr "" - -#: activity.py:543 -msgid "Chart color:" -msgstr "" - -#: activity.py:546 activity.py:563 -msgid "Color" -msgstr "" - -#: activity.py:558 -msgid "Lines Color:" -msgstr "" - -#: activity.py:580 -msgid "Color Selector" -msgstr "" diff --git a/po/SimpleGraph.pot b/po/SimpleGraph.pot new file mode 100644 index 0000000..b122f63 --- /dev/null +++ b/po/SimpleGraph.pot @@ -0,0 +1,87 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-02-02 17:19-0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: activity/activity.info:2 +msgid "SimpleGraph" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:113 +msgid "Save as image" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:128 +msgid "Add a value" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:134 +msgid "Remove the selected value" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:145 +msgid "Create a vertical bar chart" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:153 +msgid "Create a horizontal bar chart" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:160 +msgid "Create a line chart" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:167 +msgid "Create a pie chart" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:185 +msgid "Show or hide options" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:454 +msgid "Label" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:465 +msgid "Value" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:538 +msgid "Horizontal label:" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:551 +msgid "Vertical label:" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:564 +msgid "Chart color:" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:567 +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:584 +msgid "Color" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:579 +msgid "Lines Color:" +msgstr "" + +#: /home/agustin/Activities/SimpleGraph.activity/activity.py:601 +msgid "Color Selector" +msgstr "" diff --git a/locale/es/es.po b/po/es.po index eeaa587..fcedb75 100644 --- a/locale/es/es.po +++ b/po/es.po @@ -1,82 +1,86 @@ # Spanish translations for SimpleGraph. -# Traducciones al español para SimpleGraph. -# This file is distributed under license GPLv3+ +# This file is distributed under the GPLv3+ license # Agustin Zubiaga <aguz@sugarlabs.org>, 2012. # msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: 1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-02 00:07-0200\n" -"PO-Revision-Date: 2012-02-02 00:07-0200\n" +"POT-Creation-Date: 2012-02-02 17:19-0200\n" +"PO-Revision-Date: 2012-02-02 17:19-0200\n" "Last-Translator: Agustin Zubiaga <aguz@sugarlabs.org>\n" -"Language-Team: Spanish\n" -"Language: es_UY\n" +"Language-Team: Spanish <es@li.org>\n" +"Language: es\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: activity.py:112 +#: activity/activity.info:2 +msgid "SimpleGraph" +msgstr "SimpleGraph" + +#: activity.py:113 msgid "Save as image" msgstr "Guardar como una imagen" -#: activity.py:127 +#: activity.py:128 msgid "Add a value" msgstr "Agregar un valor" -#: activity.py:133 +#: activity.py:134 msgid "Remove the selected value" msgstr "Eliminar el valor seleccionado" -#: activity.py:144 +#: activity.py:145 msgid "Create a vertical bar chart" msgstr "Crear un grafico de barras verticales" -#: activity.py:152 +#: activity.py:153 msgid "Create a horizontal bar chart" msgstr "Crear un grafico de barras horizontales" -#: activity.py:159 +#: activity.py:160 msgid "Create a line chart" msgstr "Crear un grafico de lineas" -#: activity.py:166 +#: activity.py:167 msgid "Create a pie chart" -msgstr "Crear grafico torta" +msgstr "Crear un grafico torta" -#: activity.py:183 +#: activity.py:185 msgid "Show or hide options" msgstr "Mostrar o ocultar las opciones" -#: activity.py:438 +#: activity.py:454 msgid "Label" msgstr "Etiqueta" -#: activity.py:449 +#: activity.py:465 msgid "Value" msgstr "Valor" -#: activity.py:517 +#: activity.py:538 msgid "Horizontal label:" msgstr "Etiqueta horizontal:" -#: activity.py:530 +#: activity.py:551 msgid "Vertical label:" msgstr "Etiqueta vertical:" -#: activity.py:543 +#: activity.py:564 msgid "Chart color:" msgstr "Color del grafico:" -#: activity.py:546 activity.py:563 +#: activity.py:567 +#: activity.py:584 msgid "Color" msgstr "Color" -#: activity.py:558 +#: activity.py:579 msgid "Lines Color:" msgstr "Color de las lineas:" -#: activity.py:580 +#: activity.py:601 msgid "Color Selector" msgstr "Selector de colores" |