def changeWatcher(self):
		self.schedule()
		edit = self.appModule.edit
		if None is edit:
			#The editor gained focus. We're gonna die anyway on the next round.
			return
		textInfo = edit.makeTextInfo(textInfos.POSITION_SELECTION)
		if textInfo.bookmark == IncrementalFind.cacheBookmark:
			#Nothing has changed. Just go away.
			return
		IncrementalFind.cacheBookmark = textInfo.bookmark
		textInfo.expand(textInfos.UNIT_LINE)
		#Reporting indentation here is not really necessary.
		idt = speech.splitTextIndentation(textInfo.text)[0]
		textInfo.move(textInfos.UNIT_CHARACTER, len(idt), "start")
		def present():
			queueHandler.queueFunction(queueHandler.eventQueue, speech.speakTextInfo, (textInfo))
		core.callLater(100, present) #Slightly delay presentation in case the status changes.
Beispiel #2
0
    def changeWatcher(self):
        self.schedule()
        edit = self.appModule.edit
        if None is edit:
            #The editor gained focus. We're gonna die anyway on the next round.
            return
        textInfo = edit.makeTextInfo(textInfos.POSITION_SELECTION)
        if textInfo.bookmark == IncrementalFind.cacheBookmark:
            #Nothing has changed. Just go away.
            return
        IncrementalFind.cacheBookmark = textInfo.bookmark
        textInfo.expand(textInfos.UNIT_LINE)
        #Reporting indentation here is not really necessary.
        idt = speech.splitTextIndentation(textInfo.text)[0]
        textInfo.move(textInfos.UNIT_CHARACTER, len(idt), "start")

        def present():
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.speakTextInfo, (textInfo))

        core.callLater(
            100,
            present)  #Slightly delay presentation in case the status changes.
Beispiel #3
0
 def getIndentLevel(self, s):
     if speech.isBlank(s):
         return 0
     indent = speech.splitTextIndentation(s)[0]
     return len(indent.replace("\t", " " * 4))