""" 'Help' and 'About' information.""" # Copyright (C) 2012-2013 S. Daniel Francis # # 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 _ from gi.repository 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(info.lower_name) dialog.run() dialog.destroy() class Help(ItemGroup): """ This class makes the help menu on desktops and a HelpButton on Sugar. """ def __init__(self, box): """Constructor. box -- sweetener.ItemBox where append it """ title = stock.get_label(Gtk.STOCK_HELP, False) ItemGroup.__init__(self, box, title, 'toolbar-help') stock.register('sweetener-help-contents', title, '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)