Ticket #193: clipboard_speaking.patch

File clipboard_speaking.patch, 2.4 KB (added by aleksey_s, 3 years ago)

original patch

  • api.py

     
    276276                        return True 
    277277        return False 
    278278 
     279def getClipData(): 
     280        """Receives text from the windows clipboard. 
     281@returns: Clipboard text 
     282@rtype: string 
     283""" 
     284        text = "" 
     285        win32clipboard.OpenClipboard() 
     286        try: 
     287                text = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) 
     288        finally: 
     289                win32clipboard.CloseClipboard() 
     290        return text 
     291 
    279292def getStatusBar(): 
    280293        """Obtain the status bar for the current foreground object. 
    281294        @return: The status bar object or C{None} if no status bar was found. 
  • appModules/_default.py

     
    805805                pythonConsole.consoleUI.updateNamespaceSnapshotVars() 
    806806                pythonConsole.activate() 
    807807        script_activatePythonConsole.__doc__ = _("Activates the NVDA Python Console, primarily useful for development") 
     808 
     809        def script_speakClipboardText(self,keyPress): 
     810                text = api.getClipData() 
     811                if isinstance(text,basestring) and len(text)>0 and not text.isspace(): 
     812                        if len(text) < 1024:  
     813                                speech.speakMessage(text) 
     814                        else: 
     815                                speech.speakMessage(_("The clipboard contains a big portion of text. it is %s characters long") % len(text)) 
     816                else: 
     817                        speech.speakMessage(_("The clipboard is empty")) 
     818        script_speakClipboardText.__doc__ = _("Speaks the windows clipboard text content without touching it") 
     819 No newline at end of file 
  • appModules/_default_desktop.kbd

     
    7979Control+NVDA+z=activatePythonConsole 
    8080extendedDivide=leftMouseClick 
    8181multiply=rightMouseClick 
     82NVDA+c=speakClipboardText 
  • appModules/_default_laptop.kbd

     
    118118Control+NVDA+d=activateDocumentFormattingDialog 
    119119Control+NVDA+c=saveConfiguration 
    120120Control+NVDA+r=revertToSavedConfiguration 
    121 Control+NVDA+z=activatePythonConsole 
    122  No newline at end of file 
     121Control+NVDA+z=activatePythonConsole 
     122NVDA+c=speakClipboardText