def getFormatFieldSpeech(self, attrs, attrsCache=None, formatConfig=None, reason=None, unit=None, extraDetail=False, initialFormat=False, separator=None): """Get the spoken representation for given format information. The base implementation just calls L{speech.getFormatFieldSpeech}. This can be extended in order to support implementation specific attributes. If extended, the superclass should be called first. @param separator: The text used to separate chunks of format information; defaults to L{speech.CHUNK_SEPARATOR}. @type separator: str """ # Import late to avoid circular import. import speech if separator is None: # #6749: The default for this argument is actually speech.CHUNK_SEPARATOR, # but that can't be specified as a default argument because of circular import issues. separator = speech.CHUNK_SEPARATOR return speech.getFormatFieldSpeech(attrs, attrsCache=attrsCache, formatConfig=formatConfig, reason=reason, unit=unit, extraDetail=extraDetail, initialFormat=initialFormat, separator=separator)
def script_reportFormatting(self,gesture): formatConfig={ "detectFormatAfterCursor":False, "reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True, "reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True, "reportPage":False,"reportLineNumber":False,"reportTables":False, "reportLinks":False,"reportHeadings":False,"reportLists":False, "reportBlockQuotes":False, } o=api.getFocusObject() v=o.treeInterceptor if v and not v.passThrough: o=v try: info=o.makeTextInfo(textInfos.POSITION_CARET) except (NotImplementedError, RuntimeError): info=o.makeTextInfo(textInfos.POSITION_FIRST) info.expand(textInfos.UNIT_CHARACTER) formatField=textInfos.FormatField() for field in info.getTextWithFields(formatConfig): if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField): formatField.update(field.field) text=speech.getFormatFieldSpeech(formatField,formatConfig=formatConfig) if formatField else None if not text: ui.message(_("No formatting information")) return ui.message(text)
def getFormatFieldSpeech( self, attrs: Field, attrsCache: Optional[Field] = None, formatConfig: Optional[Dict[str, bool]] = None, reason: Optional[OutputReason] = None, unit: Optional[str] = None, extraDetail: bool = False, initialFormat: bool = False, ) -> SpeechSequence: """Get the spoken representation for given format information. The base implementation just calls L{speech.getFormatFieldSpeech}. This can be extended in order to support implementation specific attributes. If extended, the superclass should be called first. """ # Import late to avoid circular import. import speech return speech.getFormatFieldSpeech( attrs=attrs, attrsCache=attrsCache, formatConfig=formatConfig, reason=reason, unit=unit, extraDetail=extraDetail, initialFormat=initialFormat )
def reportFocus(self): # #4878: Excel specific code for speaking format changes on the focused object. info=self.makeTextInfo(textInfos.POSITION_FIRST) info.expand(textInfos.UNIT_CHARACTER) formatField=textInfos.FormatField() formatConfig=config.conf['documentFormatting'] for field in info.getTextWithFields(formatConfig): if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField): formatField.update(field.field) if not hasattr(self.parent,'_formatFieldSpeechCache'): self.parent._formatFieldSpeechCache={} text=speech.getFormatFieldSpeech(formatField,attrsCache=self.parent._formatFieldSpeechCache,formatConfig=formatConfig) if formatField else None if text: speech.speakText(text) super(ExcelCell,self).reportFocus()
def getFormatFieldSpeech(self, attrs, attrsCache=None, formatConfig=None, reason=None, unit=None, extraDetail=False , initialFormat=False, separator=None): """Get the spoken representation for given format information. The base implementation just calls L{speech.getFormatFieldSpeech}. This can be extended in order to support implementation specific attributes. If extended, the superclass should be called first. @param separator: The text used to separate chunks of format information; defaults to L{speech.CHUNK_SEPARATOR}. @type separator: basestring """ # Import late to avoid circular import. import speech if separator is None: # #6749: The default for this argument is actually speech.CHUNK_SEPARATOR, # but that can't be specified as a default argument because of circular import issues. separator = speech.CHUNK_SEPARATOR return speech.getFormatFieldSpeech(attrs, attrsCache=attrsCache, formatConfig=formatConfig, reason=reason, unit=unit, extraDetail=extraDetail , initialFormat=initialFormat, separator=separator)