[orca] Use the default script's SayAll functionality in Gedit.



commit ac2d833f379964342211e5eb5f12dc1d09c1d7c9
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun May 12 09:21:42 2013 -0400

    Use the default script's SayAll functionality in Gedit.

 src/orca/scripts/apps/gedit/script.py |  119 ---------------------------------
 1 files changed, 0 insertions(+), 119 deletions(-)
---
diff --git a/src/orca/scripts/apps/gedit/script.py b/src/orca/scripts/apps/gedit/script.py
index 69f4769..ea539ae 100644
--- a/src/orca/scripts/apps/gedit/script.py
+++ b/src/orca/scripts/apps/gedit/script.py
@@ -75,125 +75,6 @@ class Script(default.Script):
 
         return listeners
 
-    def __sayAllProgressCallback(self, context, progressType):
-        """Provide feedback during the sayAll operation.
-        """
-
-        if progressType == speechserver.SayAllContext.PROGRESS:
-            #print "PROGRESS", context.utterance, context.currentOffset
-            pass
-        elif progressType == speechserver.SayAllContext.INTERRUPTED:
-            #print "INTERRUPTED", context.utterance, context.currentOffset
-            offset = context.currentOffset
-            for i in range(0, len(context.obj)):
-                obj = context.obj[i]
-                text = obj.queryText()
-                charCount = text.characterCount
-                if offset > charCount:
-                    offset -= charCount
-                else:
-                    text.setCaretOffset(offset)
-                    break
-        elif progressType == speechserver.SayAllContext.COMPLETED:
-            #print "COMPLETED", context.utterance, context.currentOffset
-            obj = context.obj[len(context.obj)-1]
-            obj.queryText().setCaretOffset(context.currentOffset)
-            orca.setLocusOfFocus(None, obj, notifyScript=False)
-
-    def textLines(self, obj):
-        """Creates a generator that can be used to iterate over each line
-        of a text object, starting at the caret offset.
-
-        Arguments:
-        - obj: an Accessible that has a text specialization
-
-        Returns an iterator that produces elements of the form:
-        [SayAllContext, acss], where SayAllContext has the text to be
-        spoken and acss is an ACSS instance for speaking the text.
-        """
-
-        try:
-            text = obj.queryText()
-        except:
-            return
-
-        length = text.characterCount
-        offset = text.caretOffset
-        string = ""
-        textObjs = []
-        textObjs.append(obj)
-        startOffset = text.caretOffset
-
-        # Determine the correct "say all by" mode to use.
-        #        
-        if settings.sayAllStyle == settings.SAYALL_STYLE_SENTENCE:
-            mode = pyatspi.TEXT_BOUNDARY_SENTENCE_END
-        elif settings.sayAllStyle == settings.SAYALL_STYLE_LINE:
-            mode = pyatspi.TEXT_BOUNDARY_LINE_START
-        else:
-            mode = pyatspi.TEXT_BOUNDARY_LINE_START
-
-        # Get the next line of text to read
-        #
-        done = False
-        while not done:
-            while offset < length:
-                [mystr, start, end] = text.getTextAtOffset(offset, mode)
-                endOffset = end
-
-                if len(mystr) != 0:
-                    string += mystr
-
-                if mode == pyatspi.TEXT_BOUNDARY_LINE_START or \
-                   len(mystr) == 0 or mystr[len(mystr)-1] in '.?!':
-                    string = self.utilities.adjustForRepeats(string)
-                    if string.isupper():
-                        voice = settings.voices[settings.UPPERCASE_VOICE]
-                    else:
-                        voice = settings.voices[settings.DEFAULT_VOICE]
-
-                    yield [speechserver.SayAllContext(textObjs, string,
-                                                      startOffset, endOffset),
-                           voice]
-                    string = ""
-                    startOffset = endOffset
-
-                if len(mystr) == 0:
-                    break
-                else:
-                    offset = end
-
-            moreLines = False
-            relations = obj.getRelationSet()
-            for relation in relations:
-                if relation.getRelationType()  \
-                       == pyatspi.RELATION_FLOWS_TO:
-                    obj = relation.getTarget(0)
-                    try:
-                        text = obj.queryText()
-                    except:
-                        return
-                    textObjs.append(obj)
-                    length = text.characterCount
-                    offset = 0
-                    moreLines = True
-                    break
-            if not moreLines:
-                done = True
-
-        # If there is anything left unspoken, speak it now.
-        #
-        if len(string) != 0:
-            string = self.utilities.adjustForRepeats(string)
-            if string.isupper():
-                voice = settings.voices[settings.UPPERCASE_VOICE]
-            else:
-                voice = settings.voices[settings.DEFAULT_VOICE]
-
-            yield [speechserver.SayAllContext(textObjs, string,
-                                              startOffset, endOffset),
-                   voice]
-
     def readMisspeltWord(self, event, panel):
         """Speak/braille the current misspelt word plus its context.
            The spell check dialog contains a "paragraph" which shows the


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