[orca] Remove unused, unsupported settings and associated code



commit ad038616a7bb2618c2ddd1b442a03454093cce02
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jan 12 11:42:23 2018 -0500

    Remove unused, unsupported settings and associated code

 src/orca/braille.py  |  127 --------------------------------------------------
 src/orca/settings.py |    8 ---
 2 files changed, 0 insertions(+), 135 deletions(-)
---
diff --git a/src/orca/braille.py b/src/orca/braille.py
index 32f1a1c..2806d18 100644
--- a/src/orca/braille.py
+++ b/src/orca/braille.py
@@ -1022,127 +1022,6 @@ def setFocus(region, panToFocus=True, getLinkMask=True):
 
     viewport[0] = max(0, offset)
 
-def _realignViewport(string, focusOffset, cursorOffset):
-    """Realigns the braille display to account for braille alignment
-    preferences.  By the time this method is called, if there is a
-    cursor cell to be displayed, it should already be somewhere in
-    the viewport.  All we're going to do is adjust the viewport a
-    little to align the viewport edge according to the
-    settings.brailleAlignmentStyle.
-
-    Arguments:
-    - string: the entire string to be presented
-    - focusOffset: where in string the focused region begins
-    - cursorOffset: where in the string the cursor should be
-
-    Returns: the viewport[0] value is potentially modified.
-    """
-
-    # pylint complains we don't set viewport, which in fact we do if
-    # 'jump' ends up being set.
-    #
-    # pylint: disable-msg=W0602
-    #
-    global viewport
-
-    jump = 0
-
-    # If there's no cursor to show or we're doing
-    # ALIGN_BRAILLE_BY_EDGE, the viewport should already be where it
-    # belongs.  Otherwise, we may need to do some adjusting of the
-    # viewport.
-    #
-    if (cursorOffset < 0) \
-       or (settings.brailleAlignmentStyle == settings.BRAILLE_ALIGN_BY_EDGE) \
-       or not (cursorOffset >= viewport[0]
-               and cursorOffset < (viewport[0] + _displaySize[0])):
-        pass
-    else:
-        # The left and right margin values are absolute values in the
-        # string and represent where in the string the margins of the
-        # current viewport lie.  Note these are margins and not the
-        # actual edges of the viewport.
-        #
-        leftMargin = viewport[0] + settings.brailleAlignmentMargin - 1
-        rightMargin = (viewport[0] + _displaySize[0]) \
-                      - settings.brailleAlignmentMargin
-
-        # This represents how far left in the string we want to search
-        # and also how far left we'll realign the viewport. Setting it
-        # to focusOffset means we won't move the viewport further left
-        # than the beginning of the current region with focus.
-        #
-        leftMostEdge = max(0, focusOffset)
-
-        # If we align by margin, we just want to keep the cursor at or
-        # in between the margins.  The only time we go outside the
-        # margins are when we are at the ends of the string.
-        #
-        if settings.brailleAlignmentStyle == settings.BRAILLE_ALIGN_BY_MARGIN:
-            if cursorOffset < leftMargin:
-                jump = cursorOffset - leftMargin
-            elif cursorOffset > rightMargin:
-                jump = cursorOffset - rightMargin
-        elif settings.brailleAlignmentStyle == settings.BRAILLE_ALIGN_BY_WORD:
-            # When we align by word, we want to try to show complete
-            # words at the edges of the braille display.  When we're
-            # near the left edge, we'll try to start a word at the
-            # left edge.  When we're near the right edge, we'll try to
-            # end a word at the right edge.
-            #
-            if cursorOffset < leftMargin:
-                # Find the index of the character that is the first
-                # letter of the word prior to left edge of the
-                # viewport.
-                #
-                inWord = False
-                leftWordEdge = viewport[0] - 1
-                while leftWordEdge >= leftMostEdge:
-                    if not string[leftWordEdge] in ' \t\n\r\v\f':
-                        inWord = True
-                    elif inWord:
-                        leftWordEdge += 1
-                        break
-                    leftWordEdge -= 1
-                leftWordEdge = max(leftMostEdge, leftWordEdge)
-                jump = leftWordEdge - viewport[0]
-            elif cursorOffset > rightMargin:
-                # Find the index of the character that is the last
-                # letter of the word after the right edge of the
-                # viewport.
-                #
-                inWord = False
-                rightWordEdge = viewport[0] + _displaySize[0]
-                while rightWordEdge < len(string):
-                    if not string[rightWordEdge] in ' \t\n\r\v\f':
-                        inWord = True
-                    elif inWord:
-                        break
-                    rightWordEdge += 1
-                rightWordEdge = min(len(string), rightWordEdge)
-                jump = max(0, rightWordEdge - (viewport[0] + _displaySize[0]))
-
-            # We use the brailleMaximumJump to help us handle really
-            # long words.  The (jump/abs(jump)) stuff is a quick and
-            # dirty way to retain the sign (i.e., +1 or -1).
-            #
-            if abs(jump) > settings.brailleMaximumJump:
-                jump = settings.brailleMaximumJump * (jump/abs(jump))
-
-    if jump:
-        # Set the viewport's left edge based upon the jump, making
-        # sure we don't go any farther left than the leftMostEdge.
-        #
-        viewport[0] = max(leftMostEdge, viewport[0] + jump)
-
-        # Now, make sure we don't scroll too far to the right.  That
-        # is, avoid showing blank spaces to the right if there is more
-        # of the string that can be shown.
-        #
-        viewport[0] = min(viewport[0],
-                          max(leftMostEdge, len(string) - _displaySize[0]))
-        viewport[0] = int(viewport[0])
-
 def refresh(panToCursor=True,
             targetCursorCell=0,
             getLinkMask=True,
@@ -1266,12 +1145,6 @@ def refresh(panToCursor=True,
         elif cursorOffset >= (viewport[0] + _displaySize[0]):
             viewport[0] = max(0, cursorOffset - _displaySize[0] + 1)
 
-    # The cursorOffset should be somewhere in the viewport right now.
-    # Let's try to realign the viewport so that the cursor shows up
-    # according to the settings.brailleAlignmentStyle setting.
-    #
-    _realignViewport(string, focusOffset, cursorOffset)
-
     startPos = int(viewport[0])
     endPos = startPos + _displaySize[0]
 
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 3257f11..c783e51 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -68,7 +68,6 @@ userCustomizableSettings = [
     "brailleRolenameStyle",
     "brailleSelectorIndicator",
     "brailleLinkIndicator",
-    "brailleAlignmentStyle",
     "enableSound",
     "soundVolume",
     "playSoundForRole",
@@ -155,10 +154,6 @@ LAPTOP_MODIFIER_KEYS  = ["Caps_Lock"]
 VERBOSITY_LEVEL_BRIEF   = 0
 VERBOSITY_LEVEL_VERBOSE = 1
 
-BRAILLE_ALIGN_BY_EDGE   = 0
-BRAILLE_ALIGN_BY_MARGIN = 1
-BRAILLE_ALIGN_BY_WORD   = 2
-
 BRAILLE_UNDERLINE_NONE = 0x00 # 00000000
 BRAILLE_UNDERLINE_7    = 0x40 # 01000000
 BRAILLE_UNDERLINE_8    = 0x80 # 10000000
@@ -275,9 +270,6 @@ brailleSelectorIndicator       = BRAILLE_UNDERLINE_BOTH
 brailleLinkIndicator           = BRAILLE_UNDERLINE_BOTH
 textAttributesBrailleIndicator = BRAILLE_UNDERLINE_NONE
 brailleVerbosityLevel          = VERBOSITY_LEVEL_VERBOSE
-brailleAlignmentStyle          = BRAILLE_ALIGN_BY_EDGE
-brailleAlignmentMargin         = 3
-brailleMaximumJump             = 8
 
 # Sound
 enableSound = True


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