Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2008-08-26 20:14:55 (GMT)
committer Daniel Drake <dsd@laptop.org>2008-08-28 16:47:27 (GMT)
commit666ff47a8fb3989544a517a009d805e7bcd94e48 (patch)
tree048370540758143321613c491082dfa2e1fe7257
parente9ec0b193ec70d11249c344bab592932a9979cca (diff)
Control panel: include copyright/licensing info in about dialog
Ticket #6929: Include version number, copyright and license details in "About XO" dialog.
-rw-r--r--src/controlpanel/model/aboutxo.py24
-rw-r--r--src/controlpanel/view/aboutxo.py89
2 files changed, 107 insertions, 6 deletions
diff --git a/src/controlpanel/model/aboutxo.py b/src/controlpanel/model/aboutxo.py
index 5d17cca..10815ef 100644
--- a/src/controlpanel/model/aboutxo.py
+++ b/src/controlpanel/model/aboutxo.py
@@ -75,3 +75,27 @@ def _read_file(path):
else:
_logger.debug('No information in file or directory: %s' % path)
return None
+
+def get_license():
+ license_file = "/usr/share/licenses/common-licenses/GPL-2"
+ lang = os.environ['LANG']
+ if lang.endswith("UTF-8"):
+ lang = lang[:-6]
+
+ try_file = license_file + "." + lang
+ if os.path.isfile(try_file):
+ license_file = try_file
+ else:
+ try_file = license_file + "." + lang.split("_")[0]
+ if os.path.isfile(try_file):
+ license_file = try_file
+
+ try:
+ fd = open(license_file)
+ # remove 0x0c page breaks which can't be rendered in text views
+ license_text = fd.read().replace('\x0c', '')
+ fd.close()
+ except IOError:
+ license_text = _not_available
+ return license_text
+
diff --git a/src/controlpanel/view/aboutxo.py b/src/controlpanel/view/aboutxo.py
index 04833f0..783f7fc 100644
--- a/src/controlpanel/view/aboutxo.py
+++ b/src/controlpanel/view/aboutxo.py
@@ -1,3 +1,4 @@
+# coding=utf-8
# Copyright (C) 2008, OLPC
#
# This program is free software; you can redistribute it and/or modify
@@ -17,6 +18,7 @@
import gtk
from gettext import gettext as _
+import config
from sugar.graphics import style
from controlpanel.sectionview import SectionView
@@ -36,17 +38,27 @@ class AboutXO(SectionView):
self._group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
+ scrollwindow = gtk.ScrolledWindow()
+ scrollwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
+ self.pack_start(scrollwindow, expand=True)
+ scrollwindow.show()
+
+ self._vbox = gtk.VBox()
+ scrollwindow.add_with_viewport(self._vbox)
+ self._vbox.show()
+
self._setup_identity()
self._setup_software()
+ self._setup_copyright()
def _setup_identity(self):
separator_identity = gtk.HSeparator()
- self.pack_start(separator_identity, expand=False)
+ self._vbox.pack_start(separator_identity, expand=False)
separator_identity.show()
label_identity = gtk.Label(_('Identity'))
label_identity.set_alignment(0, 0)
- self.pack_start(label_identity, expand=False)
+ self._vbox.pack_start(label_identity, expand=False)
label_identity.show()
vbox_identity = gtk.VBox()
vbox_identity.set_border_width(style.DEFAULT_SPACING * 2)
@@ -67,18 +79,18 @@ class AboutXO(SectionView):
vbox_identity.pack_start(box_identity, expand=False)
box_identity.show()
- self.pack_start(vbox_identity, expand=False)
+ self._vbox.pack_start(vbox_identity, expand=False)
vbox_identity.show()
def _setup_software(self):
separator_software = gtk.HSeparator()
- self.pack_start(separator_software, expand=False)
+ self._vbox.pack_start(separator_software, expand=False)
separator_software.show()
label_software = gtk.Label(_('Software'))
label_software.set_alignment(0, 0)
- self.pack_start(label_software, expand=False)
+ self._vbox.pack_start(label_software, expand=False)
label_software.show()
box_software = gtk.VBox()
box_software.set_border_width(style.DEFAULT_SPACING * 2)
@@ -99,6 +111,21 @@ class AboutXO(SectionView):
box_software.pack_start(box_build, expand=False)
box_build.show()
+ box_sugar = gtk.HBox(spacing=style.DEFAULT_SPACING)
+ label_sugar = gtk.Label(_('Sugar:'))
+ label_sugar.set_alignment(1, 0)
+ label_sugar.modify_fg(gtk.STATE_NORMAL,
+ style.COLOR_SELECTION_GREY.get_gdk_color())
+ box_sugar.pack_start(label_sugar, expand=False)
+ self._group.add_widget(label_sugar)
+ label_sugar.show()
+ label_sugar_ver = gtk.Label(config.version)
+ label_sugar_ver.set_alignment(0, 0)
+ box_sugar.pack_start(label_sugar_ver, expand=False)
+ label_sugar_ver.show()
+ box_software.pack_start(box_sugar, expand=False)
+ box_sugar.show()
+
box_firmware = gtk.HBox(spacing=style.DEFAULT_SPACING)
label_firmware = gtk.Label(_('Firmware:'))
label_firmware.set_alignment(1, 0)
@@ -114,5 +141,55 @@ class AboutXO(SectionView):
box_software.pack_start(box_firmware, expand=False)
box_firmware.show()
- self.pack_start(box_software, expand=False)
+ self._vbox.pack_start(box_software, expand=False)
box_software.show()
+
+ def _setup_copyright(self):
+ separator_copyright = gtk.HSeparator()
+ self._vbox.pack_start(separator_copyright, expand=False)
+ separator_copyright.show()
+
+ label_copyright = gtk.Label(_('Copyright and License'))
+ label_copyright.set_alignment(0, 0)
+ self._vbox.pack_start(label_copyright, expand=False)
+ label_copyright.show()
+ vbox_copyright = gtk.VBox()
+ vbox_copyright.set_border_width(style.DEFAULT_SPACING * 2)
+ vbox_copyright.set_spacing(style.DEFAULT_SPACING)
+
+ label_copyright = gtk.Label(_("© 2008 One Laptop per Child Assocation "
+ + "Inc; Red Hat, Inc; and Contributors."))
+ label_copyright.set_alignment(0, 0)
+ label_copyright.show()
+ vbox_copyright.pack_start(label_copyright, expand=False)
+
+ label_info = gtk.Label(_("Sugar is the graphical user interface that "
+ + "you are looking at. Sugar is free software, covered by the "
+ + "GNU General Public License, and you are welcome to change it "
+ + "and/or distribute copies of it under certain conditions "
+ + "described therein."))
+ label_info.set_alignment(0, 0)
+ label_info.set_line_wrap(True)
+ label_info.set_size_request(gtk.gdk.screen_width() / 2, -1)
+ label_info.show()
+ vbox_copyright.pack_start(label_info, expand=False)
+
+ expander = gtk.Expander(_("Full license:"))
+ expander.connect("notify::expanded", self.license_expander_cb)
+ expander.show()
+ vbox_copyright.pack_start(expander, expand=True)
+
+ self._vbox.pack_start(vbox_copyright, expand=True)
+ vbox_copyright.show()
+
+ def license_expander_cb(self, expander, param_spec):
+ # load/destroy the license viewer on-demand, to avoid storing the
+ # GPL in memory at all times
+ if expander.get_expanded():
+ view_license = gtk.TextView()
+ view_license.set_editable(False)
+ view_license.get_buffer().set_text(self._model.get_license())
+ view_license.show()
+ expander.add(view_license)
+ else:
+ expander.get_child().destroy()