2 new commits in controlUsageAssistant: https://bitbucket.org/nvdaaddonteam/controlusageassistant/commits/3a3668844858/ Changeset: 3a3668844858 Branch: None User: josephsl Date: 2013-05-13 08:08:19 Summary: Merged master. Affected #: 2 files diff --git a/README.md b/README.md index ce8e579..5d631a1 100755 --- a/README.md +++ b/README.md @@ -2,12 +2,17 @@ * Author: Joseph Lee <joseph.lee22590@xxxxxxxxx> -Use this add-on to find out how to interact with the focused control. Press NvDA+H to hear how to interact with the focused control, such as checking a checkbox, editing text and so on. +Use this add-on to find out how to interact with the focused control. Press NvDA+H to obtain a message on how to interact with the focused control, such as checking a checkbox, editing text and so on. # Changelog # -## 1.0-dev/0.x Code Review ## +## 1.0 Beta 2 ## -* Initial version. -* Translated into Korean. +* You can now read help messages in braille. +* Additional languages (more languages to come). + +## 1.0 Beta 1 ## + +* Initial testing version. +* Translated into many languages. diff --git a/addon/globalPlugins/controlUsageAssistant/__init__.py b/addon/globalPlugins/controlUsageAssistant/__init__.py index 3c1287c..ebfbb3c 100755 --- a/addon/globalPlugins/controlUsageAssistant/__init__.py +++ b/addon/globalPlugins/controlUsageAssistant/__init__.py @@ -3,7 +3,7 @@ # Author: Joseph Lee <joseph.lee22590@xxxxxxxxx> # Copyright 2013, released under GPL. -# Press NVDA+H to hear a sentence or two on interacting with a particular control. +# Press NVDA+H to hear (or read in braille) a sentence or two on interacting with a particular control. # Extension plan: ability to get context-sensitive help on NvDA options. # Import please: @@ -20,7 +20,7 @@ addonHandler.initTranslation() # Internationalization. # Init: class GlobalPlugin(globalPluginHandler.GlobalPlugin): -# NVDA+H: Obtain usage help on a particular control. + # NVDA+H: Obtain usage help on a particular control. # Depending on the type of control and its state(s), lookup a dictionary of control types and help messages. # If the control is used differently in apps, then lookup the app entry and give the customized message. def script_obtainControlHelp(self, gesture): @@ -35,21 +35,24 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin): def getHelpMessage(self, curObj): # The actual process of presenting the help message based on object's role, state(s) and focused app. # The lookup chain is: appModule first, then executable image name then finally to default entries. + msg = "" # An empty string to hold the message; needed to work better with braille. curRole = curObj.role # Just an int, the key to the help messages dictionary. curState = curObj._get_states() # To work with states to present appropriate help message. curApp = curObj.appModule # Detect which app we're running so to give custom help messages for controls. curProc = appModuleHandler.getAppNameFromProcessID(curObj.processID,True) # Borrowed from NVDA core code, used when appModule return fails. if curRole not in ctrltypelist.helpMessages: # Translators: Message presented when there is no help message for the focused control. - ui.message(_("No help for this control")) - elif curRole == 8 and controlTypes.STATE_READONLY in curState: # Detect read-only edit box. - ui.message(_(ctrltypelist.helpMessages[-8])) + msg = _("No help for this control") + elif curRole == 8 and controlTypes.STATE_READONLY in curState: + msg = _(ctrltypelist.helpMessages[-8]) # Testing with Excel, since user can use just arrow keys for tablecell. elif curRole == 29 and appModuleHandler.getAppNameFromProcessID(curObj.processID,True) == "EXCEL.EXE": - ui.message(apphelplist.excelMessages[curRole]) # Turns out it works, so start applying to others. - else: # If lookup chain fails but got a valid role const: - ui.message(_(ctrltypelist.helpMessages[curRole])) + msg = apphelplist.excelMessages[curRole] # Turns out it works, so start applying to others. + else: + msg = _(ctrltypelist.helpMessages[curRole]) + return msg + # For development testing: # GetAppName: To see if one can even print the name of the appModule. def script_getAppName(self, gesture): @@ -57,10 +60,6 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin): app = appObj.appModule ui.message(app.appModuleName.split(".")[0]) - - - - __gestures={ "KB:NVDA+H":"obtainControlHelp", "KB:NVDA+G":"getAppName", https://bitbucket.org/nvdaaddonteam/controlusageassistant/commits/1d49f6a66831/ Changeset: 1d49f6a66831 Branch: AppBasedMSGs User: josephsl Date: 2013-05-14 12:48:21 Summary: 2.0 - App-based messages - Excel works, so start applying to other apps. Affected #: 3 files diff --git a/addon/globalPlugins/controlUsageAssistant/__init__.py b/addon/globalPlugins/controlUsageAssistant/__init__.py index ebfbb3c..c2e61ae 100755 --- a/addon/globalPlugins/controlUsageAssistant/__init__.py +++ b/addon/globalPlugins/controlUsageAssistant/__init__.py @@ -12,7 +12,7 @@ import ui # For speaking and brailling help messages. import api # To fetch object properties. import controlTypes # The heart of this module. import ctrltypelist # The control types and help messages dictionary. -import apphelplist # A dictionary of appModule offset (see below for explanation). +from apphelplist import appOffsets, procOffsets # A dictionary of appModule and process offset (see below for explanation). import appModuleHandler # Apps. import addonHandler # Addon basics. addonHandler.initTranslation() # Internationalization. @@ -46,8 +46,8 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin): elif curRole == 8 and controlTypes.STATE_READONLY in curState: msg = _(ctrltypelist.helpMessages[-8]) # Testing with Excel, since user can use just arrow keys for tablecell. - elif curRole == 29 and appModuleHandler.getAppNameFromProcessID(curObj.processID,True) == "EXCEL.EXE": - msg = apphelplist.excelMessages[curRole] # Turns out it works, so start applying to others. + elif curRole == 29 and curProc == "EXCEL.EXE": + msg = _(ctrltypelist.helpMessages[procOffsets[curProc]+curRole]) # Turns out it works, so start applying to others. else: msg = _(ctrltypelist.helpMessages[curRole]) return msg diff --git a/addon/globalPlugins/controlUsageAssistant/apphelplist.py b/addon/globalPlugins/controlUsageAssistant/apphelplist.py index 738cc6a..4c3b98c 100755 --- a/addon/globalPlugins/controlUsageAssistant/apphelplist.py +++ b/addon/globalPlugins/controlUsageAssistant/apphelplist.py @@ -2,7 +2,13 @@ # An add-on for NVDA # Copyright 2013 Joseph Lee, released under GPL. -# App-specific help messages. -excelMessages={ - 29:"Use the arrow keys to move between spreadsheet cells." -} \ No newline at end of file +# App offsets: lookup the appModule. +appOffsets={ + "explorer":300 + } + +# Process offsets: come here when we fail to obtain appModules. +procOffsets={ + "EXCEL.EXE":400, + } + diff --git a/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py b/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py index 46c76d8..3d45182 100755 --- a/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py +++ b/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py @@ -7,6 +7,7 @@ # Help Messages Dictionary: key = obj role number. #a negative role number indicates restricted control, such as read-only edit field. # A role number greater than 200 indicates additional features, such as multiline and virtual buffer instance. + # Anything above 400 means appModule or process-specific. helpMessages = { # Translators: Help message for a checkbox. 5:_("Press space to check or uncheck the checkbox"), @@ -42,5 +43,9 @@ helpMessages = { 29:_("Press control, alt and arrow keys together to move between table cells"), # Translators: Help message for reading documents (mostly encountered in Internet Explorer windows). 52:_("Use the arrow keys or object navigation commands to move through the document"), - 64:"Press enter to interact with the embedded object. Press CONTROL+NVDA+SPACE to return to the website text" + 64:"Press enter to interact with the embedded object. Press CONTROL+NVDA+SPACE to return to the website text", + + # Second level lookup: processes themselves. + # 400: Excel. + 429:_("Use the arrow keys to move between spreadsheet cells") } Repository URL: https://bitbucket.org/nvdaaddonteam/controlusageassistant/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. ---------------------------------------------------------------- NVDA add-ons Central: A list for discussing NVDA add-ons To post a message, send an email to nvda-addons@xxxxxxxxxxxxx. To unsubscribe, send an email with the subject line of "unsubscribe" (without quotes) to nvda-addons-request@xxxxxxxxxxxxx. If you have questions for list moderators, please send a message to nvda-addons-moderators@xxxxxxxxxxxxx.