and the set returned at a particular character offset via Text::getAttributeRun.
"""
- def addSelection(self, *args, **kwargs):
+ def addSelection(self, index):
"""
The result of calling addSelection on objects which already have
one selection present, and which do not include STATE_MULTISELECTABLE,
to copy the text into the relevant selection buffer).
"""
func = self.get_dbus_method("addSelection", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(index)
- def getAttributeRun(self, *args, **kwargs):
+ def getAttributeRun(self, offset):
"""
Query a particular text object for the text attributes defined
at a given offset, obtaining the start and end of the "attribute
the 'default' attributes.
"""
func = self.get_dbus_method("getAttributeRun", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ [attrs, startOffset, endOffset] = func(offset, includeDefaults)
+ dict = [key + ':' + value for key, value in attrs.values()]
+ return [dict, startOffset, endOffset]
- def getAttributeValue(self, *args, **kwargs):
+ def getAttributeValue(self, offset, attributeName):
"""
Get the string value of a named attribute at a given offset,
if defined.
to "name", if defined.
"""
func = self.get_dbus_method("getAttributeValue", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset, attributeName)
def getAttributes(self, offset):
"""
of colon-delimited name-value pairs.
"""
func = self.get_dbus_method("getAttributes", dbus_interface=ATSPI_TEXT)
- return func(dbus.Int32(offset))
+ [attrs, startOffset, endOffset] = func(dbus.Int32(offset))
+ dict = [key + ':' + value for key, value in attrs]
+ return [dict, startOffset, endOffset]
- def getBoundedRanges(self, *args, **kwargs):
+ def getBoundedRanges(self, x, y, width, height, coordType, xClipType, yClipType):
+ #TODO Return a list of range structures
"""
Return the text content within a bounding box, as a list of Range
structures. Depending on the TEXT_CLIP_TYPE parameters, glyphs
the y direction is included.
"""
func = self.get_dbus_method("getBoundedRanges", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(x, y, width, height, coordType, xClipType, yClipType)
- def getCharacterAtOffset(self, *args, **kwargs):
+ def getCharacterAtOffset(self, offset):
"""
+ @param : offset
+ position
@return an unsigned long integer whose value corresponds to the
UCS-4 representation of the character at the specified text offset,
or 0 if offset is out of range.
"""
func = self.get_dbus_method("getCharacterAtOffset", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset)
- def getCharacterExtents(self, *args, **kwargs):
+ def getCharacterExtents(self, offset, x, y, width, height, coordType):
"""
Obtain a the bounding box, as x, y, width, and height, of the
character or glyph at a particular character offset in this object's
down.
"""
func = self.get_dbus_method("getCharacterExtents", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset, x, y, width, height, coordType)
- def getDefaultAttributeSet(self, *args, **kwargs):
+ def getDefaultAttributeSet(self):
"""
Return an AttributeSet containing the text attributes which apply
to all text in the object by virtue of the default settings of
the default or implied text weight in the default AttributeSet.
"""
func = self.get_dbus_method("getDefaultAttributeSet", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return [key + ':' + value for key, value in func().values()]
- def getDefaultAttributes(self, *args, **kwargs):
+ def getDefaultAttributes(self):
"""
Deprecated in favor of getDefaultAttributeSet.
@return the attributes which apply to the entire text content,
but which were not explicitly specified by the content creator.
"""
func = self.get_dbus_method("getDefaultAttributes", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return ';'.join([key + ':' + value for key, value in func().iteritems()])
- def getNSelections(self, *args, **kwargs):
+ def getNSelections(self):
"""
Obtain the number of separate, contiguous selections in the current
Text object. Text objects which do not implement selection of
object.
"""
func = self.get_dbus_method("getNSelections", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func()
- def getOffsetAtPoint(self, *args, **kwargs):
+ def getOffsetAtPoint(self, x, y, coordType):
"""
Get the offset of the character at a given onscreen coordinate.
The coordinate system used to interpret x and y is determined
-1 if the point is outside the bounds of any glyph.
"""
func = self.get_dbus_method("getOffsetAtPoint", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(x, y, coordType)
- def getRangeExtents(self, *args, **kwargs):
+ def getRangeExtents(self, startOffset, endOffset, coordType):
"""
Obtain the bounding box which entirely contains a given text
range. Negative values may be returned for the bounding box parameters
to the corner of the containing toplevel window.
"""
func = self.get_dbus_method("getRangeExtents", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(startOffset, endOffset, coordType)
- def getSelection(self, *args, **kwargs):
+ def getSelection(self, selectionNum):
"""
The result of calling getSelection with an out-of-range selectionNum
(i.e. for a selection which does not exist) is not strictly defined,
but should set endOffset equal to startOffset.
+ @param : selectionNum
+ indicates which of a set of non-contiguous selections to modify.
+ @param : startOffset
+ back-filled with the starting offset of the resulting substring,
+ if one exists.
+ @param : endOffset
+ back-filled with the offset of the character immediately following
+ the resulting substring, if one exists.
"""
func = self.get_dbus_method("getSelection", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(selectionNum)
def getText(self, startOffset, endOffset):
"""
Obtain all or part of the onscreen textual content of a Text
object. If endOffset is specified as "-1", then this method will
return the entire onscreen textual contents of the Text object.
+ @param : startOffset
+ back-filled with the starting offset of the resulting substring,
+ if one exists.
+ @param : endOffset
+ back-filled with the offset of the character immediately following
+ the resulting substring, if one exists.
@return the textual content of the current Text object beginning
startOffset (inclusive) up to but not including the character
at endOffset.
endOffset = -1
return func(dbus.Int32(startOffset), dbus.Int32(endOffset))
- def getTextAfterOffset(self, *args, **kwargs):
+ def getTextAfterOffset(self, offset, type):
"""
Obtain a subset of the text content of an object which entirely
follows offset, delimited by character, word, line, or sentence
the object, delimited by the specified boundary condition.
"""
func = self.get_dbus_method("getTextAfterOffset", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset, type)
- def getTextAtOffset(self, *args, **kwargs):
+ def getTextAtOffset(self, offset, type):
"""
Obtain a subset of the text content of an object which includes
the specified offset, delimited by character, word, line, or
the object, delimited by the specified boundary condition.
"""
func = self.get_dbus_method("getTextAtOffset", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset, type)
- def getTextBeforeOffset(self, *args, **kwargs):
+ def getTextBeforeOffset(self, offset, type):
"""
Obtain a subset of the text content of an object which entirely
precedes offset, delimited by character, word, line, or sentence
the object, delimited by the specified boundary condition.
"""
func = self.get_dbus_method("getTextBeforeOffset", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset, type)
- def removeSelection(self, *args, **kwargs):
+ def removeSelection(self, selectionNum):
"""
Deselect the text contained in the specified selectionNum, if
such a selection exists, otherwise do nothing. Removal of a non-existant
selectionNum has no effect.
+ @param : selectionNum
+ indicates which of a set of non-contiguous selections to modify.
@return True if the selection was successfully removed, False
otherwise.
"""
func = self.get_dbus_method("removeSelection", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(selectionNum)
- def setCaretOffset(self, *args, **kwargs):
+ def setCaretOffset(self, offset):
"""
Programmatically move the text caret (visible or virtual, as
above) to a given position.
caret could not be moved to the requested position.
"""
func = self.get_dbus_method("setCaretOffset", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(offset)
- def setSelection(self, *args, **kwargs):
+ def setSelection(self, selectionNum, startOffset, endOffset):
"""
Modify an existing selection's start or ending offset.
Calling setSelection for a selectionNum that is not already defined
successfully modified, False otherwise.
"""
func = self.get_dbus_method("setSelection", dbus_interface=ATSPI_TEXT)
- return func(*args, **kwargs)
+ return func(selectionNum, startOffset, endOffset)
def get_caretOffset(self):
- return self._pgetter(self._dbus_interface, "caretOffset")
- def set_caretOffset(self, value):
- self._psetter(self._dbus_interface, "caretOffset", value)
+ return dbus.Int32(self._pgetter(self._dbus_interface, "caretOffset"))
_caretOffsetDoc = \
"""
The current offset of the text caret in the Text object. This
as a character offset, as opposed to a byte offset into a text
buffer or a column offset.
"""
- caretOffset = property(fget=get_caretOffset, fset=set_caretOffset, doc=_caretOffsetDoc)
+ caretOffset = property(fget=get_caretOffset, doc=_caretOffsetDoc)
def get_characterCount(self):
- return self._pgetter(self._dbus_interface, "characterCount")
- def set_characterCount(self, value):
- self._psetter(self._dbus_interface, "characterCount", value)
+ return dbus.Int32(self._pgetter(self._dbus_interface, "characterCount"))
_characterCountDoc = \
"""
The total current number of characters in the Text object, including
whitespace and non-spacing characters.
"""
- characterCount = property(fget=get_characterCount, fset=set_characterCount, doc=_characterCountDoc)
+ characterCount = property(fget=get_characterCount, doc=_characterCountDoc)
class Range(list):
def __new__(cls, startOffset, endOffset, content, data):