[orca/570658-whereami] Remove vestiges of old where am I code



commit be4f3bcd608215476a05190fe9c968ab78f0b0ab
Author: Willie Walker <william walker sun com>
Date:   Tue Jun 9 12:49:02 2009 -0400

    Remove vestiges of old where am I code
---
 src/orca/where_am_I.py |  271 ------------------------------------------------
 1 files changed, 0 insertions(+), 271 deletions(-)

diff --git a/src/orca/where_am_I.py b/src/orca/where_am_I.py
index be13d7f..36125fa 100644
--- a/src/orca/where_am_I.py
+++ b/src/orca/where_am_I.py
@@ -73,9 +73,6 @@ class WhereAmI:
                     pyatspi.ROLE_SECTION,
                     pyatspi.ROLE_HEADING,
                     pyatspi.ROLE_DOCUMENT_FRAME]:
-            if False:
-                self._oldSpeakText(obj, basicOnly)
-            else:
                 self._speakText(obj, basicOnly)
         else:
             speech.speak(self.getWhereAmI(obj, basicOnly))
@@ -104,274 +101,6 @@ class WhereAmI:
                 return
         speech.speak(self.getWhereAmI(obj, basicOnly))
 
-    ###########################################################################
-    #                                                                         #
-    # WDW - all this can go...                                                #
-    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv #
-    #                                                                         #
-    ###########################################################################
-
-    def _oldSpeakText(self, obj, basicOnly):
-        """Text boxes present the following information (an example is
-        'Source display: text, blank, Alt O'):
-
-        1. label, if any
-        2. role
-        3. contents
-            A. if no text on the current line is selected, the current line
-            B. if text is selected on the current line, that text, followed
-            attibute information before  (bold "text")
-            by 'selected' (single press)
-            C. if the current line is blank/empty, 'blank'
-        4. accelerator (i.e. Alt plus the underlined letter), if any
-        5. tutorial string if enableTutorialMessages is set.
-
-        Gaim, gedit, OpenOffice Writer and Terminal
-        """
-        self._lastAttributeString = ""
-
-        # [[[TODO: WDW - we handle ROLE_ENTRY specially here because
-        # there is a bug in getRealActiveDescendant: it doesn't dive
-        # deep enough into the hierarchy (see comment #12 of bug
-        # #542714).  So, we'll do this nasty hack until we can feel
-        # more comfortable with mucking around with
-        # getRealActiveDescendant.]]]
-        #
-        ancestor = self._script.getAncestor(obj,
-                                            [pyatspi.ROLE_TABLE_CELL,
-                                             pyatspi.ROLE_LIST_ITEM],
-                                            [pyatspi.ROLE_FRAME])
-        if ancestor and not self._script.isLayoutOnly(ancestor.parent):
-            if ancestor.getRole() == pyatspi.ROLE_TABLE_CELL:
-                if obj.getRole() != pyatspi.ROLE_ENTRY:
-                    speech.speak(self.getWhereAmI(ancestor, basicOnly))
-                    return
-            else:
-                speech.speak(self.getWhereAmI(ancestor, basicOnly))
-                return
-
-        utterances = []
-        text = self._script.speechGenerator._getLabel(obj)
-        utterances.extend(text)
-
-        if settings.presentReadOnlyText \
-           and self._script.isReadOnlyTextArea(obj):
-            utterances.append(settings.speechReadOnlyString)
-
-        text = self._script.speechGenerator._getRoleName(obj)
-        utterances.extend(text)
-
-        [textContents, startOffset, endOffset, selected] = \
-                       self._getTextContents(obj, basicOnly)
-        if not basicOnly:
-            # Speak character attributes.
-            textContents = \
-                self._insertAttributes(obj, startOffset,
-                                       endOffset, textContents)
-            savedStyle = settings.verbalizePunctuationStyle
-            settings.verbalizePunctuationStyle = settings.PUNCTUATION_STYLE_SOME
-
-        text = textContents
-        utterances.append(text)
-        debug.println(self._debugLevel, "first text utterances=%s" % \
-                      utterances)
-        print "OLD:", utterances
-        speech.speak(utterances)
-
-        if not basicOnly:
-            settings.verbalizePunctuationStyle = savedStyle
-
-        utterances = []
-        if selected:
-            # Translators: when the user selects (highlights) text in
-            # a document, Orca lets them know this.
-            #
-            text = C_("text", "selected")
-            utterances.append(text)
-
-        text = self._script.speechGenerator._getAccelerator(obj)
-        utterances.extend(text)
-
-        getTutorial = self._script.tutorialGenerator.getTutorial
-        utterances.extend(getTutorial(obj, False, forceTutorial=True))
-
-        debug.println(self._debugLevel, "text utterances=%s" % \
-                      utterances)
-        speech.speak(utterances)
-        print "OLD:", utterances
-        print "NEW:", self.getWhereAmI(obj, basicOnly)
-        print "================"
-
-    def _getTextContents(self, obj, basicOnly):
-        """Returns utterences for text.
-
-        A. if no text on the current line is selected, the current line
-        B. if text is selected on the current line, that text, followed
-        by 'selected'
-        C. if the current line is blank/empty, 'blank'
-        """
-
-        textObj = obj.queryText()
-        caretOffset = textObj.caretOffset
-        textContents = ""
-        selected = False
-
-        nSelections = textObj.getNSelections()
-        debug.println(self._debugLevel,
-            "_getTextContents: caretOffset=%d, nSelections=%d" % \
-            (caretOffset, nSelections))
-
-        [current, other] = self._script.hasTextSelections(obj)
-        if current or other:
-            selected = True
-            [textContents, startOffset, endOffset] = \
-                self._script.getAllSelectedText(obj)
-        else:
-            # Get the line containing the caret
-            #
-            [line, startOffset, endOffset] = textObj.getTextAtOffset(
-                textObj.caretOffset,
-                pyatspi.TEXT_BOUNDARY_LINE_START)
-            debug.println(self._debugLevel, \
-                "_getTextContents: len=%d, start=%d, end=%d, line=<%s>" % \
-                (len(line), startOffset, endOffset, line))
-
-            if len(line):
-                line = self._script.adjustForRepeats(line)
-                textContents = line
-            else:
-                char = textObj.getTextAtOffset(caretOffset,
-                    pyatspi.TEXT_BOUNDARY_CHAR)
-                debug.println(self._debugLevel,
-                    "_getTextContents: character=<%s>, start=%d, end=%d" % \
-                    (char[0], char[1], char[2]))
-
-                if char[0] == "\n" and startOffset == caretOffset \
-                       and settings.speakBlankLines:
-                    # Translators: "blank" is a short word to mean the
-                    # user has navigated to an empty line.
-                    #
-                    textContents = (_("blank"))
-
-        return [textContents, startOffset, endOffset, selected]
-
-    def _insertAttributes(self, obj, startOffset, endOffset, line):
-        """Adjust line to include attribute information.
-        """
-
-        try:
-            text = obj.queryText()
-        except NotImplementedError:
-            return ""
-
-        newLine = ""
-        textOffset = startOffset
-
-        for i in range(0, len(line)):
-            attribs = self._getAttributesForChar(obj, text, textOffset, line, i)
-            debug.println(self._debugLevel,
-                          "line attribs <%s>" % (attribs))
-            if attribs:
-                if newLine:
-                    newLine += " ; "
-                newLine += attribs
-                newLine += " "
-
-            newLine += line[i]
-            textOffset += 1
-
-        attribs = self._getAttributesForChar(obj,
-                                             text,
-                                             startOffset,
-                                             line,
-                                             0,
-                                             ["paragraph-style"])
-        if attribs:
-            if newLine:
-                newLine += " ; "
-            newLine += attribs
-
-        debug.println(self._debugLevel, "newLine: <%s>" % (newLine))
-
-        return newLine
-
-    def _getAttributesForChar(self,
-                              obj,
-                              text,
-                              textOffset,
-                              line,
-                              lineIndex,
-                              keys=["style", "weight", "underline"]):
-
-        attribStr = ""
-
-        defaultAttributes = text.getDefaultAttributes()
-        attributesDictionary = \
-            self._script.attributeStringToDictionary(defaultAttributes)
-
-        charAttributes = text.getAttributes(textOffset)
-        if charAttributes[0]:
-            charDict = \
-                self._script.attributeStringToDictionary(charAttributes[0])
-            for key in charDict.keys():
-                attributesDictionary[key] = charDict[key]
-
-        if attributesDictionary:
-            for key in keys:
-                localizedKey = text_attribute_names.getTextAttributeName(key)
-                if key in attributesDictionary:
-                    attribute = attributesDictionary[key]
-                    localizedValue = \
-                        text_attribute_names.getTextAttributeName(attribute)
-                    if attribute:
-                        # If it's the 'weight' attribute and greater than 400,
-                        # just speak it as bold, otherwise speak the weight.
-                        #
-                        if key == "weight":
-                            if int(attribute) > 400:
-                                attribStr += " "
-                                # Translators: bold as in the font sense.
-                                #
-                                attribStr += _("bold")
-                        elif key == "underline":
-                            if attribute != "none":
-                                attribStr += " "
-                                attribStr += localizedKey
-                        elif key == "style":
-                            if attribute != "normal":
-                                attribStr += " "
-                                attribStr += localizedValue
-                        else:
-                            attribStr += " "
-                            attribStr += (localizedKey + " " + localizedValue)
-
-            # Also check to see if this is a hypertext link.
-            #
-            if self._script.getLinkIndex(obj, textOffset) >= 0:
-                attribStr += " "
-                # Translators: this indicates that this piece of
-                # text is a hypertext link.
-                #
-                attribStr += _("link")
-
-            if line:
-                debug.println(self._debugLevel,
-                              "char <%s>: %s" % (line[lineIndex], attribStr))
-
-        # Only return attributes for the beginning of an attribute run.
-        if attribStr != self._lastAttributeString:
-            self._lastAttributeString = attribStr
-            return attribStr
-        else:
-            return ""
-
-    ###########################################################################
-    #                                                                         #
-    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #
-    # WDW - all this can go...                                                #
-    #                                                                         #
-    ###########################################################################
-
     def getWhereAmI(self, obj, basicOnly):
         """Returns an array of strings (and possibly voice and audio
         specifications) that represent the complete speech for the



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