diff --git a/source/speech.py b/source/speech.py index 2792bae1337..166ce7f26ca 100755 --- a/source/speech.py +++ b/source/speech.py @@ -556,7 +556,7 @@ def speak(speechSequence, symbolLevel=None, priority=None): symbolLevel=config.conf["speech"]["symbolLevel"] curLanguage=defaultLanguage inCharacterMode=False - for index in xrange(len(speechSequence)): + for index in range(len(speechSequence)): item=speechSequence[index] if isinstance(item,CharacterModeCommand): inCharacterMode=item.state @@ -820,7 +820,7 @@ def speakTextInfo(info, useCache=True, formatConfig=None, unit=None, reason=cont raise ValueError("unknown field: %s"%field) #Calculate how many fields in the old and new controlFieldStacks are the same commonFieldCount=0 - for count in xrange(min(len(newControlFieldStack),len(controlFieldStackCache))): + for count in range(min(len(newControlFieldStack),len(controlFieldStackCache))): # #2199: When comparing controlFields try using uniqueID if it exists before resorting to compairing the entire dictionary oldUniqueID=controlFieldStackCache[count].get('uniqueID') newUniqueID=newControlFieldStack[count].get('uniqueID') @@ -833,7 +833,7 @@ def speakTextInfo(info, useCache=True, formatConfig=None, unit=None, reason=cont # We don't do this for focus because hearing "out of list", etc. isn't useful when tabbing or using quick navigation and makes navigation less efficient. if reason!=controlTypes.REASON_FOCUS: endingBlock=False - for count in reversed(xrange(commonFieldCount,len(controlFieldStackCache))): + for count in reversed(range(commonFieldCount,len(controlFieldStackCache))): text=info.getControlFieldSpeech(controlFieldStackCache[count],controlFieldStackCache[0:count],"end_removedFromControlFieldStack",formatConfig,extraDetail,reason=reason) if text: speechSequence.append(text) @@ -849,7 +849,7 @@ def speakTextInfo(info, useCache=True, formatConfig=None, unit=None, reason=cont #Get speech text for any fields that are in both controlFieldStacks, if extra detail is not requested if not extraDetail: - for count in xrange(commonFieldCount): + for count in range(commonFieldCount): field=newControlFieldStack[count] text=info.getControlFieldSpeech(field,newControlFieldStack[0:count],"start_inControlFieldStack",formatConfig,extraDetail,reason=reason) if text: @@ -862,7 +862,7 @@ def speakTextInfo(info, useCache=True, formatConfig=None, unit=None, reason=cont # When true, we are inside a clickable field, and should therefore not announce any more new clickable fields inClickable=False #Get speech text for any fields in the new controlFieldStack that are not in the old controlFieldStack - for count in xrange(commonFieldCount,len(newControlFieldStack)): + for count in range(commonFieldCount,len(newControlFieldStack)): field=newControlFieldStack[count] if not inClickable and formatConfig['reportClickable']: states=field.get('states') @@ -1006,7 +1006,7 @@ def speakTextInfo(info, useCache=True, formatConfig=None, unit=None, reason=cont speechSequence.append(LangChangeCommand(None)) lastLanguage=None if not extraDetail: - for count in reversed(xrange(min(len(newControlFieldStack),commonFieldCount))): + for count in reversed(range(min(len(newControlFieldStack),commonFieldCount))): text=info.getControlFieldSpeech(newControlFieldStack[count],newControlFieldStack[0:count],"end_inControlFieldStack",formatConfig,extraDetail,reason=reason) if text: speechSequence.append(text) @@ -1758,7 +1758,7 @@ def speakWithoutPauses(speechSequence,detectBreaks=True): if detectBreaks and speechSequence: sequenceLen=len(speechSequence) spoke = False - for index in xrange(sequenceLen): + for index in range(sequenceLen): if isinstance(speechSequence[index],EndUtteranceCommand): if index>0 and lastStartIndex