本文整理匯總了Python中IAccessibleHandler.splitIA2Attribs方法的典型用法代碼示例。如果您正苦於以下問題:Python IAccessibleHandler.splitIA2Attribs方法的具體用法?Python IAccessibleHandler.splitIA2Attribs怎麽用?Python IAccessibleHandler.splitIA2Attribs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IAccessibleHandler
的用法示例。
在下文中一共展示了IAccessibleHandler.splitIA2Attribs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _getFormatFieldAndOffsets
# 需要導入模塊: import IAccessibleHandler [as 別名]
# 或者: from IAccessibleHandler import splitIA2Attribs [as 別名]
def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):
obj = self.obj
try:
startOffset,endOffset,attribsString=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()
if not attribsString and offset>0:
try:
attribsString=obj.IAccessibleTextObject.attributes(offset-1)[2]
except COMError:
pass
if attribsString:
formatField.update(IAccessibleHandler.splitIA2Attribs(attribsString))
try:
escapement = int(formatField["CharEscapement"])
if escapement < 0:
textPos = "sub"
elif escapement > 0:
textPos = "super"
else:
textPos = "baseline"
formatField["text-position"] = textPos
except KeyError:
pass
try:
formatField["font-name"] = formatField["CharFontName"]
except KeyError:
pass
try:
formatField["font-size"] = "%spt" % formatField["CharHeight"]
except KeyError:
pass
try:
formatField["italic"] = formatField["CharPosture"] == "2"
except KeyError:
pass
try:
formatField["strikethrough"] = formatField["CharStrikeout"] == "1"
except KeyError:
pass
try:
underline = formatField["CharUnderline"]
if underline == "10":
# Symphony doesn't provide for semantic communication of spelling errors, so we have to rely on the WAVE underline type.
formatField["invalid-spelling"] = True
else:
formatField["underline"] = underline != "0"
except KeyError:
pass
try:
formatField["bold"] = float(formatField["CharWeight"]) > 100
except KeyError:
pass
try:
color=formatField.pop('CharColor')
except KeyError:
color=None
if color:
formatField['color']=colors.RGB.fromString(color)
try:
backgroundColor=formatField.pop('CharBackColor')
except KeyError:
backgroundColor=None
if backgroundColor:
formatField['background-color']=colors.RGB.fromString(backgroundColor)
# optimisation: Assume a hyperlink occupies a full attribute run.
try:
if obj.IAccessibleTextObject.QueryInterface(IAccessibleHandler.IAccessibleHypertext).hyperlinkIndex(offset) != -1:
formatField["link"] = True
except COMError:
pass
if offset == 0:
# Only include the list item prefix on the first line of the paragraph.
numbering = formatField.get("Numbering")
if numbering:
formatField["line-prefix"] = numbering.get("NumberingPrefix") or numbering.get("BulletChar")
if obj.hasFocus:
# Symphony exposes some information for the caret position as attributes on the document object.
# optimisation: Use the tree interceptor to get the document.
try:
docAttribs = obj.treeInterceptor.rootNVDAObject.IA2Attributes
except AttributeError:
# No tree interceptor, so we can't efficiently fetch this info.
pass
else:
try:
formatField["page-number"] = docAttribs["page-number"]
except KeyError:
pass
try:
formatField["line-number"] = docAttribs["line-number"]
except KeyError:
pass
#.........這裏部分代碼省略.........