[orca/gnome-3-4] Fix for bug 673142 - Unhandled exceptions (GError: No such object path) when using Skype
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-4] Fix for bug 673142 - Unhandled exceptions (GError: No such object path) when using Skype
- Date: Fri, 30 Mar 2012 22:41:11 +0000 (UTC)
commit 1e9e8e2da7d97bf34020639852dd05c379bdc1fa
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Mar 30 18:38:33 2012 -0400
Fix for bug 673142 - Unhandled exceptions (GError: No such object path) when using Skype
src/orca/braille_generator.py | 9 ++++++---
src/orca/script_utilities.py | 6 +++++-
src/orca/scripts/default.py | 25 +++++++++++++++++--------
3 files changed, 28 insertions(+), 12 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index e56ec63..e41c924 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -336,9 +336,12 @@ class BrailleGenerator(generator.Generator):
text = None
if text and (self._script.utilities.isTextArea(obj) \
or (obj.getRole() in [pyatspi.ROLE_LABEL])):
- [lineString, startOffset, endOffset] = text.getTextAtOffset(
- text.caretOffset,
- pyatspi.TEXT_BOUNDARY_LINE_START)
+ try:
+ [lineString, startOffset, endOffset] = text.getTextAtOffset(
+ text.caretOffset, pyatspi.TEXT_BOUNDARY_LINE_START)
+ except:
+ return include
+
include = startOffset == 0
if include:
for relation in obj.getRelationSet():
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 2a1bf03..492ead4 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1704,7 +1704,11 @@ class Utilities:
return []
rv = []
- for i in xrange(text.getNSelections()):
+ try:
+ nSelections = text.getNSelections()
+ except:
+ nSelections = 0
+ for i in xrange(nSelections):
rv.append(text.getSelection(i))
return rv
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 74555be..2f4adf2 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -3641,22 +3641,29 @@ class Script(script.Script):
string = event.any_data
speakThis = False
wasCommand = False
+ try:
+ role = event.source.getRole()
+ except:
+ role = None
if isinstance(orca_state.lastInputEvent, input_event.MouseButtonEvent):
speakThis = orca_state.lastInputEvent.button == "2"
else:
keyString, mods = self.utilities.lastKeyAndModifiers()
wasCommand = mods & settings.COMMAND_MODIFIER_MASK
if not wasCommand and keyString in ["Return", "Tab", "space"] \
- and event.source.getRole() == pyatspi.ROLE_TERMINAL:
+ and role == pyatspi.ROLE_TERMINAL:
wasCommand = True
- wasAutoComplete = (event.source.getRole() == pyatspi.ROLE_TEXT \
- and event.source.queryText().getNSelections())
+ try:
+ selections = event.source.queryText().getNSelections()
+ except:
+ selections = 0
+ wasAutoComplete = role == pyatspi.ROLE_TEXT and selections
if (string == " " and keyString == "space") or string == keyString:
pass
elif wasCommand or wasAutoComplete:
speakThis = True
- elif event.source.getRole() == pyatspi.ROLE_PASSWORD_TEXT \
+ elif role == pyatspi.ROLE_PASSWORD_TEXT \
and _settingsManager.getSetting('enableKeyEcho') \
and _settingsManager.getSetting('enablePrintableKeys'):
# Echoing "star" is preferable to echoing the descriptive
@@ -3674,8 +3681,7 @@ class Script(script.Script):
speakThis = speakThis \
or (_settingsManager.getSetting('enableEchoByCharacter') \
and string \
- and event.source.getRole() \
- != pyatspi.ROLE_PASSWORD_TEXT \
+ and role != pyatspi.ROLE_PASSWORD_TEXT \
and len(string.decode("UTF-8")) == 1)
if speakThis:
@@ -5147,8 +5153,11 @@ class Script(script.Script):
lineString = text.getText(caretOffset, caretOffset + 1)
startOffset = caretOffset
else:
- [lineString, startOffset, endOffset] = text.getTextAtOffset(
- caretOffset, pyatspi.TEXT_BOUNDARY_LINE_START)
+ try:
+ [lineString, startOffset, endOffset] = text.getTextAtOffset(
+ caretOffset, pyatspi.TEXT_BOUNDARY_LINE_START)
+ except:
+ return ["", 0, 0]
# Sometimes we get the trailing line-feed-- remove it
#
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]