[nvda-addons] commit/controlUsageAssistant: josephsl: App-based messages - appOffsets has some entries, but no code for accesing it. Also added some comments for lookup cases.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Wed, 15 May 2013 07:34:55 -0000

1 new commit in controlUsageAssistant:

https://bitbucket.org/nvdaaddonteam/controlusageassistant/commits/5faad8d65255/
Changeset:   5faad8d65255
Branch:      AppBasedMSGs
User:        josephsl
Date:        2013-05-15 09:34:14
Summary:     App-based messages - appOffsets has some entries, but no code for 
accesing it. Also added some comments for lookup cases.

Affected #:  3 files

diff --git a/addon/globalPlugins/controlUsageAssistant/__init__.py 
b/addon/globalPlugins/controlUsageAssistant/__init__.py
index c2e61ae..5e3b955 100755
--- a/addon/globalPlugins/controlUsageAssistant/__init__.py
+++ b/addon/globalPlugins/controlUsageAssistant/__init__.py
@@ -34,20 +34,24 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin):
        # GetHelpMessage: The actual function behind the script above.
        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.
+               # For apps, the lookup chain is: appModule first, then 
executable image name then finally to default entries.
+               msg = "" # A string (initially empty) to hold the message; 
needed to work better with braille.
+               curRole = curObj.role # Just an int (role constant from control 
types), 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.
+               # Absolute last resort: If we fail to obtain any default or 
app-specific message (because there is no entry for the role in the help 
messages), give the below message.
                if curRole not in ctrltypelist.helpMessages:
                        # Translators: Message presented when there is no help 
message for the focused control.
                        msg = _("No help for this control")
+               # Special case 1: WE have encountered a read-only edit field.
                elif curRole == 8 and controlTypes.STATE_READONLY in curState:
                        msg = _(ctrltypelist.helpMessages[-8])
+               # App-specific messages (Todo): Find appModules, then come here 
to deal with proc images if there is no appModule for the current process.
                # Testing with Excel, since user can use just arrow keys for 
tablecell.
                elif curRole == 29 and curProc == "EXCEL.EXE":
                        msg = 
_(ctrltypelist.helpMessages[procOffsets[curProc]+curRole]) # Turns out it 
works, so start applying to others.
+               # Finally, deal with default messages.
                else:
                        msg = _(ctrltypelist.helpMessages[curRole])
                return msg

diff --git a/addon/globalPlugins/controlUsageAssistant/apphelplist.py 
b/addon/globalPlugins/controlUsageAssistant/apphelplist.py
index 4c3b98c..99cff2e 100755
--- a/addon/globalPlugins/controlUsageAssistant/apphelplist.py
+++ b/addon/globalPlugins/controlUsageAssistant/apphelplist.py
@@ -4,11 +4,12 @@
 
 # App offsets: lookup the appModule.
 appOffsets={
-       "explorer":300
+       "explorer":300,
+       "powerpnt":400
        }
 
 # Process offsets: come here when we fail to obtain appModules.
 procOffsets={
-       "EXCEL.EXE":400,
+       "EXCEL.EXE":1000,
        }
 

diff --git a/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py 
b/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py
index 3d45182..f2c0a6a 100755
--- a/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py
+++ b/addon/globalPlugins/controlUsageAssistant/ctrltypelist.py
@@ -4,11 +4,13 @@
 
 # The list of control types and their help messages.
                        
-       # Help Messages Dictionary: key = obj role number.
-       #a negative role number indicates restricted control, such as read-only 
edit field.
+       # Help Messages Dictionary: key = obj role number, with offsets added 
based on apps and/or states.
+       #a negative role number between -1 and -199 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.
+       # Anything beyond +/-400 means appModule or process-specific (positive 
= appModule, negative = process).
 helpMessages = {
+       # Default: universal across apps and states.
+       
        # Translators: Help message for a checkbox.
        5:_("Press space to check or uncheck the checkbox"),
        # Translators: Help message for working with radio buttons.
@@ -45,7 +47,14 @@ helpMessages = {
        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",
        
-       # Second level lookup: processes themselves.
-       # 400: Excel.
-       429:_("Use the arrow keys to move between spreadsheet cells")
+       # App-specific case 1: AppeModule for app is present.
+       
+       # 400: Microsoft powerpoint (powerpnt):
+       403:"Use up and down arrow keys to move between slides",
+       
+       
+       # App-specific case 2: AppeModule for app is not present (use 
processes).
+       # 1000: Excel.
+       
+       1029:_("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.

Other related posts:

  • » [nvda-addons] commit/controlUsageAssistant: josephsl: App-based messages - appOffsets has some entries, but no code for accesing it. Also added some comments for lookup cases. - commits-noreply