[caribou] Ask user to enable accessibility on startup.



commit 78dedf94463f8c0d9b8f441e7d70345bfff9a38e
Author: Jiro Matsuzawa <matsuzawa jr gmail com>
Date:   Mon Mar 28 16:52:40 2011 +0900

    Ask user to enable accessibility on startup.
    
    (written originally by Parag Nemade, and modified by Jiro Matsuzawa)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645890

 caribou/ui/main.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/caribou/ui/main.py b/caribou/ui/main.py
index 1a6ac9e..f155f41 100644
--- a/caribou/ui/main.py
+++ b/caribou/ui/main.py
@@ -52,7 +52,19 @@ class Caribou:
                  kb_factory=CaribouKeyboard,
                  window_factory=CaribouWindowEntry):
         if not self._get_a11y_enabled():
-            raise Exception, "AT-SPI 1 or 2 needs to be enabled."
+            msgdialog = Gtk.MessageDialog(None,
+                                          Gtk.DialogFlags.MODAL,
+                                          Gtk.MessageType.QUESTION,
+                                          Gtk.ButtonsType.YES_NO,
+                                          _("Accessibility needs to be enabled. Do you want to enable it and run %s?") % const.APP_NAME)
+            resp = msgdialog.run()
+            if resp == Gtk.ResponseType.NO:
+                msgdialog.destroy()
+                quit()
+            if resp == Gtk.ResponseType.YES:
+                settings = Gio.Settings('org.gnome.desktop.interface')
+                atspi = settings.set_boolean("toolkit-accessibility", True)
+                msgdialog.destroy()
         self.__current_acc = None
         self.window_factory = window_factory
         self.kb_factory = kb_factory



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]