Skip to content

Commit

Permalink
Rename TextInfos (uppercase t) to textInfos (lowercase t).
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelDCurran committed May 4, 2009
1 parent dc1ac90 commit 200bf5c
Show file tree
Hide file tree
Showing 27 changed files with 349 additions and 349 deletions.
38 changes: 19 additions & 19 deletions source/NVDAObjects/IAccessible/MSHTML.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import IAccessibleHandler
from keyUtils import key, sendKey
import api
import TextInfos
import textInfos
from logHandler import log
import speech
import controlTypes
Expand Down Expand Up @@ -84,7 +84,7 @@ def IHTMLElementFromIAccessible(IAccessibleObject):
ptr=ctypes.POINTER(comtypes.automation.IDispatch)(interfaceAddress)
return comtypes.client.dynamic.Dispatch(ptr)

class MSHTMLTextInfo(TextInfos.TextInfo):
class MSHTMLTextInfo(textInfos.TextInfo):

def _expandToLine(self,textRange):
parent=textRange.parentElement()
Expand All @@ -111,23 +111,23 @@ def __init__(self,obj,position,_rangeObj=None):
if _rangeObj:
self._rangeObj=_rangeObj.duplicate()
return
if position in (TextInfos.POSITION_CARET,TextInfos.POSITION_SELECTION):
if position in (textInfos.POSITION_CARET,textInfos.POSITION_SELECTION):
if self.obj.IHTMLElement.uniqueID!=self.obj.IHTMLElement.document.activeElement.uniqueID:
raise RuntimeError("Only works with currently selected element")
self._rangeObj=self.obj.IHTMLElement.document.selection.createRange()
if position==TextInfos.POSITION_CARET:
if position==textInfos.POSITION_CARET:
self._rangeObj.collapse()
return
self._rangeObj=self.obj.IHTMLElement.createTextRange()
if position==TextInfos.POSITION_FIRST:
if position==textInfos.POSITION_FIRST:
self._rangeObj.collapse()
elif position==TextInfos.POSITION_LAST:
elif position==textInfos.POSITION_LAST:
self._rangeObj.expand("textedit")
self.collapse(True)
self._rangeObj.move("character",-1)
elif position==TextInfos.POSITION_ALL:
elif position==textInfos.POSITION_ALL:
self._rangeObj.expand("textedit")
elif isinstance(position,TextInfos.Bookmark):
elif isinstance(position,textInfos.Bookmark):
if position.infoClass==self.__class__:
self._rangeObj.moveToBookmark(position.data)
else:
Expand All @@ -136,19 +136,19 @@ def __init__(self,obj,position,_rangeObj=None):
raise NotImplementedError("position: %s"%position)

def expand(self,unit):
if False: #unit==TextInfos.UNIT_LINE and self.basePosition not in [TextInfos.POSITION_SELECTION,TextInfos.POSITION_CARET]:
unit=TextInfos.UNIT_SENTENCE
if unit==TextInfos.UNIT_READINGCHUNK:
unit=TextInfos.UNIT_SENTENCE
if unit in [TextInfos.UNIT_CHARACTER,TextInfos.UNIT_WORD,TextInfos.UNIT_SENTENCE,TextInfos.UNIT_PARAGRAPH]:
if False: #unit==textInfos.UNIT_LINE and self.basePosition not in [textInfos.POSITION_SELECTION,textInfos.POSITION_CARET]:
unit=textInfos.UNIT_SENTENCE
if unit==textInfos.UNIT_READINGCHUNK:
unit=textInfos.UNIT_SENTENCE
if unit in [textInfos.UNIT_CHARACTER,textInfos.UNIT_WORD,textInfos.UNIT_SENTENCE,textInfos.UNIT_PARAGRAPH]:
res=self._rangeObj.expand(unit)
if not res and unit=="word": #IHTMLTxtRange.expand fails to handle word when at the start of a field
res=self._rangeObj.moveEnd(unit,1)
if res:
self._rangeObj.moveStart(unit,-1)
elif unit==TextInfos.UNIT_LINE:
elif unit==textInfos.UNIT_LINE:
self._expandToLine(self._rangeObj)
elif unit==TextInfos.UNIT_STORY:
elif unit==textInfos.UNIT_STORY:
self._rangeObj.expand("textedit")
else:
raise NotImplementedError("unit: %s"%unit)
Expand Down Expand Up @@ -178,9 +178,9 @@ def _get_text(self):
return text

def move(self,unit,direction, endPoint=None):
if unit in [TextInfos.UNIT_READINGCHUNK,TextInfos.UNIT_LINE]:
unit=TextInfos.UNIT_SENTENCE
if unit==TextInfos.UNIT_STORY:
if unit in [textInfos.UNIT_READINGCHUNK,textInfos.UNIT_LINE]:
unit=textInfos.UNIT_SENTENCE
if unit==textInfos.UNIT_STORY:
unit="textedit"
if endPoint=="start":
moveFunc=self._rangeObj.moveStart
Expand All @@ -198,7 +198,7 @@ def updateSelection(self):
self._rangeObj.select()

