def execCommand(action): """take commands from speech-recognition and send them to NVDA The function accepts script names to execute""" count = 1 print action if "|" in action: action, count = action.split("|") gesture = DictationGesture(action, count) inputCore.manager.executeGesture(gesture)
def dbHelp(): sys.path.append(addonRootDir) #Import this late, as we only need this here and it's a large autobuilt blob. from NVDA_helpCommands import commands sys.path.remove(sys.path[-1]) html = "<p>" #Translators: Description of how to Move to the next topic in the in-built help. html += escape( _('To use this help documentation, you can navigate to the next category with h, or by saying "next heading".' )) #Translators: Description of how to Move through help tables in the in-built help. html += escape( _('To move by column or row, use table navigation, (You can say "Previous row/column", "prev row", "prev column", "next row", "next column" to navigate with speech).' )) #Translators: Description of how to find a command in the in-built help. html += escape( _('to find specific text, say "find text", wait for the find dialog to appear, then dictate your text, then say "press enter" or "click ok".' )) html += "</p><h2>" #Translators: The Context sensitive help heading, telling the user what these commands are.. html += escape(_("Currently available commands.")) html += "</h2>" categories = {} #Translators: The name of a category in Dictationbridge for the commands help. miscName = _("Miscellaneous") categories[miscName] = HelpCategory(miscName) for command in commands: if command["identifier_for_NVDA"] in SPECIAL_COMMANDS: #All special commands get the miscelaneous category. categories[miscName].addRow(command["text"], command["helpText"]) continue #Creating a gesture is not efficient, but helps eliminate code bloat. gesture = DictationGesture(command["identifier_for_NVDA"]) scriptInfo = gesture.script_hacky if not scriptInfo: #This script is not active right now! continue doc = getattr(scriptInfo[0], "__doc__", "") category = "" try: category = scriptInfo[0].category except AttributeError: category = getattr(scriptInfo[1], "scriptCategory", miscName) if not categories.get(category): categories[cat] = HelpCategory(cat) categories[cat].addRow(command["text"], doc) for category in categories.values(): html += category.html() ui.browseableMessage( html, #Translators: The title of the context sensitive help for Dictation Bridge NVDA Commands. _("Dictation Bridge NVDA Context Sensitive Help"), True)
def commandCallback(command): if command in SPECIAL_COMMANDS: queueHandler.queueFunction(queueHandler.eventQueue, SPECIAL_COMMANDS[command]) return inputCore.manager.executeGesture(DictationGesture(command))