[orca] Create a toolkit script for Gtk+ 3
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Create a toolkit script for Gtk+ 3
- Date: Mon, 11 Nov 2013 21:16:45 +0000 (UTC)
commit 1a9c73e49fb287510949202f125e89519c5150df
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Nov 11 13:07:28 2013 -0500
Create a toolkit script for Gtk+ 3
configure.ac | 1 +
src/orca/script_manager.py | 3 +-
src/orca/script_utilities.py | 10 ---
src/orca/scripts/apps/empathy/script.py | 16 ++--
src/orca/scripts/apps/empathy/script_utilities.py | 8 +-
src/orca/scripts/apps/evince/script.py | 10 +-
src/orca/scripts/apps/evince/script_utilities.py | 9 +-
src/orca/scripts/apps/evolution/script.py | 13 ++-
src/orca/scripts/apps/gcalctool/script.py | 14 ++--
src/orca/scripts/apps/gedit/script.py | 12 ++--
src/orca/scripts/apps/gnome-documents/script.py | 8 +-
.../apps/gnome-documents/script_utilities.py | 9 +-
src/orca/scripts/apps/gnome-terminal/script.py | 12 ++--
src/orca/scripts/apps/rhythmbox/script.py | 6 +-
src/orca/scripts/default.py | 21 +-----
src/orca/scripts/toolkits/Makefile.am | 2 +-
src/orca/scripts/toolkits/gtk/Makefile.am | 7 ++
src/orca/scripts/toolkits/gtk/__init__.py | 2 +
src/orca/scripts/toolkits/gtk/script.py | 78 ++++++++++++++++++++
src/orca/scripts/toolkits/gtk/script_utilities.py | 48 ++++++++++++
20 files changed, 203 insertions(+), 86 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0eca58e..228970e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,7 @@ src/orca/scripts/toolkits/J2SE-access-bridge/Makefile
src/orca/scripts/toolkits/CALLY/Makefile
src/orca/scripts/toolkits/Qt/Makefile
src/orca/scripts/toolkits/WebKitGtk/Makefile
+src/orca/scripts/toolkits/gtk/Makefile
src/orca/backends/Makefile
src/orca/orca_bin.py
src/orca/orca_i18n.py
diff --git a/src/orca/script_manager.py b/src/orca/script_manager.py
index b394508..febee6c 100644
--- a/src/orca/script_manager.py
+++ b/src/orca/script_manager.py
@@ -63,8 +63,7 @@ class ScriptManager:
'vte': 'gnome-terminal',
'gnome-terminal-server': 'gnome-terminal'}
self._toolkitNames = \
- {'gtk': 'GAIL',
- 'clutter': 'CALLY'}
+ {'clutter': 'CALLY'}
self.setActiveScript(None, "__init__")
debug.println(debug.LEVEL_FINEST, 'INFO: Script manager initialized')
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 0c96111..00cb2de 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -607,16 +607,6 @@ class Utilities:
except (LookupError, RuntimeError):
pass
- try:
- parentRole = obj.parent.getRole()
- except:
- parentRole = None
-
- # egg-list-box, e.g. privacy panel in gnome-control-center
- if not displayedText and parentRole == pyatspi.ROLE_LIST_BOX:
- labels = self.unrelatedLabels(obj, onlyShowing=False)
- displayedText = " ".join(map(self.displayedText, labels))
-
# [[[WDW - HACK because push buttons can have labels as their
# children. An example of this is the Font: button on the General
# tab in the Editing Profile dialog in gnome-terminal.
diff --git a/src/orca/scripts/apps/empathy/script.py b/src/orca/scripts/apps/empathy/script.py
index fd7f91e..5de885c 100644
--- a/src/orca/scripts/apps/empathy/script.py
+++ b/src/orca/scripts/apps/empathy/script.py
@@ -28,7 +28,7 @@ __license__ = "LGPL"
import pyatspi
import orca.chat as chat
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
from .script_utilities import Utilities
@@ -38,7 +38,7 @@ from .script_utilities import Utilities
# #
########################################################################
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application."""
@@ -50,7 +50,7 @@ class Script(default.Script):
pyatspi.ROLE_FILLER,
pyatspi.ROLE_FRAME]]
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
def getChat(self):
"""Returns the 'chat' class for this script."""
@@ -68,7 +68,7 @@ class Script(default.Script):
handlers for chat functionality.
"""
- default.Script.setupInputEventHandlers(self)
+ gtk.Script.setupInputEventHandlers(self)
self.inputEventHandlers.update(self.chat.inputEventHandlers)
def getAppKeyBindings(self):
@@ -107,7 +107,7 @@ class Script(default.Script):
if self.chat.isChatRoomMsg(event.source):
return False
- return default.Script.skipObjectEvent(self, event)
+ return gtk.Script.skipObjectEvent(self, event)
def onTextInserted(self, event):
"""Called whenever text is added to an object."""
@@ -120,7 +120,7 @@ class Script(default.Script):
if self.chat.presentInsertedText(event):
return
- default.Script.onTextInserted(self, event)
+ gtk.Script.onTextInserted(self, event)
def onWindowActivated(self, event):
"""Called whenever a toplevel window is activated."""
@@ -132,7 +132,7 @@ class Script(default.Script):
allPageTabs = self.utilities.descendantsWithRole(
event.source, pyatspi.ROLE_PAGE_TAB)
- default.Script.onWindowActivated(self, event)
+ gtk.Script.onWindowActivated(self, event)
def onValueChanged(self, event):
"""Called whenever an object's value changes. Currently, the
@@ -147,4 +147,4 @@ class Script(default.Script):
#
return
- default.Script.onValueChanged(self, event)
+ gtk.Script.onValueChanged(self, event)
diff --git a/src/orca/scripts/apps/empathy/script_utilities.py
b/src/orca/scripts/apps/empathy/script_utilities.py
index f59c23a..693e6ba 100644
--- a/src/orca/scripts/apps/empathy/script_utilities.py
+++ b/src/orca/scripts/apps/empathy/script_utilities.py
@@ -30,13 +30,15 @@ __license__ = "LGPL"
import orca.script_utilities as script_utilities
+import orca.scripts.toolkits.gtk as gtk
+
#############################################################################
# #
# Utilities #
# #
#############################################################################
-class Utilities(script_utilities.Utilities):
+class Utilities(gtk.Utilities):
def __init__(self, script):
"""Creates an instance of the Utilities class.
@@ -45,7 +47,7 @@ class Utilities(script_utilities.Utilities):
- script: the script with which this instance is associated.
"""
- script_utilities.Utilities.__init__(self, script)
+ gtk.Utilities.__init__(self, script)
#########################################################################
# #
@@ -63,7 +65,7 @@ class Utilities(script_utilities.Utilities):
Returns: a list of all the child nodes
"""
- reportedNodes = script_utilities.Utilities.childNodes(self, obj)
+ reportedNodes = gtk.Utilities.childNodes(self, obj)
actualNodes = []
for node in reportedNodes:
child = self.realActiveDescendant(node)
diff --git a/src/orca/scripts/apps/evince/script.py b/src/orca/scripts/apps/evince/script.py
index 4e953d3..dfa55cf 100644
--- a/src/orca/scripts/apps/evince/script.py
+++ b/src/orca/scripts/apps/evince/script.py
@@ -29,7 +29,7 @@ import pyatspi
import orca.keybindings as keybindings
import orca.orca_state as orca_state
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
import orca.settings as settings
from orca.structural_navigation import StructuralNavigation
from .script_utilities import Utilities
@@ -40,7 +40,7 @@ from .script_utilities import Utilities
# #
########################################################################
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application.
@@ -49,13 +49,13 @@ class Script(default.Script):
- app: the application to create a script for.
"""
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
def setupInputEventHandlers(self):
"""Defines InputEventHandler fields for this script that can be
called by the key and braille bindings."""
- default.Script.setupInputEventHandlers(self)
+ gtk.Script.setupInputEventHandlers(self)
self.inputEventHandlers.update(
self.structuralNavigation.inputEventHandlers)
@@ -125,4 +125,4 @@ class Script(default.Script):
message, voice=self.voices.get(settings.DEFAULT_VOICE))
return
- default.Script.onShowingChanged(self, event)
+ gtk.Script.onShowingChanged(self, event)
diff --git a/src/orca/scripts/apps/evince/script_utilities.py
b/src/orca/scripts/apps/evince/script_utilities.py
index 02938ee..804d907 100644
--- a/src/orca/scripts/apps/evince/script_utilities.py
+++ b/src/orca/scripts/apps/evince/script_utilities.py
@@ -28,11 +28,12 @@ __license__ = "LGPL"
import pyatspi
import orca.script_utilities as script_utilities
+import orca.scripts.toolkits.gtk as gtk
-class Utilities(script_utilities.Utilities):
+class Utilities(gtk.Utilities):
def __init__(self, script):
- script_utilities.Utilities.__init__(self, script)
+ gtk.Utilities.__init__(self, script)
def offsetsForPhrase(self, obj):
"""Return the start and end offset for the given phrase. Overriden
@@ -52,7 +53,7 @@ class Utilities(script_utilities.Utilities):
return [0, 0]
if obj.getRole() != pyatspi.ROLE_DOCUMENT_FRAME:
- return script_utilities.Utilities.offsetsForPhrase(self, obj)
+ return gtk.Utilities.offsetsForPhrase(self, obj)
lastPos = self._script.pointOfReference.get("lastCursorPosition")
keyString, mods = self.lastKeyAndModifiers()
@@ -70,4 +71,4 @@ class Utilities(script_utilities.Utilities):
return [0, text.caretOffset]
return [lastPos[1], text.caretOffset]
- return script_utilities.Utilities.offsetsForPhrase(self, obj)
+ return gtk.Utilities.offsetsForPhrase(self, obj)
diff --git a/src/orca/scripts/apps/evolution/script.py b/src/orca/scripts/apps/evolution/script.py
index 81e55e6..88f5bb6 100644
--- a/src/orca/scripts/apps/evolution/script.py
+++ b/src/orca/scripts/apps/evolution/script.py
@@ -29,7 +29,7 @@ __license__ = "LGPL"
import pyatspi
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
import orca.scripts.toolkits.WebKitGtk as WebKitGtk
import orca.settings as settings
import orca.settings_manager as settings_manager
@@ -101,6 +101,11 @@ class Script(WebKitGtk.Script):
# #
########################################################################
+ def onFocus(self, event):
+ """Callback for focus: accessibility events."""
+
+ gtk.Script.onFocus(self, event)
+
def onNameChanged(self, event):
"""Callback for object:property-change:accessible-name events."""
@@ -110,13 +115,13 @@ class Script(WebKitGtk.Script):
if event.source.getRole() == pyatspi.ROLE_FRAME:
return
- default.Script.onNameChanged(self, event)
+ gtk.Script.onNameChanged(self, event)
def onShowingChanged(self, event):
"""Callback for object:state-changed:showing accessibility events."""
if not event.detail1:
- default.Script.onShowingChanged(self, event)
+ gtk.Script.onShowingChanged(self, event)
return
obj = event.source
@@ -129,7 +134,7 @@ class Script(WebKitGtk.Script):
return
if role != pyatspi.ROLE_LABEL or relationSet:
- default.Script.onShowingChanged(self, event)
+ gtk.Script.onShowingChanged(self, event)
return
window = self.utilities.topLevelObject(obj)
diff --git a/src/orca/scripts/apps/gcalctool/script.py b/src/orca/scripts/apps/gcalctool/script.py
index 67f8183..76cb4cf 100644
--- a/src/orca/scripts/apps/gcalctool/script.py
+++ b/src/orca/scripts/apps/gcalctool/script.py
@@ -27,7 +27,7 @@ __license__ = "LGPL"
import pyatspi
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
import orca.messages as messages
########################################################################
@@ -36,7 +36,7 @@ import orca.messages as messages
# #
########################################################################
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application. Callers
@@ -47,7 +47,7 @@ class Script(default.Script):
- app: the application to create a script for.
"""
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
self._resultsDisplay = None
self._statusLine = None
@@ -60,13 +60,13 @@ class Script(default.Script):
"""
if self._resultsDisplay and self._statusLine:
- default.Script.onWindowActivated(self, event)
+ gtk.Script.onWindowActivated(self, event)
return
obj = event.source
role = obj.getRole()
if role != pyatspi.ROLE_FRAME:
- default.Script.onWindowActivated(self, event)
+ gtk.Script.onWindowActivated(self, event)
return
isEditbar = lambda x: x and x.getRole() == pyatspi.ROLE_EDITBAR
@@ -78,7 +78,7 @@ class Script(default.Script):
and not x.getState().contains(pyatspi.STATE_EDITABLE)
self._statusLine = pyatspi.findDescendant(obj, isStatusLine)
- default.Script.onWindowActivated(self, event)
+ gtk.Script.onWindowActivated(self, event)
def onTextInserted(self, event):
"""Called whenever text is inserted into gcalctool's text display.
@@ -91,4 +91,4 @@ class Script(default.Script):
self.presentMessage(self.utilities.displayedText(self._statusLine))
return
- default.Script.onTextInserted(self, event)
+ gtk.Script.onTextInserted(self, event)
diff --git a/src/orca/scripts/apps/gedit/script.py b/src/orca/scripts/apps/gedit/script.py
index b125a7b..5150847 100644
--- a/src/orca/scripts/apps/gedit/script.py
+++ b/src/orca/scripts/apps/gedit/script.py
@@ -28,14 +28,14 @@ __license__ = "LGPL"
import pyatspi
import orca.debug as debug
-import orca.scripts.default as default
import orca.orca_state as orca_state
+import orca.scripts.toolkits.gtk as gtk
import orca.settings as settings
import orca.speech as speech
from orca.orca_i18n import _
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application.
@@ -44,7 +44,7 @@ class Script(default.Script):
- app: the application to create a script for.
"""
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
# Set the debug level for all the methods in this script.
#
@@ -266,7 +266,7 @@ class Script(default.Script):
# For everything else, pass the focus event onto the parent class
# to be handled in the default way.
- default.Script.locusOfFocusChanged(self, event,
+ gtk.Script.locusOfFocusChanged(self, event,
oldLocusOfFocus, newLocusOfFocus)
# If we are doing a Print Preview and we are focused on the
@@ -364,7 +364,7 @@ class Script(default.Script):
speech.speak(event.source.name)
# Pass the event onto the parent class to be handled in the default way.
- default.Script.onNameChanged(self, event)
+ gtk.Script.onNameChanged(self, event)
# This method tries to detect and handle the following cases:
# 1) find dialog - phrase found.
@@ -413,4 +413,4 @@ class Script(default.Script):
# For everything else, pass the caret moved event onto the parent
# class to be handled in the default way.
- default.Script.onCaretMoved(self, event)
+ gtk.Script.onCaretMoved(self, event)
diff --git a/src/orca/scripts/apps/gnome-documents/script.py b/src/orca/scripts/apps/gnome-documents/script.py
index 89c65d5..fb513a2 100644
--- a/src/orca/scripts/apps/gnome-documents/script.py
+++ b/src/orca/scripts/apps/gnome-documents/script.py
@@ -27,12 +27,12 @@ __license__ = "LGPL"
import pyatspi
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
import orca.orca_state as orca_state
from .speech_generator import SpeechGenerator
from .script_utilities import Utilities
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application.
@@ -41,7 +41,7 @@ class Script(default.Script):
- app: the application to create a script for.
"""
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
def getSpeechGenerator(self):
"""Returns the speech generator for this script."""
@@ -77,4 +77,4 @@ class Script(default.Script):
text.setCaretOffset(0)
return self.sayAll(None)
- default.Script.onNameChanged(self, event)
+ gtk.Script.onNameChanged(self, event)
diff --git a/src/orca/scripts/apps/gnome-documents/script_utilities.py
b/src/orca/scripts/apps/gnome-documents/script_utilities.py
index d97c41c..49cf210 100644
--- a/src/orca/scripts/apps/gnome-documents/script_utilities.py
+++ b/src/orca/scripts/apps/gnome-documents/script_utilities.py
@@ -28,20 +28,21 @@ __license__ = "LGPL"
import pyatspi
import orca.script_utilities as script_utilities
+import orca.scripts.toolkits.gtk as gtk
-class Utilities(script_utilities.Utilities):
+class Utilities(gtk.Utilities):
def __init__(self, script):
- script_utilities.Utilities.__init__(self, script)
+ gtk.Utilities.__init__(self, script)
def isReadOnlyTextArea(self, obj):
if obj.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
return False
- return script_utilities.Utilities.isReadOnlyTextArea(self, obj)
+ return gtk.Utilities.isReadOnlyTextArea(self, obj)
def isTextArea(self, obj):
if obj.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
return True
- return script_utilities.Utilities.isTextArea(self, obj)
+ return gtk.Utilities.isTextArea(self, obj)
diff --git a/src/orca/scripts/apps/gnome-terminal/script.py b/src/orca/scripts/apps/gnome-terminal/script.py
index 8c76542..40c00f1 100644
--- a/src/orca/scripts/apps/gnome-terminal/script.py
+++ b/src/orca/scripts/apps/gnome-terminal/script.py
@@ -29,7 +29,7 @@ __license__ = "LGPL"
import pyatspi
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
import orca.orca_state as orca_state
import orca.settings as settings
import orca.settings_manager as settings_manager
@@ -43,7 +43,7 @@ _settingsManager = settings_manager.getManager()
# #
########################################################################
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application.
@@ -52,7 +52,7 @@ class Script(default.Script):
- app: the application to create a script for.
"""
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
# By default, don't present if gnome-terminal is not the active
# application.
@@ -85,7 +85,7 @@ class Script(default.Script):
utterances = self.speechGenerator.generateSpeech(pageTab)
speech.speak(utterances)
- default.Script.locusOfFocusChanged(self, event,
+ gtk.Script.locusOfFocusChanged(self, event,
oldLocusOfFocus, newLocusOfFocus)
def onTextDeleted(self, event):
@@ -102,7 +102,7 @@ class Script(default.Script):
#
if (event.source.getRole() != pyatspi.ROLE_TERMINAL) \
or (event_string != "BackSpace"):
- default.Script.onTextDeleted(self, event)
+ gtk.Script.onTextDeleted(self, event)
return
# Ignore text deletions from non-focused objects, unless the
@@ -140,7 +140,7 @@ class Script(default.Script):
where the caret is.
"""
string, caretOffset, lineOffset = \
- default.Script.getTextLineAtCaret(self, acc)
+ gtk.Script.getTextLineAtCaret(self, acc)
# Sometimes, gnome-terminal will give us very odd values when
# the user is editing using 'vi' and has positioned the caret
diff --git a/src/orca/scripts/apps/rhythmbox/script.py b/src/orca/scripts/apps/rhythmbox/script.py
index c451663..3fa7620 100644
--- a/src/orca/scripts/apps/rhythmbox/script.py
+++ b/src/orca/scripts/apps/rhythmbox/script.py
@@ -27,10 +27,10 @@ __copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc." \
"Copyright (c) 2010 Joanmarie Diggs"
__license__ = "LGPL"
-import orca.scripts.default as default
+import orca.scripts.toolkits.gtk as gtk
from .formatting import Formatting
-class Script(default.Script):
+class Script(gtk.Script):
def __init__(self, app):
"""Creates a new script for the given application.
@@ -38,7 +38,7 @@ class Script(default.Script):
Arguments:
- app: the application to create a script for.
"""
- default.Script.__init__(self, app)
+ gtk.Script.__init__(self, app)
def getFormatting(self):
"""Returns the formatting strings for this script."""
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index b6cd1a2..8930506 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -2119,10 +2119,7 @@ class Script(script.Script):
obj = event.source
if not self.utilities.isSameObject(obj, orca_state.locusOfFocus):
- # Present changes of child widgets of GtkListBox items
- isListBox = lambda x: x and x.getRole() == pyatspi.ROLE_LIST_BOX
- if not pyatspi.findAncestor(obj, isListBox):
- return
+ return
# Radio buttons normally change their state when you arrow to them,
# so we handle the announcement of their state changes in the focus
@@ -2367,21 +2364,7 @@ class Script(script.Script):
def onFocus(self, event):
"""Callback for focus: accessibility events."""
- # NOTE: This event type is deprecated and Orca should no longer use it.
- # This callback remains just to handle bugs in applications and toolkits
- # during the remainder of the unstable (3.11) development cycle.
-
- role = event.source.getRole()
-
- # https://bugzilla.gnome.org/show_bug.cgi?id=711397
- if role == pyatspi.ROLE_COMBO_BOX:
- orca.setLocusOfFocus(event, event.source)
-
- # Unfiled. But this happens when you are in Gedit, get into a menu
- # and then press Escape. The text widget emits a focus: event, but
- # not a state-changed:focused event.
- if role == pyatspi.ROLE_TEXT:
- orca.setLocusOfFocus(event, event.source)
+ pass
def onFocusedChanged(self, event):
"""Callback for object:state-changed:focused accessibility events."""
diff --git a/src/orca/scripts/toolkits/Makefile.am b/src/orca/scripts/toolkits/Makefile.am
index 8865097..609340f 100644
--- a/src/orca/scripts/toolkits/Makefile.am
+++ b/src/orca/scripts/toolkits/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = Gecko J2SE-access-bridge CALLY Qt WebKitGtk
+SUBDIRS = Gecko J2SE-access-bridge CALLY Qt WebKitGtk gtk
orca_python_PYTHON = \
__init__.py \
diff --git a/src/orca/scripts/toolkits/gtk/Makefile.am b/src/orca/scripts/toolkits/gtk/Makefile.am
new file mode 100644
index 0000000..3b5d2cb
--- /dev/null
+++ b/src/orca/scripts/toolkits/gtk/Makefile.am
@@ -0,0 +1,7 @@
+orca_python_PYTHON = \
+ __init__.py \
+ script.py \
+ script_utilities.py
+
+orca_pythondir=$(pkgpythondir)/scripts/toolkits/gtk
+
diff --git a/src/orca/scripts/toolkits/gtk/__init__.py b/src/orca/scripts/toolkits/gtk/__init__.py
new file mode 100644
index 0000000..a1ec518
--- /dev/null
+++ b/src/orca/scripts/toolkits/gtk/__init__.py
@@ -0,0 +1,2 @@
+from .script import Script
+from .script_utilities import Utilities
diff --git a/src/orca/scripts/toolkits/gtk/script.py b/src/orca/scripts/toolkits/gtk/script.py
new file mode 100644
index 0000000..fcaa4f6
--- /dev/null
+++ b/src/orca/scripts/toolkits/gtk/script.py
@@ -0,0 +1,78 @@
+# Orca
+#
+# Copyright (C) 2013 Igalia, S.L.
+#
+# Author: Joanmarie Diggs <jdiggs igalia com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA 02110-1301 USA.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2013 Igalia, S.L."
+__license__ = "LGPL"
+
+import pyatspi
+
+import orca.orca as orca
+import orca.orca_state as orca_state
+import orca.scripts.default as default
+import orca.speech as speech
+
+from .script_utilities import Utilities
+
+class Script(default.Script):
+
+ def __init__(self, app):
+ default.Script.__init__(self, app)
+
+ def getUtilities(self):
+ return Utilities(self)
+
+ def onCheckedChanged(self, event):
+ """Callback for object:state-changed:checked accessibility events."""
+
+ obj = event.source
+ if self.utilities.isSameObject(obj, orca_state.locusOfFocus):
+ default.Script.onCheckedChanged(self, event)
+ return
+
+ # Present changes of child widgets of GtkListBox items
+ isListBox = lambda x: x and x.getRole() == pyatspi.ROLE_LIST_BOX
+ if not pyatspi.findAncestor(obj, isListBox):
+ return
+
+ self.updateBraille(obj)
+ speech.speak(self.speechGenerator.generateSpeech(obj, alreadyFocused=True))
+
+ def onFocus(self, event):
+ """Callback for focus: accessibility events."""
+
+ # NOTE: This event type is deprecated and Orca should no longer use it.
+ # This callback remains just to handle bugs in applications and toolkits
+ # during the remainder of the unstable (3.11) development cycle.
+
+ role = event.source.getRole()
+
+ # https://bugzilla.gnome.org/show_bug.cgi?id=711397
+ if role == pyatspi.ROLE_COMBO_BOX:
+ orca.setLocusOfFocus(event, event.source)
+
+ # Unfiled. But this happens when you are in Gedit, get into a menu
+ # and then press Escape. The text widget emits a focus: event, but
+ # not a state-changed:focused event.
+ if role == pyatspi.ROLE_TEXT:
+ orca.setLocusOfFocus(event, event.source)
diff --git a/src/orca/scripts/toolkits/gtk/script_utilities.py
b/src/orca/scripts/toolkits/gtk/script_utilities.py
new file mode 100644
index 0000000..7a32699
--- /dev/null
+++ b/src/orca/scripts/toolkits/gtk/script_utilities.py
@@ -0,0 +1,48 @@
+# Orca
+#
+# Copyright (C) 2013 Igalia, S.L.
+#
+# Author: Joanmarie Diggs <jdiggs igalia com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
+# Boston MA 02110-1301 USA.
+
+__id__ = "$Id$"
+__version__ = "$Revision$"
+__date__ = "$Date$"
+__copyright__ = "Copyright (c) 2013 Igalia, S.L."
+__license__ = "LGPL"
+
+import pyatspi
+
+import orca.script_utilities as script_utilities
+
+class Utilities(script_utilities.Utilities):
+
+ def __init__(self, script):
+ script_utilities.Utilities.__init__(self, script)
+
+ def displayedText(self, obj):
+ displayedText = script_utilities.Utilities.displayedText(self, obj)
+ if displayedText:
+ return displayedText
+
+ # Present GtkLabel children inside a GtkListBox row.
+ if obj.parent.getRole() == pyatspi.ROLE_LIST_BOX:
+ labels = self.unrelatedLabels(obj, onlyShowing=False)
+ displayedText = " ".join(map(self.displayedText, labels))
+
+ self._script.generatorCache[self.DISPLAYED_TEXT][obj] = displayedText
+ return displayedText
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]