import displayModel\r
import IAccessibleHandler\r
import oleacc\r
+import re\r
+import colors\r
import JABHandler\r
import winUser\r
import globalVars\r
except:\r
return ""\r
\r
+ re_IA2RGB=re.compile(r'rgb\((\d+),\s(\d+),\s(\d+)\)')\r
+\r
def _getFormatFieldAndOffsets(self,offset,formatConfig,calculateOffsets=True):\r
try:\r
startOffset,endOffset,attribsString=self.obj.IAccessibleTextObject.attributes(offset)\r
invalid=None\r
if invalid and invalid.lower()=="spelling":\r
formatField["invalid-spelling"]=True\r
+ color=formatField.get('color')\r
+ if color:\r
+ m=self.re_IA2RGB.match(color)\r
+ if m:\r
+ formatField['color']=colors.RGB(int(m.group(1)),int(m.group(2)),int(m.group(3)))\r
+ backgroundColor=formatField.get('background-color')\r
+ if backgroundColor:\r
+ m=self.re_IA2RGB.match(backgroundColor)\r
+ if m:\r
+ formatField['background-color']=colors.RGB(int(m.group(1)),int(m.group(2)),int(m.group(3)))\r
return formatField,(startOffset,endOffset)\r
\r
def _getCharacterOffsets(self,offset):\r
def script_reportFormatting(self,keyPress):\r
formatConfig={\r
"detectFormatAfterCursor":False,\r
- "reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,\r
+ "reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,\r
"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,\r
"reportPage":False,"reportLineNumber":False,"reportTables":False,\r
"reportLinks":False,"reportHeadings":False,"reportLists":False,\r
reportFontName = boolean(default=false)\r
reportFontSize = boolean(default=false)\r
reportFontAttributes = boolean(default=false)\r
+ reportColor = boolean(default=False)\r
reportAlignment = boolean(default=false)\r
reportStyle = boolean(default=false)\r
reportSpellingErrors = boolean(default=true)\r
self.alignmentCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Report &alignment"))\r
self.alignmentCheckBox.SetValue(config.conf["documentFormatting"]["reportAlignment"])\r
settingsSizer.Add(self.alignmentCheckBox,border=10,flag=wx.BOTTOM)\r
+ self.colorCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Report &colors"))\r
+ self.colorCheckBox.SetValue(config.conf["documentFormatting"]["reportColor"])\r
+ settingsSizer.Add(self.colorCheckBox,border=10,flag=wx.BOTTOM)\r
self.styleCheckBox=wx.CheckBox(self,wx.NewId(),label=_("Report st&yle"))\r
self.styleCheckBox.SetValue(config.conf["documentFormatting"]["reportStyle"])\r
settingsSizer.Add(self.styleCheckBox,border=10,flag=wx.BOTTOM)\r
config.conf["documentFormatting"]["reportFontName"]=self.fontNameCheckBox.IsChecked()\r
config.conf["documentFormatting"]["reportFontSize"]=self.fontSizeCheckBox.IsChecked()\r
config.conf["documentFormatting"]["reportFontAttributes"]=self.fontAttrsCheckBox.IsChecked()\r
+ config.conf["documentFormatting"]["reportColor"]=self.colorCheckBox.IsChecked()\r
config.conf["documentFormatting"]["reportAlignment"]=self.alignmentCheckBox.IsChecked()\r
config.conf["documentFormatting"]["reportStyle"]=self.styleCheckBox.IsChecked()\r
config.conf["documentFormatting"]["reportSpellingErrors"]=self.spellingErrorsCheckBox.IsChecked()\r
@type speechMode: boolean\r
""" \r
\r
+import colors\r
import XMLFormatting\r
import globalVars\r
from logHandler import log\r
oldFontSize=attrsCache.get("font-size") if attrsCache is not None else None\r
if fontSize and fontSize!=oldFontSize:\r
textList.append(fontSize)\r
+ if formatConfig["reportColor"]:\r
+ color=attrs.get("color")\r
+ oldColor=attrsCache.get("color") if attrsCache is not None else None\r
+ if color and color!=oldColor:\r
+ textList.append(colors.findColorName(color))\r
+ backgroundColor=attrs.get("background-color")\r
+ oldBackgroundColor=attrsCache.get("background-color") if attrsCache is not None else None\r
+ if backgroundColor and backgroundColor!=oldBackgroundColor:\r
+ textList.append(_("on {backgroundColor}").format(backgroundColor=colors.findColorName(backgroundColor)))\r
if formatConfig["reportLineNumber"]:\r
lineNumber=attrs.get("line-number")\r
oldLineNumber=attrsCache.get("line-number") if attrsCache is not None else None\r