diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-03-08 04:35:57 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-03-08 04:35:57 (GMT) |
commit | e3550251ada8e4651830d24ff8821ece805cb734 (patch) | |
tree | 880461206eafb58139a2d60b643e561a1460e485 | |
parent | 05e3bf734aa58156fdb642d7ad2095871d214d8b (diff) |
Add help
Changes:
* Use Gonzalo's helpbutton
* Add help icon
* Update .pot
Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
-rw-r--r-- | activity.py | 13 | ||||
-rw-r--r-- | help.py | 17 | ||||
-rw-r--r-- | helpbutton.py | 84 | ||||
-rw-r--r-- | icons/help-icon.svg | 14 | ||||
-rw-r--r-- | po/AnalyzeJournal.pot | 50 |
5 files changed, 161 insertions, 17 deletions
diff --git a/activity.py b/activity.py index a1c9679..485b4e3 100644 --- a/activity.py +++ b/activity.py @@ -36,6 +36,7 @@ from sugar.graphics.toolbarbox import ToolbarBox from sugar.graphics.toolbutton import ToolButton from sugar.graphics.icon import Icon +import help import utils from charts import Chart @@ -81,6 +82,8 @@ class AnalyzeJournal(activity.Activity): separator.set_expand(True) toolbarbox.toolbar.insert(separator, -1) + help.create_help(toolbarbox.toolbar) + stopbtn = StopButton(self) toolbarbox.toolbar.insert(stopbtn, -1) @@ -132,16 +135,16 @@ class AnalyzeJournal(activity.Activity): used_space = self._get_GBs(used_space) u_type = 'GBs' - t = _('<span foreground="%s"><b>%s</b></span>' % \ - (_FILL_COLOR, self._get_info_string('t'))) + t = '<span foreground="%s"><b>%s</b></span>' % \ + (_FILL_COLOR, self._get_info_string('t')) - ts = _('<span foreground="%s"><b>%s</b></span> %s %s') % \ + ts = '<span foreground="%s"><b>%s</b></span> %s %s' % \ (_STROKE_COLOR, self._get_info_string('ts'), total_space, t_type) - us = _('<span foreground="%s"><b>%s</b></span> %s %s') % \ + us = '<span foreground="%s"><b>%s</b></span> %s %s' % \ (_STROKE_COLOR, self._get_info_string('us'), used_space, u_type) - fs = _('<span foreground="%s"><b>%s</b></span> %s %s') % \ + fs = '<span foreground="%s"><b>%s</b></span> %s %s' % \ (_STROKE_COLOR, self._get_info_string('fs'), free_space, f_type) info = t + '\n' + ts + '\n' + us + '\n' + fs @@ -0,0 +1,17 @@ +# Help for AnalizeJournal + +from gettext import gettext as _ + +from helpbutton import HelpButton + + +def create_help(toolbar): + helpitem = HelpButton() + toolbar.insert(helpitem, -1) + helpitem.add_section(_('Description')) + helpitem.add_paragraph(_('This activity gives you the possibility to graphically, the journal usage')) + helpitem.add_section(_('Usage')) + helpitem.add_paragraph(_('In the area you can view the info')) + helpitem.add_paragraph(_('You can update the data with this button'), + 'gtk-refresh') + helpitem.show() diff --git a/helpbutton.py b/helpbutton.py new file mode 100644 index 0000000..f27af70 --- /dev/null +++ b/helpbutton.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2012, Gonzalo Odiard <godiard@gmail.com> + +# 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 +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# HelpButton widget + +from gettext import gettext as _ + +import gtk + +from sugar.graphics.toolbutton import ToolButton +from sugar.graphics.icon import Icon +from sugar.graphics import style + + +class HelpButton(gtk.ToolItem): + + def __init__(self, **kwargs): + gtk.ToolItem.__init__(self) + + help_button = ToolButton('help-icon') + help_button.set_tooltip(_('Help')) + self.add(help_button) + + self._palette = help_button.get_palette() + + sw = gtk.ScrolledWindow() + sw.set_size_request(int(gtk.gdk.screen_width() / 3), + gtk.gdk.screen_height() - style.GRID_CELL_SIZE * 3) + sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) + + self._max_text_width = int(gtk.gdk.screen_width() / 3) - 20 + self._vbox = gtk.VBox() + self._vbox.set_homogeneous(False) + sw.add_with_viewport(self._vbox) + + self._palette.set_content(sw) + sw.show_all() + + help_button.connect('clicked', self.__help_button_clicked_cb) + + def __help_button_clicked_cb(self, button): + self._palette.popup(immediate=True, state=1) + + def add_section(self, section_text): + hbox = gtk.HBox() + label = gtk.Label() + label.set_use_markup(True) + label.set_markup('<b>%s</b>' % section_text) + label.set_line_wrap(True) + label.set_size_request(self._max_text_width, -1) + hbox.add(label) + hbox.show_all() + self._vbox.pack_start(hbox, False, False, padding=5) + + def add_paragraph(self, text, icon=None): + hbox = gtk.HBox() + label = gtk.Label(text) + label.set_justify(gtk.JUSTIFY_LEFT) + label.set_line_wrap(True) + hbox.add(label) + if icon is not None: + _icon = Icon(icon_name=icon) + hbox.add(_icon) + label.set_size_request(self._max_text_width - 20, -1) + else: + label.set_size_request(self._max_text_width, -1) + + hbox.show_all() + self._vbox.pack_start(hbox, False, False, padding=5) diff --git a/icons/help-icon.svg b/icons/help-icon.svg new file mode 100644 index 0000000..f6c92bf --- /dev/null +++ b/icons/help-icon.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55px" height="55px"> + <path + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linejoin:round" + d="M 48,28 A 20,20 0 1 1 8,28 A 20,20 0 1 1 48,28 z"/> + <path + style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:round" + d="M 22,20 C 22,20 25,17 29,17 C 33,17 36,19 36,23 C 36,27 31,29 28,29 L 28,32" /> + <path + style="fill:#ffffff" + d="M 25,40 + a 3,3 0 1 1 6,0 + a 3,3 0 1 1 -6,0 z" /> +</svg> diff --git a/po/AnalyzeJournal.pot b/po/AnalyzeJournal.pot index 6bb62fb..18118e5 100644 --- a/po/AnalyzeJournal.pot +++ b/po/AnalyzeJournal.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-02-24 22:11-0200\n" +"POT-Creation-Date: 2012-03-08 02:34-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" @@ -21,25 +21,51 @@ msgstr "" msgid "Analyze Journal" msgstr "" -#: activity.py:97 +#: helpbutton.py:36 +msgid "Help" +msgstr "" + +#: help.py:11 +msgid "Description" +msgstr "" + +#: help.py:12 +msgid "" +"This activity gives you the possibility to graphically, the journal usage" +msgstr "" + +#: help.py:13 +msgid "Usage" +msgstr "" + +#: help.py:14 +msgid "In the area you can view the info" +msgstr "" + +#: help.py:15 +msgid "You can update the data with this button" +msgstr "" + +#: activity.py:114 msgid "Free" msgstr "" -#: activity.py:98 +#: activity.py:115 msgid "Used" msgstr "" -#: activity.py:121 -#, python-format -msgid "Total space: %s %s" +#: activity.py:158 +msgid "Info:" +msgstr "" + +#: activity.py:161 +msgid "Total space:" msgstr "" -#: activity.py:122 -#, python-format -msgid "Used space: %s %s" +#: activity.py:164 +msgid "Used space:" msgstr "" -#: activity.py:123 -#, python-format -msgid "Free space: %s %s" +#: activity.py:167 +msgid "Free space:" msgstr "" |