diff -u -r -N sugar-0.88.1.original/bin/sugar-session sugar-0.88.1/bin/sugar-session --- sugar-0.88.1.original/bin/sugar-session 2010-06-02 09:33:43.000000000 -0300 +++ sugar-0.88.1/bin/sugar-session 2010-07-27 11:45:05.234753203 -0300 @@ -1,6 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2006, Red Hat, Inc. # Copyright (C) 2009, One Laptop Per Child Association Inc +# Copyright (C) 2010, Plan Ceibal # # 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 @@ -190,6 +191,7 @@ gobject.idle_add(setup_notification_service_cb) gobject.idle_add(setup_file_transfer_cb) gobject.idle_add(show_software_updates_cb) + gobject.idle_add(setup_accessibility_cb) if sys.modules.has_key('xklavier'): gobject.idle_add(setup_keyboard_cb) @@ -201,6 +203,11 @@ settings = gtk.settings_get_default() settings.set_property("gtk-font-name", "%s %f" % (face, size)) +def setup_accessibility_cb(): + from jarabe.model import accessibility + accessibility_manager = accessibility.AccessibilityManager() + accessibility_manager.setup_accessibility() + def main(): try: from sugar import env diff -u -r -N sugar-0.88.1.original/configure.ac sugar-0.88.1/configure.ac --- sugar-0.88.1.original/configure.ac 2010-07-27 10:55:39.737753575 -0300 +++ sugar-0.88.1/configure.ac 2010-07-27 11:45:05.234753203 -0300 @@ -50,6 +50,7 @@ data/Makefile data/sugar-emulator.desktop extensions/cpsection/aboutcomputer/Makefile +extensions/cpsection/accessibility/Makefile extensions/cpsection/aboutme/Makefile extensions/cpsection/datetime/Makefile extensions/cpsection/frame/Makefile diff -u -r -N sugar-0.88.1.original/data/icons/Makefile.am sugar-0.88.1/data/icons/Makefile.am --- sugar-0.88.1.original/data/icons/Makefile.am 2010-07-27 10:55:39.737753575 -0300 +++ sugar-0.88.1/data/icons/Makefile.am 2010-07-27 11:46:12.610754773 -0300 @@ -3,6 +3,7 @@ sugar_DATA = \ module-about_me.svg \ module-about_my_computer.svg \ + module-accessibility.svg \ module-date_and_time.svg \ module-frame.svg \ module-keyboard.svg \ diff -u -r -N sugar-0.88.1.original/data/icons/module-accessibility.svg sugar-0.88.1/data/icons/module-accessibility.svg --- sugar-0.88.1.original/data/icons/module-accessibility.svg 1969-12-31 21:00:00.000000000 -0300 +++ sugar-0.88.1/data/icons/module-accessibility.svg 2010-07-27 11:45:05.235763039 -0300 @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + diff -u -r -N sugar-0.88.1.original/extensions/cpsection/accessibility/__init__.py sugar-0.88.1/extensions/cpsection/accessibility/__init__.py --- sugar-0.88.1.original/extensions/cpsection/accessibility/__init__.py 1969-12-31 21:00:00.000000000 -0300 +++ sugar-0.88.1/extensions/cpsection/accessibility/__init__.py 2010-07-27 11:45:05.235763039 -0300 @@ -0,0 +1,25 @@ +# Copyright (C) 2010 Plan Ceibal +# +# Author: Esteban Arias +# Contact information: comunidad@plan.ceibal.edu.uy +# Plan Ceibal http://www.ceibal.edu.uy +# +# 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, see . + +from gettext import gettext as _ + +CLASS = 'accessibility' +ICON = 'module-accessibility' +TITLE = _('Accessibility') + diff -u -r -N sugar-0.88.1.original/extensions/cpsection/accessibility/Makefile.am sugar-0.88.1/extensions/cpsection/accessibility/Makefile.am --- sugar-0.88.1.original/extensions/cpsection/accessibility/Makefile.am 1969-12-31 21:00:00.000000000 -0300 +++ sugar-0.88.1/extensions/cpsection/accessibility/Makefile.am 2010-07-27 11:45:05.236504055 -0300 @@ -0,0 +1,6 @@ +sugardir = $(pkgdatadir)/extensions/cpsection/accessibility + +sugar_PYTHON = \ + __init__.py \ + model.py \ + view.py diff -u -r -N sugar-0.88.1.original/extensions/cpsection/accessibility/model.py sugar-0.88.1/extensions/cpsection/accessibility/model.py --- sugar-0.88.1.original/extensions/cpsection/accessibility/model.py 1969-12-31 21:00:00.000000000 -0300 +++ sugar-0.88.1/extensions/cpsection/accessibility/model.py 2010-07-27 11:45:05.237504112 -0300 @@ -0,0 +1,55 @@ +# Copyright (C) 2010 Plan Ceibal +# +# Author: Esteban Arias +# Contact information: comunidad@plan.ceibal.edu.uy +# Plan Ceibal http://www.ceibal.edu.uy +# +# 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, see . + +import subprocess +import gconf + +from gettext import gettext as _ +from jarabe.model import accessibility + +keyboard = accessibility.Keyboard() + +KEYWORDS = ['mouse_keys', 'sticky_keys', 'bounce_keys'] + +def get_mouse_keys(): + return keyboard.get_mouse_keys() + +def set_mouse_keys(activar): + keyboard.set_mouse_keys(activar) + +def print_mouse_keys(): + print str(get_mouse_keys()) + +def get_sticky_keys(): + return keyboard.get_sticky_keys() + +def set_sticky_keys(activar): + keyboard.set_sticky_keys(activar) + +def print_sticky_keys(): + print str(get_sticky_keys()) + +def get_bounce_keys(): + return keyboard.get_bounce_keys() + +def set_bounce_keys(activar): + keyboard.set_bounce_keys(activar) + +def print_bounce_keys(): + print str(get_bounce_keys()) diff -u -r -N sugar-0.88.1.original/extensions/cpsection/accessibility/view.py sugar-0.88.1/extensions/cpsection/accessibility/view.py --- sugar-0.88.1.original/extensions/cpsection/accessibility/view.py 1969-12-31 21:00:00.000000000 -0300 +++ sugar-0.88.1/extensions/cpsection/accessibility/view.py 2010-07-27 11:45:05.238503821 -0300 @@ -0,0 +1,114 @@ +# Copyright (C) 2010 Plan Ceibal +# +# Author: Esteban Arias +# Contact information: comunidad@plan.ceibal.edu.uy +# Plan Ceibal http://www.ceibal.edu.uy +# +# 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, see . + + +import gtk +from gettext import gettext as _ + +from sugar.graphics import style + +from jarabe import config +from jarabe.controlpanel.sectionview import SectionView +from jarabe.controlpanel.inlinealert import InlineAlert + +class accessibility(SectionView): + def __init__(self, model, alerts=None): + SectionView.__init__(self) + + self._model = model + self.set_border_width(style.DEFAULT_SPACING * 2) + self.set_spacing(style.DEFAULT_SPACING) + group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) + + separator_pm = gtk.HSeparator() + self.pack_start(separator_pm, expand=False) + separator_pm.show() + + label_pm_teclado = gtk.Label(_('Keyboard')) + label_pm_teclado.set_alignment(0, 0) + self.pack_start(label_pm_teclado, expand=False) + label_pm_teclado.show() + + self.box_pm = gtk.VBox() + self.box_pm.set_border_width(style.DEFAULT_SPACING * 2) + self.box_pm.set_spacing(style.DEFAULT_SPACING) + + self._view_mouse_keys() + self._view_sticky_keys() + self._view_bounce_keys() + + self.pack_start(self.box_pm, expand=False) + self.box_pm.show() + + def _set_mouse_keys(self, widget): + state = widget.get_active() + self._model.set_mouse_keys(state) + + def _set_sticky_keys(self, widget): + state = widget.get_active() + self._model.set_sticky_keys(state) + + def _set_bounce_keys(self, widget): + state = widget.get_active() + self._model.set_bounce_keys(state) + + def undo(self): + self._model.set_mouse_keys(self.init_state_mouse_keys) + self._model.set_sticky_keys(self.init_state_sticky_keys) + self._model.set_bounce_keys(self.init_state_bounce_keys) + + def _view_mouse_keys(self): + self.btn_mouse_keys = gtk.CheckButton(_('Mouse Keys')) + self._mouse_pm_change_handler = self.btn_mouse_keys.connect("toggled", self._set_mouse_keys) + self.init_state_mouse_keys = self._model.get_mouse_keys() + self.btn_mouse_keys.set_active(self.init_state_mouse_keys) + self.box_pm.pack_start(self.btn_mouse_keys, True, True, 2) + self.btn_mouse_keys.show() + + lbl_mouse = gtk.Label(_('Move the mouse pointer with keyboard number.')) + lbl_mouse.set_alignment(0, 0) + self.box_pm.pack_start(lbl_mouse, True, True, 2) + lbl_mouse.show() + + def _view_sticky_keys(self): + self.btn_sticky_keys = gtk.CheckButton(_('Sticky Keys')) + self._sticky_pm_change_handler = self.btn_sticky_keys.connect("toggled", self._set_sticky_keys) + self.init_state_sticky_keys = self._model.get_sticky_keys() + self.btn_sticky_keys.set_active(self.init_state_sticky_keys) + self.box_pm.pack_start(self.btn_sticky_keys, True, True, 2) + self.btn_sticky_keys.show() + + lbl_sticky = gtk.Label(_('Instead of having to press two keys at once (such as CTRL + Q), you can press one key at a time.')) + lbl_sticky.set_line_wrap(True) + lbl_sticky.set_alignment(0, 0) + self.box_pm.pack_start(lbl_sticky, True, True, 2) + lbl_sticky.show() + + def _view_bounce_keys(self): + self.btn_bounce_keys = gtk.CheckButton(_('Bounce Keys')) + self._bounce_pm_change_handler = self.btn_bounce_keys.connect("toggled", self._set_bounce_keys) + self.init_state_bounce_keys = self._model.get_bounce_keys() + self.btn_bounce_keys.set_active(self.init_state_bounce_keys) + self.box_pm.pack_start(self.btn_bounce_keys, True, True, 2) + self.btn_bounce_keys.show() + + lbl_bounce = gtk.Label(_('Ignore rapid, repeated keypresses of the same key.')) + lbl_bounce.set_alignment(0, 0) + self.box_pm.pack_start(lbl_bounce, True, True, 2) + lbl_bounce.show() diff -u -r -N sugar-0.88.1.original/extensions/cpsection/Makefile.am sugar-0.88.1/extensions/cpsection/Makefile.am --- sugar-0.88.1.original/extensions/cpsection/Makefile.am 2010-07-27 10:55:39.738753911 -0300 +++ sugar-0.88.1/extensions/cpsection/Makefile.am 2010-07-27 11:46:37.115753833 -0300 @@ -1,5 +1,16 @@ -SUBDIRS = aboutme aboutcomputer datetime frame keyboard language \ - modemconfiguration network power updater +SUBDIRS = \ + aboutme \ + aboutcomputer \ + accessibility \ + datetime \ + frame \ + keyboard \ + language \ + modemconfiguration \ + network \ + power \ + updater \ + # sugardir = $(pkgdatadir)/extensions/cpsection sugar_PYTHON = __init__.py diff -u -r -N sugar-0.88.1.original/src/jarabe/model/accessibility.py sugar-0.88.1/src/jarabe/model/accessibility.py --- sugar-0.88.1.original/src/jarabe/model/accessibility.py 1969-12-31 21:00:00.000000000 -0300 +++ sugar-0.88.1/src/jarabe/model/accessibility.py 2010-07-27 11:45:05.238503821 -0300 @@ -0,0 +1,76 @@ +# Copyright (C) 2010 Plan Ceibal +# +# Author: Esteban Arias +# Contact information: comunidad@plan.ceibal.edu.uy +# Plan Ceibal http://www.ceibal.edu.uy +# +# 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, see . + +import subprocess +import gconf + +from gettext import gettext as _ + +class Keyboard: + + def get_mouse_keys(self): + client = gconf.client_get_default() + return client.get_bool("/desktop/sugar/accessibility/keyboard/mousekeys_enable") + + def set_mouse_keys(self, activar): + client = gconf.client_get_default() + client.set_bool("/desktop/sugar/accessibility/keyboard/mousekeys_enable", activar) + self.run_config_keyboard() + + def get_sticky_keys(self): + client = gconf.client_get_default() + return client.get_bool("/desktop/sugar/accessibility/keyboard/stickykeys_enable") + + def set_sticky_keys(self, activar): + client = gconf.client_get_default() + client.set_bool("/desktop/sugar/accessibility/keyboard/stickykeys_enable", activar) + self.run_config_keyboard() + + def get_bounce_keys(self): + client = gconf.client_get_default() + return client.get_bool("/desktop/sugar/accessibility/keyboard/bouncekeys_enable") + + def set_bounce_keys(self, activar): + client = gconf.client_get_default() + client.set_bool("/desktop/sugar/accessibility/keyboard/bouncekeys_enable", activar) + self.run_config_keyboard() + + def run_config_keyboard(self): + cmd = ['ax'] + if self.get_sticky_keys(): + cmd.append('+stickykeys') + else: + cmd.append('-stickykeys') + if self.get_bounce_keys(): + cmd.append('+bouncekeys') + else: + cmd.append('-bouncekeys') + if self.get_mouse_keys(): + cmd += ['+mousekeys', 'mousemaxspeed', '3000', 'mousetimetomax', '1000', '-timeout', '-repeatkeys'] + else: + cmd += ['-mousekeys', 'mousemaxspeed', '3000', 'mousetimetomax', '1000', '+timeout', '+repeatkeys'] + subprocess.call(cmd) + +class AccessibilityManager: + def setup_accessibility(self): + client = gconf.client_get_default() + is_accessibility = client.dir_exists("/desktop/sugar/accessibility") + if is_accessibility: + keyboard = Keyboard() + keyboard.run_config_keyboard() diff -u -r -N sugar-0.88.1.original/src/jarabe/model/Makefile.am sugar-0.88.1/src/jarabe/model/Makefile.am --- sugar-0.88.1.original/src/jarabe/model/Makefile.am 2010-07-27 10:55:14.456503932 -0300 +++ sugar-0.88.1/src/jarabe/model/Makefile.am 2010-07-27 11:47:46.002753886 -0300 @@ -1,6 +1,7 @@ sugardir = $(pythondir)/jarabe/model sugar_PYTHON = \ __init__.py \ + accessibility.py \ buddy.py \ bundleregistry.py \ filetransfer.py \