Ticket #249: selections.patch

File selections.patch, 3.6 KB (added by aleksey_s, 3 years ago)

my workaround

  • source/speech.py

    # Bazaar merge directive format 2 (Bazaar 0.90)
    # revision_id: lex@onm.su-20081204204905-1ag0mk8z09sliu9a
    # target_branch: ../main
    # testament_sha1: ae758cf945dc139dac69446fc2a68d34a20d6793
    # timestamp: 2008-12-04 23:28:14 +0200
    # base_revision_id: jamie@jantrid.net-20081204121745-tnq6be9mor0jwmfl
    # 
    # Begin patch
    === modified file 'source/speech.py'
     
    284284        if text and not text.isspace(): 
    285285                getSynth().speakText(text,index=index) 
    286286 
     287def speakSelectionChangeHelper(text,unselected=False): 
     288        if len(text) < 512: 
     289                speakMessage(text) 
     290        else: 
     291                speakMessage(_("Selected %d characters") % len(text) if not unselected else _("unselected %d characters")%len(text)) 
     292 
    287293def speakSelectionChange(oldInfo,newInfo,speakSelected=True,speakUnselected=True,generalize=False): 
    288294        """Speaks a change in selection, either selected or unselected text. 
    289295        @param oldInfo: a TextInfo instance representing what the selection was before 
     
    333339                        for text in selectedTextList: 
    334340                                if  len(text)==1: 
    335341                                        text=processSymbol(text) 
    336                                 speakMessage(_("selecting %s")%text) 
     342                                speakSelectionChangeHelper(_("selecting %s")%text) 
    337343                elif len(selectedTextList)>0: 
    338344                        text=newInfo.text 
    339345                        if len(text)==1: 
    340346                                text=processSymbol(text) 
    341                         speakMessage(_("selected %s")%text) 
     347                        speakSelectionChangeHelper(_("selected %s")%text) 
    342348        if speakUnselected: 
    343349                if not generalize: 
    344350                        for text in unselectedTextList: 
    345351                                if  len(text)==1: 
    346352                                        text=processSymbol(text) 
    347                                 speakMessage(_("unselecting %s")%text) 
     353                                speakSelectionChangeHelper(_("unselecting %s")%text,True) 
    348354                elif len(unselectedTextList)>0: 
    349355                        speakMessage(_("selection removed")) 
    350356                        if not newInfo.isCollapsed: 
    351357                                text=newInfo.text 
    352358                                if len(text)==1: 
    353359                                        text=processSymbol(text) 
    354                                 speakMessage(_("selected %s")%text) 
     360                                speakSelectionChangeHelper(_("selected %s")%text) 
    355361 
    356362def speakTypedCharacters(ch): 
    357363        global curWordChars;