orca r3807 - in trunk: . src/orca src/orca/scripts
- From: eitani svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r3807 - in trunk: . src/orca src/orca/scripts
- Date: Fri, 4 Apr 2008 22:31:52 +0100 (BST)
Author: eitani
Date: Fri Apr 4 22:31:52 2008
New Revision: 3807
URL: http://svn.gnome.org/viewvc/orca?rev=3807&view=rev
Log:
* src/orca/Gecko.py:
src/orca/default.py:
src/orca/flat_review.py:
src/orca/scripts/gnome-terminal.py:
src/orca/braille.py:
Reopening bug #520612 - This patch needs a lot more work,
reverting for now...
Modified:
trunk/ChangeLog
trunk/src/orca/Gecko.py
trunk/src/orca/braille.py
trunk/src/orca/default.py
trunk/src/orca/flat_review.py
trunk/src/orca/scripts/gnome-terminal.py
Modified: trunk/src/orca/Gecko.py
==============================================================================
--- trunk/src/orca/Gecko.py (original)
+++ trunk/src/orca/Gecko.py Fri Apr 4 22:31:52 2008
@@ -4641,30 +4641,23 @@
focusedRegion = regions[0]
elif text and (obj.getRole() != pyatspi.ROLE_MENU_ITEM):
string = text.getText(startOffset, endOffset)
- string = string.strip(" ")
- endOffset = startOffset + len(string)
- if endOffset == startOffset:
- continue
-
+ if string.endswith(" "):
+ endOffset -= 1
+ string = text.getText(startOffset, endOffset)
+
+ regions = [braille.Region(
+ string,
+ focusedCharacterOffset - startOffset,
+ expandOnCursor=True)]
if obj.getRole() == pyatspi.ROLE_LINK:
link = obj
else:
link = self.getAncestor(obj,
[pyatspi.ROLE_LINK],
[pyatspi.ROLE_DOCUMENT_FRAME])
-
- if not link:
- regions = [braille.Text(obj,
- startOffset=startOffset,
- endOffset=endOffset)]
-
if link:
- regions = [braille.Component(
- link,
- string + " " + \
- rolenames.getBrailleForRoleName(link),
- focusedCharacterOffset - startOffset,
- expandOnCursor=True)]
+ regions.append(braille.Region(
+ " " + rolenames.getBrailleForRoleName(link)))
elif obj.getRole() == pyatspi.ROLE_CAPTION:
regions.append(braille.Region(
" " + rolenames.getBrailleForRoleName(obj)))
@@ -8249,10 +8242,6 @@
# #
####################################################################
- def setCaretOffset(self, obj, characterOffset):
- self.setCaretPosition(obj, characterOffset)
- self.updateBraille(obj)
-
def setCaretPosition(self, obj, characterOffset):
"""Sets the caret position to the given character offset in the
given object.
Modified: trunk/src/orca/braille.py
==============================================================================
--- trunk/src/orca/braille.py (original)
+++ trunk/src/orca/braille.py Fri Apr 4 22:31:52 2008
@@ -454,8 +454,7 @@
[[[TODO: WDW - need to add in text selection capabilities. Logged
as bugzilla bug 319754.]]]"""
- def __init__(self, accessible, label="", eol="",
- startOffset=0, endOffset=-1):
+ def __init__(self, accessible, label="", eol=""):
"""Creates a new Text region.
Arguments:
@@ -468,17 +467,20 @@
[string, self.caretOffset, self.lineOffset] = \
orca_state.activeScript.getTextLineAtCaret(self.accessible)
- if endOffset == -1:
- self.endOffset = len(string)
- else:
- self.endOffset = endOffset - self.lineOffset
-
- self.startOffset = startOffset - self.lineOffset
-
- string = string.decode("UTF-8")[self.startOffset:self.endOffset]
-
+ # Sometimes, gnome-terminal will give us very odd values when
+ # the user is editing using 'vi' and has positioned the caret
+ # at the first character of the first line. In this case, we
+ # end up getting a very large negative number for the line offset.
+ # So, we just assume the user is at the first character.
+ #
+ if self.lineOffset < 0:
+ self.caretOffset = 0
+ self.lineOffset = 0
+ [string, startOffset, endOffset] = \
+ self.accessible.queryText().getTextAtOffset(
+ 0,
+ pyatspi.TEXT_BOUNDARY_LINE_START)
- self.caretOffset -= self.startOffset
cursorOffset = min(self.caretOffset - self.lineOffset, len(string))
self._maxCaretOffset = self.lineOffset + len(string.decode("UTF-8"))
@@ -538,8 +540,7 @@
return
newCaretOffset = min(self.lineOffset + offset, self._maxCaretOffset)
- orca_state.activeScript.setCaretOffset(
- self.accessible, newCaretOffset)
+ self.accessible.queryText().setCaretOffset(newCaretOffset)
def getAttributeMask(self):
"""Creates a string which can be used as the attrOr field of brltty's
@@ -570,8 +571,6 @@
attributes, startOffset, endOffset = \
script.getTextAttributes(self.accessible,
offset, True)
- if endOffset <= offset:
- break
mask = settings.TEXT_ATTR_BRAILLE_NONE
offset = endOffset
for attrib in attributes:
@@ -611,7 +610,6 @@
# any label that might be present.
#
regionMask += [0]*len(self.eol)
-
if self.label:
regionMask = [0]*len(self.label) + regionMask
@@ -625,7 +623,6 @@
def displayToBufferOffset(self, display_offset):
offset = Region.displayToBufferOffset(self, display_offset)
- offset += self.startOffset
offset -= len(self.label)
return offset
@@ -647,6 +644,7 @@
for this Region if it gets focus.
- zone: the flat review Zone associated with this component
"""
+
Component.__init__(self, accessible, string,
cursorOffset, expandOnCursor=True)
self.zone = zone
@@ -667,6 +665,7 @@
- lineOffset: the character offset into where the text line starts
- zone: the flat review Zone associated with this component
"""
+
Region.__init__(self, string, expandOnCursor=True)
self.accessible = accessible
self.lineOffset = lineOffset
@@ -680,7 +679,7 @@
offset = self.displayToBufferOffset(offset)
newCaretOffset = self.lineOffset + offset
- orca_state.activeScript.setCaretOffset(self.accessible, newCaretOffset)
+ self.accessible.queryText().setCaretOffset(newCaretOffset)
class Line:
"""A horizontal line on the display. Each Line is composed of a sequential
Modified: trunk/src/orca/default.py
==============================================================================
--- trunk/src/orca/default.py (original)
+++ trunk/src/orca/default.py Fri Apr 4 22:31:52 2008
@@ -6822,21 +6822,6 @@
"""
print "\a"
- def setCaretOffset(self, obj, offset):
- """Set the caret offset on a given accessible. Similar to
- Accessible.setCaretOffset()
-
- Arguments:
- - obj: Given accessible object.
- - offset: Offset to hich to set the caret.
- """
- try:
- texti = obj.queryText()
- except:
- return None
-
- texti.setCaretOffset(offset)
-
def attribsToDictionary(self, dict_string):
"""Creates a Python dict from a typical attributes list returned from
different AT-SPI methods.
@@ -7001,7 +6986,7 @@
ti = acc.queryText()
except NotImplementedError:
return '', 0, 0
-
+
text_contents = ti.getText(0, -1)
line_offsets = []
start_offset = 0
Modified: trunk/src/orca/flat_review.py
==============================================================================
--- trunk/src/orca/flat_review.py (original)
+++ trunk/src/orca/flat_review.py Fri Apr 4 22:31:52 2008
@@ -531,19 +531,10 @@
# The 'isinstance(zone, TextZone)' test is a sanity check
# to handle problems with Java text. See Bug 435553.
if isinstance(zone, TextZone) and \
- ((zone.accessible.getRole() in \
- (pyatspi.ROLE_TEXT,
- pyatspi.ROLE_PASSWORD_TEXT,
- pyatspi.ROLE_TERMINAL)) or \
- # [[[TODO: Eitan - HACK:
- # This is just to get FF3 cursor key routing support.
- # We really should not be determining all this stuff here,
- # it should be in the scripts.
- # Same applies to roles above.]]]
- (zone.accessible.getRole() in \
- (pyatspi.ROLE_PARAGRAPH,
- pyatspi.ROLE_HEADING,
- pyatspi.ROLE_LINK))):
+ ((zone.accessible.getRole() == pyatspi.ROLE_TEXT) \
+ or (zone.accessible.getRole() == \
+ pyatspi.ROLE_PASSWORD_TEXT) \
+ or (zone.accessible.getRole() == pyatspi.ROLE_TERMINAL)):
region = braille.ReviewText(zone.accessible,
zone.string,
zone.startOffset,
Modified: trunk/src/orca/scripts/gnome-terminal.py
==============================================================================
--- trunk/src/orca/scripts/gnome-terminal.py (original)
+++ trunk/src/orca/scripts/gnome-terminal.py Fri Apr 4 22:31:52 2008
@@ -266,33 +266,3 @@
and self.isWordDelimiter(text.decode("UTF-8")[-1:]):
if matchFound:
self.echoPreviousWord(event.source)
-
- def getTextLineAtCaret(self, acc):
- """Gets the line of text where the caret is.
-
- Argument:
- - obj: an Accessible object that implements the AccessibleText
- interface
-
- Returns the [string, caretOffset, startOffset] for the line of text
- where the caret is.
- """
- string, caretOffset, lineOffset = \
- default.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
- # at the first character of the first line. In this case, we
- # end up getting a very large negative number for the line offset.
- # So, we just assume the user is at the first character.
- #
- if lineOffset < 0:
- caretOffset = 0
- lineOffset = 0
- texti = acc.queryText()
- string, startOffset, endOffset = \
- texti.getTextAtOffset(0,
- pyatspi.TEXT_BOUNDARY_LINE_START)
-
- return string, caretOffset, lineOffset
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]