diff options
Diffstat (limited to 'desktop/sweetener/help.py')
-rw-r--r-- | desktop/sweetener/help.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/desktop/sweetener/help.py b/desktop/sweetener/help.py new file mode 100644 index 0000000..d214392 --- /dev/null +++ b/desktop/sweetener/help.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.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 +# 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 Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +from gettext import gettext as _ +import gtk + +import stock +from item import Item +from itemgroup import ItemGroup +import info + + +class AboutItem(Item): + def __init__(self, parent): + Item.__init__(self, gtk.STOCK_ABOUT) + self.parent = parent + + def do_activate(self): + dialog = gtk.AboutDialog() + dialog.set_name(info.name) + dialog.set_version(info.version) + dialog.set_transient_for(self.parent) + dialog.set_comments(info.description) + dialog.set_copyright(info.copyright) + dialog.set_website(info.url) + dialog.set_authors(info.authors) + dialog.set_license(info.license) + dialog.set_wrap_license(True) + dialog.set_logo_icon_name('graph-plotter') + dialog.run() + dialog.destroy() + + +class Help(ItemGroup): + def __init__(self, box): + title = gtk.stock_lookup(gtk.STOCK_HELP)[1] + ItemGroup.__init__(self, box, title, 'toolbar-help') + stock.register('sweetener-help-contents', _('Contents'), + 'F1', 'gtk-help') + contents = Item('sweetener-help-contents') + contents.connect('activate', lambda w: gtk.show_uri(None, + info.documentation, + gtk.get_current_event_time())) + self.append_item(contents) + about = AboutItem(box._parent) + self.append_item(about) |