def _get_bookmark(self):
return TextInfos.Bookmark(self.__class__,self._rangeObj.getBookmark())
return textInfos.Bookmark(self.__class__,self._rangeObj.getBookmark())

class MSHTML(IAccessible):

Expand Down
16 changes: 8 additions & 8 deletions source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from comtypes import COMError
import os
import tones
import TextInfos.offsets
import textInfos.offsets
import time
import IAccessibleHandler
import JABHandler
Expand Down Expand Up @@ -42,7 +42,7 @@ def getNVDAObjectFromPoint(x,y):
obj=IAccessible(IAccessibleObject=pacc,IAccessibleChildID=child)
return obj

class IA2TextTextInfo(TextInfos.offsets.OffsetsTextInfo):
class IA2TextTextInfo(textInfos.offsets.OffsetsTextInfo):

def _getOffsetFromPoint(self,x,y):
if self.obj.IAccessibleTextObject.nCharacters>0:
Expand All @@ -55,7 +55,7 @@ def _getPointFromOffset(self,offset):
res=self.obj.IAccessibleTextObject.characterExtents(offset,IAccessibleHandler.IA2_COORDTYPE_SCREEN_RELATIVE)
except:
raise NotImplementedError
point=TextInfos.Point(res[0]+(res[2]/2),res[1]+(res[3]/2))
point=textInfos.Point(res[0]+(res[2]/2),res[1]+(res[3]/2))
return point

def _get_unit_mouseChunk(self):
Expand Down Expand Up @@ -132,8 +132,8 @@ def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):
startOffset,endOffset,attribsString=self.obj.IAccessibleTextObject.attributes(offset)
except COMError:
log.debugWarning("could not get attributes",exc_info=True)
return TextInfos.FormatField(),(self._startOffset,self._endOffset)
formatField=TextInfos.FormatField()
return textInfos.FormatField(),(self._startOffset,self._endOffset)
formatField=textInfos.FormatField()
if not attribsString and offset>0:
try:
attribsString=self.obj.IAccessibleTextObject.attributes(offset-1)[2]
Expand Down Expand Up @@ -913,10 +913,10 @@ def event_caret(self):
if not caretInDocument:
return
try:
info=self.makeTextInfo(TextInfos.POSITION_CARET)
info=self.makeTextInfo(textInfos.POSITION_CARET)
except RuntimeError:
return
info.expand(TextInfos.UNIT_CHARACTER)
info.expand(textInfos.UNIT_CHARACTER)
try:
char=ord(info.text)
except:
Expand Down Expand Up @@ -1055,7 +1055,7 @@ def getDialogText(cls,obj):
#However, graphics, static text, separators and Windows are ok.
if childName and index<(childCount-1) and children[index+1].role not in (controlTypes.ROLE_GRAPHIC,controlTypes.ROLE_STATICTEXT,controlTypes.ROLE_SEPARATOR,controlTypes.ROLE_WINDOW) and children[index+1].name==childName:
continue
childText=child.makeTextInfo(TextInfos.POSITION_ALL).text
childText=child.makeTextInfo(textInfos.POSITION_ALL).text
if not childText or childText.isspace() and child.TextInfo!=NVDAObjectTextInfo:
childText=child.basicText
textList.append(childText)
Expand Down
4 changes: 2 additions & 2 deletions source/NVDAObjects/IAccessible/mozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import IAccessibleHandler
import controlTypes
from . import IAccessible
import TextInfos
import textInfos

class Mozilla(IAccessible):

Expand Down Expand Up @@ -68,5 +68,5 @@ class Label(Mozilla):
def _get_name(self):
name=super(Label,self)._get_name()
if not name or name=="":
name=self.makeTextInfo(TextInfos.POSITION_ALL).text
name=self.makeTextInfo(textInfos.POSITION_ALL).text
return name
4 changes: 2 additions & 2 deletions source/NVDAObjects/JAB/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import JABHandler
import controlTypes
from ..window import Window
import TextInfos.offsets
import textInfos.offsets
from .. import NVDAObjectTextInfo
import NVDAObjects.IAccessible
import globalVars
Expand Down Expand Up @@ -92,7 +92,7 @@

re_simpleXmlTag=re.compile(r"\<[^>]+\>")

class JABTextInfo(TextInfos.offsets.OffsetsTextInfo):
class JABTextInfo(textInfos.offsets.OffsetsTextInfo):

def _getOffsetFromPoint(self,x,y):
info=self.obj.jabContext.getAccessibleTextInfo(x,y)
Expand Down
Loading

0 comments on commit 200bf5c

Please sign in to comment.