Ticket #228: 228-2.patch
| File 228-2.patch, 78.7 KB (added by orcauser, 11 months ago) |
|---|
-
source/NVDAObjects/IAccessible/__init__.py
# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: mhameed@src.gnome.org-20110617124746-cufp3o7kxf13vd8x # target_branch: http://bzr.nvaccess.org/nvda/main/ # testament_sha1: d29a9fb6a717ed03c0d9e3a57324676dd7020200 # timestamp: 2011-06-18 08:38:17 +0100 # base_revision_id: mick@kulgan.net-20110618071115-cezi1vx8u8na23rs # # Begin patch === modified file 'source/NVDAObjects/IAccessible/__init__.py'
1 1 #NVDAObjects/IAccessible.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 07NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 1173 1173 if self in api.getFocusAncestors(): 1174 1174 return 1175 1175 speech.cancelSpeech() 1176 speech.speakObject(self, reason= speech.REASON_FOCUS)1176 speech.speakObject(self, reason=controlTypes.REASON_FOCUS) 1177 1177 for child in self.recursiveDescendants: 1178 1178 if controlTypes.STATE_FOCUSABLE in child.states: 1179 speech.speakObject(child, reason= speech.REASON_FOCUS)1179 speech.speakObject(child, reason=controlTypes.REASON_FOCUS) 1180 1180 1181 1181 def event_caret(self): 1182 1182 super(IAccessible, self).event_caret() … … 1227 1227 h=hash(child) 1228 1228 if h not in hashList: 1229 1229 hashList.append(h) 1230 speech.speakObject(child,reason= speech.REASON_FOCUS)1230 speech.speakObject(child,reason=controlTypes.REASON_FOCUS) 1231 1231 child.speakDescendantObjects(hashList=hashList) 1232 1232 child=child.next 1233 1233 … … 1376 1376 def event_show(self): 1377 1377 # TODO: Abstract this somehow. 1378 1378 if (config.conf["presentation"]["reportTooltips"] and (self.IAccessibleRole==oleacc.ROLE_SYSTEM_TOOLTIP)) or (config.conf["presentation"]["reportHelpBalloons"] and (self.IAccessibleRole==oleacc.ROLE_SYSTEM_HELPBALLOON)): 1379 speech.speakObject(self,reason= speech.REASON_FOCUS)1379 speech.speakObject(self,reason=controlTypes.REASON_FOCUS) 1380 1380 # TODO: Don't use getBrailleTextForProperties directly. 1381 1381 braille.handler.message(braille.getBrailleTextForProperties(name=self.name, role=self.role)) 1382 1382 … … 1388 1388 def speakDescendantObjects(self,hashList=None): 1389 1389 child=self.activeChild 1390 1390 if child: 1391 speech.speakObject(child,reason= speech.REASON_FOCUS)1391 speech.speakObject(child,reason=controlTypes.REASON_FOCUS) 1392 1392 1393 1393 class ComboBox(IAccessible): 1394 1394 1395 1395 def speakDescendantObjects(self,hashList=None): 1396 1396 child=self.activeChild 1397 1397 if child: 1398 speech.speakObject(child,reason= speech.REASON_FOCUS)1398 speech.speakObject(child,reason=controlTypes.REASON_FOCUS) 1399 1399 1400 1400 class Outline(IAccessible): 1401 1401 1402 1402 def speakDescendantObjects(self,hashList=None): 1403 1403 child=self.activeChild 1404 1404 if child: 1405 speech.speakObject(child,reason= speech.REASON_FOCUS)1405 speech.speakObject(child,reason=controlTypes.REASON_FOCUS) 1406 1406 1407 1407 class SysLinkClient(IAccessible): 1408 1408 -
source/NVDAObjects/UIA/__init__.py
=== modified file 'source/NVDAObjects/UIA/__init__.py'
1 #NVDAObjects/UIA.py 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 #This file is covered by the GNU General Public License. 5 #See the file COPYING for more details. 6 1 7 from ctypes.wintypes import POINT 2 8 from comtypes import COMError 3 9 import weakref … … 500 506 def event_valueChange(self): 501 507 focusParent=api.getFocusObject().parent 502 508 if self==focusParent: 503 speech.speakObjectProperties(self,value=True,reason= speech.REASON_CHANGE)509 speech.speakObjectProperties(self,value=True,reason=controlTypes.REASON_CHANGE) 504 510 else: 505 511 super(SensitiveSlider,self).event_valueChange() 506 512 -
source/NVDAObjects/__init__.py
=== modified file 'source/NVDAObjects/__init__.py'
1 1 #NVDAObjects/baseType.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 07NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 726 726 def reportFocus(self): 727 727 """Announces this object in a way suitable such that it gained focus. 728 728 """ 729 speech.speakObject(self,reason= speech.REASON_FOCUS)729 speech.speakObject(self,reason=controlTypes.REASON_FOCUS) 730 730 731 731 def event_typedCharacter(self,ch): 732 732 speech.speakTypedCharacters(ch) … … 768 768 769 769 def event_stateChange(self): 770 770 if self is api.getFocusObject(): 771 speech.speakObjectProperties(self,states=True, reason= speech.REASON_CHANGE)771 speech.speakObjectProperties(self,states=True, reason=controlTypes.REASON_CHANGE) 772 772 braille.handler.handleUpdate(self) 773 773 774 774 def event_focusEntered(self): … … 776 776 speech.cancelSpeech() 777 777 return 778 778 if self.isPresentableFocusAncestor: 779 speech.speakObject(self,reason= speech.REASON_FOCUSENTERED)779 speech.speakObject(self,reason=controlTypes.REASON_FOCUSENTERED) 780 780 781 781 def event_gainFocus(self): 782 782 """ … … 799 799 800 800 def event_valueChange(self): 801 801 if self is api.getFocusObject(): 802 speech.speakObjectProperties(self, value=True, reason= speech.REASON_CHANGE)802 speech.speakObjectProperties(self, value=True, reason=controlTypes.REASON_CHANGE) 803 803 braille.handler.handleUpdate(self) 804 804 805 805 def event_nameChange(self): 806 806 if self is api.getFocusObject(): 807 speech.speakObjectProperties(self, name=True, reason= speech.REASON_CHANGE)807 speech.speakObjectProperties(self, name=True, reason=controlTypes.REASON_CHANGE) 808 808 braille.handler.handleUpdate(self) 809 809 810 810 def event_descriptionChange(self): 811 811 if self is api.getFocusObject(): 812 speech.speakObjectProperties(self, description=True, reason= speech.REASON_CHANGE)812 speech.speakObjectProperties(self, description=True, reason=controlTypes.REASON_CHANGE) 813 813 braille.handler.handleUpdate(self) 814 814 815 815 def event_caret(self): -
source/NVDAObjects/window/winword.py
=== modified file 'source/NVDAObjects/window/winword.py'
1 1 #appModules/winword.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 07NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 386 386 info=self.makeTextInfo(textInfos.POSITION_CARET) 387 387 if info._rangeObj.tables.count>0: 388 388 info.expand(textInfos.UNIT_LINE) 389 speech.speakTextInfo(info,reason= speech.REASON_CARET)389 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 390 390 391 391 def script_nextRow(self,gesture): 392 392 info=self.makeTextInfo("caret") … … 396 396 if info._moveInTable(0,1): 397 397 info.updateCaret() 398 398 info.expand(textInfos.UNIT_CELL) 399 speech.speakTextInfo(info,reason= speech.REASON_CARET)399 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 400 400 else: 401 401 speech.speakMessage(_("edge of table")) 402 402 … … 408 408 if info._moveInTable(0,-1): 409 409 info.updateCaret() 410 410 info.expand(textInfos.UNIT_CELL) 411 speech.speakTextInfo(info,reason= speech.REASON_CARET)411 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 412 412 else: 413 413 speech.speakMessage(_("edge of table")) 414 414 … … 420 420 if info._moveInTable(1,0): 421 421 info.updateCaret() 422 422 info.expand(textInfos.UNIT_CELL) 423 speech.speakTextInfo(info,reason= speech.REASON_CARET)423 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 424 424 else: 425 425 speech.speakMessage(_("edge of table")) 426 426 … … 432 432 if info._moveInTable(-1,0): 433 433 info.updateCaret() 434 434 info.expand(textInfos.UNIT_CELL) 435 speech.speakTextInfo(info,reason= speech.REASON_CARET)435 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 436 436 else: 437 437 speech.speakMessage(_("edge of table")) 438 438 -
source/api.py
=== modified file 'source/api.py'
1 1 #api.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 07NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 78 78 safetyCount+=1 79 79 else: 80 80 try: 81 log.error("Never ending focus ancestry: last object: %s, %s, window class %s, application name %s"%(tempObj.name,controlTypes. speechRoleLabels[tempObj.role],tempObj.windowClassName,tempObj.appModule.appName))81 log.error("Never ending focus ancestry: last object: %s, %s, window class %s, application name %s"%(tempObj.name,controlTypes.labels[tempObj.role],tempObj.windowClassName,tempObj.appModule.appName)) 82 82 except: 83 83 pass 84 84 tempObj=getDesktopObject() -
source/appModules/firefox.py
=== modified file 'source/appModules/firefox.py'
1 1 #appModules/firefox.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 08NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 18 18 if statusBar: 19 19 statusText = api.getStatusBarText(statusBar) 20 20 speech.cancelSpeech() 21 speech.speakMessage(controlTypes.s peechStateLabels[controlTypes.STATE_BUSY])21 speech.speakMessage(controlTypes.stateLabels[controlTypes.STATE_BUSY]) 22 22 speech.speakMessage(statusText) 23 23 return 24 24 nextHandler() -
source/appModules/miranda32.py
=== modified file 'source/appModules/miranda32.py'
1 1 #appModules/miranda32.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 07NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 161 161 gesture.send() 162 162 if not isScriptWaiting(): 163 163 api.processPendingEvents() 164 speech.speakObject(self,reason= speech.REASON_FOCUS)164 speech.speakObject(self,reason=controlTypes.REASON_FOCUS) 165 165 braille.handler.handleGainFocus(self) 166 166 167 167 __changeItemGestures = ( -
source/appModules/msimn.py
=== modified file 'source/appModules/msimn.py'
1 1 #appModules/msimn.py - Outlook Express appModule 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-201 0NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 87 87 nameList=[] 88 88 imageState=winUser.sendMessage(self.windowHandle,sysListView32.LVM_GETITEMSTATE,self.IAccessibleChildID-1,sysListView32.LVIS_STATEIMAGEMASK)>>12 89 89 if imageState==5: 90 nameList.append(controlTypes.s peechStateLabels[controlTypes.STATE_COLLAPSED])90 nameList.append(controlTypes.stateLabels[controlTypes.STATE_COLLAPSED]) 91 91 elif imageState==6: 92 nameList.append(controlTypes.s peechStateLabels[controlTypes.STATE_EXPANDED])92 nameList.append(controlTypes.stateLabels[controlTypes.STATE_EXPANDED]) 93 93 if self.isUnread: 94 94 nameList.append(_("unread")) 95 95 name=super(MessageListItem,self).name -
source/appModules/thunderbird.py
=== modified file 'source/appModules/thunderbird.py'
1 1 #appModules/thunderbird.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 08NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 22 22 except: 23 23 # Fall back to reading the entire status bar. 24 24 statusText = api.getStatusBarText(statusBar) 25 speech.speakMessage(controlTypes.s peechStateLabels[controlTypes.STATE_BUSY])25 speech.speakMessage(controlTypes.stateLabels[controlTypes.STATE_BUSY]) 26 26 speech.speakMessage(statusText) 27 27 return 28 28 nextHandler() -
source/appModules/totalcmd.py
=== modified file 'source/appModules/totalcmd.py'
1 1 #appModules/totalcmd.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 08NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 41 41 if self.name: 42 42 speakList=[] 43 43 if controlTypes.STATE_SELECTED in self.states: 44 speakList.append(controlTypes.s peechStateLabels[controlTypes.STATE_SELECTED])44 speakList.append(controlTypes.stateLabels[controlTypes.STATE_SELECTED]) 45 45 speakList.append(self.name.split("\\")[-1]) 46 46 speech.speakMessage(" ".join(speakList)) 47 47 else: -
source/appModules/winamp.py
=== modified file 'source/appModules/winamp.py'
1 1 #appModules/winamp.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-201 0NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 115 115 gesture.send() 116 116 if not isScriptWaiting(): 117 117 api.processPendingEvents() 118 speech.speakObject(self,reason= speech.REASON_FOCUS)118 speech.speakObject(self,reason=controlTypes.REASON_FOCUS) 119 119 120 120 def event_nameChange(self): 121 121 return super(winampMainWindow,self).event_nameChange() -
source/braille.py
=== modified file 'source/braille.py'
73 73 ("zh-tw.ctb", _("Chinese (Taiwan, Mandarin)")), 74 74 ) 75 75 76 roleLabels = {76 labels = { 77 77 controlTypes.ROLE_EDITABLETEXT: _("edt"), 78 78 controlTypes.ROLE_LIST: _("lst"), 79 79 controlTypes.ROLE_MENUBAR: _("mnubar"), … … 209 209 textList.append(name) 210 210 role = propertyValues.get("role") 211 211 if role is not None: 212 if name and role in speech.silentRolesOnFocus:212 if name and role in controlTypes.ignoreRolesOnFocus: 213 213 roleText = None 214 214 else: 215 roleText = roleLabels.get(role, controlTypes.speechRoleLabels[role])215 roleText = labels.get(role, controlTypes.labels[role]) 216 216 else: 217 217 role = propertyValues.get("_role") 218 218 roleText = None 219 219 value = propertyValues.get("value") 220 if value and role not in speech.silentValuesForRoles:220 if value and role not in controlTypes.ignoreValuesForRoles: 221 221 textList.append(value) 222 222 states = propertyValues.get("states") 223 223 if states: 224 positiveStates = speech.processPositiveStates(role, states, speech.REASON_FOCUS, states)225 textList.extend(positiveStateLabels.get(state, controlTypes.s peechStateLabels[state]) for state in positiveStates)226 negativeStates = speech.processNegativeStates(role, states, speech.REASON_FOCUS, None)227 textList.extend(negativeStateLabels.get(state, _("not %s") % controlTypes.s peechStateLabels[state]) for state in negativeStates)224 positiveStates = controlTypes.processPositiveStates(role, states, controlTypes.REASON_FOCUS, states) 225 textList.extend(positiveStateLabels.get(state, controlTypes.stateLabels[state]) for state in positiveStates) 226 negativeStates = controlTypes.processNegativeStates(role, states, controlTypes.REASON_FOCUS, None) 227 textList.extend(negativeStateLabels.get(state, _("not %s") % controlTypes.stateLabels[state]) for state in negativeStates) 228 228 if roleText: 229 229 textList.append(roleText) 230 230 description = propertyValues.get("description") -
source/compoundDocuments.py
=== modified file 'source/compoundDocuments.py'
2 2 #A part of NonVisual Desktop Access (NVDA) 3 3 #This file is covered by the GNU General Public License. 4 4 #See the file COPYING for more details. 5 #Copyright (C) 2010 James Teh <jamie@jantrid.net>5 #Copyright (C) 2010-2011 James Teh <jamie@jantrid.net> 6 6 7 7 import winUser 8 8 import textInfos … … 388 388 return eventHandler.lastQueuedFocusObject 389 389 390 390 def event_treeInterceptor_gainFocus(self): 391 speech.speakObject(self.rootNVDAObject, reason= speech.REASON_FOCUS)391 speech.speakObject(self.rootNVDAObject, reason=controlTypes.REASON_FOCUS) 392 392 try: 393 393 info = self.makeTextInfo(textInfos.POSITION_SELECTION) 394 394 except RuntimeError: -
source/controlTypes.py
=== modified file 'source/controlTypes.py'
1 #controlTypes.py 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 #This file is covered by the GNU General Public License. 5 #See the file COPYING for more details. 1 6 2 7 ROLE_UNKNOWN=0 3 8 ROLE_WINDOW=1 … … 178 183 STATE_SORTED_DESCENDING=0x200000000 179 184 STATES_SORTED=frozenset([STATE_SORTED,STATE_SORTED_ASCENDING,STATE_SORTED_DESCENDING]) 180 185 181 speechRoleLabels={186 labels={ 182 187 ROLE_UNKNOWN:_("unknown"), 183 188 ROLE_WINDOW:_("window"), 184 189 ROLE_TITLEBAR:_("title bar"), … … 323 328 ROLE_CALENDAR:_("calendar"), 324 329 } 325 330 326 s peechStateLabels={331 stateLabels={ 327 332 STATE_UNAVAILABLE:_("unavailable"), 328 333 STATE_FOCUSED:_("focused"), 329 334 STATE_SELECTED:_("selected"), … … 359 364 STATE_SORTED_ASCENDING:_("sorted ascending"), 360 365 STATE_SORTED_DESCENDING:_("sorted descending"), 361 366 } 367 368 ignoreRolesOnFocus=set([ 369 ROLE_PANE, 370 ROLE_ROOTPANE, 371 ROLE_FRAME, 372 ROLE_UNKNOWN, 373 ROLE_APPLICATION, 374 ROLE_TABLECELL, 375 ROLE_LISTITEM, 376 ROLE_MENUITEM, 377 ROLE_CHECKMENUITEM, 378 ROLE_TREEVIEWITEM, 379 ]) 380 381 ignoreValuesForRoles=set([ 382 ROLE_CHECKBOX, 383 ROLE_RADIOBUTTON, 384 ROLE_LINK, 385 ROLE_MENUITEM, 386 ROLE_APPLICATION, 387 ]) 388 389 # Reason constants, to determine why information is required, enables us to provide different information depending 390 # on an object is being focused, the user specifically requested information via a query etc. 391 REASON_FOCUS=1 392 REASON_MOUSE=2 393 REASON_QUERY=3 394 REASON_CHANGE=4 395 REASON_MESSAGE=5 396 REASON_SAYALL=6 397 REASON_CARET=7 398 REASON_DEBUG=8 399 REASON_ONLYCACHE=9 400 REASON_FOCUSENTERED=10 401 402 def processPositiveStates(role, states, reason, positiveStates): 403 positiveStates = positiveStates.copy() 404 # The user never cares about certain states. 405 if role==ROLE_EDITABLETEXT: 406 positiveStates.discard(STATE_EDITABLE) 407 if role!=ROLE_LINK: 408 positiveStates.discard(STATE_VISITED) 409 positiveStates.discard(STATE_SELECTABLE) 410 positiveStates.discard(STATE_FOCUSABLE) 411 positiveStates.discard(STATE_CHECKABLE) 412 if STATE_DRAGGING in positiveStates: 413 # It's obvious that the control is draggable if it's being dragged. 414 positiveStates.discard(STATE_DRAGGABLE) 415 if role == ROLE_COMBOBOX: 416 # Combo boxes inherently have a popup, so don't report it. 417 positiveStates.discard(STATE_HASPOPUP) 418 if reason == REASON_QUERY: 419 return positiveStates 420 positiveStates.discard(STATE_DEFUNCT) 421 positiveStates.discard(STATE_MODAL) 422 positiveStates.discard(STATE_FOCUSED) 423 positiveStates.discard(STATE_OFFSCREEN) 424 positiveStates.discard(STATE_INVISIBLE) 425 if reason != REASON_CHANGE: 426 positiveStates.discard(STATE_LINKED) 427 if role in (ROLE_LISTITEM, ROLE_TREEVIEWITEM, ROLE_MENUITEM, ROLE_TABLEROW) and STATE_SELECTABLE in states: 428 positiveStates.discard(STATE_SELECTED) 429 if role != ROLE_EDITABLETEXT: 430 positiveStates.discard(STATE_READONLY) 431 if role == ROLE_CHECKBOX: 432 positiveStates.discard(STATE_PRESSED) 433 if role == ROLE_MENUITEM: 434 # The user doesn't usually care if a menu item is expanded or collapsed. 435 positiveStates.discard(STATE_COLLAPSED) 436 positiveStates.discard(STATE_EXPANDED) 437 return positiveStates 438 439 def processNegativeStates(role, states, reason, negativeStates): 440 presentNegatives = set() 441 # Add the negative selected state if the control is selectable, 442 # but only if it is either focused or this is something other than a change event. 443 # The condition stops "not selected" from being presented in some broken controls 444 # when the state change for the previous focus is issued before the focus change. 445 if role in (ROLE_LISTITEM, ROLE_TREEVIEWITEM, ROLE_TABLEROW) and STATE_SELECTABLE in states and (reason != REASON_CHANGE or STATE_FOCUSED in states): 446 presentNegatives.add(STATE_SELECTED) 447 # Restrict "not checked" in a similar way to "not selected". 448 if (role in (ROLE_CHECKBOX, ROLE_RADIOBUTTON, ROLE_CHECKMENUITEM) or STATE_CHECKABLE in states) and (STATE_HALFCHECKED not in states) and (reason != REASON_CHANGE or STATE_FOCUSED in states): 449 presentNegatives.add(STATE_CHECKED) 450 if reason == REASON_CHANGE: 451 # We want to present this state only if it is changing to negative. 452 presentNegatives.add(STATE_DROPTARGET) 453 # We were given states which have changed to negative. 454 # Return only those supplied negative states which should be presented; 455 # i.e. the states in both sets. 456 presentNegatives &= negativeStates 457 if STATES_SORTED & negativeStates and not STATES_SORTED & states: 458 # If the object has just stopped being sorted, just report not sorted. 459 # The user doesn't care how it was sorted before. 460 presentNegatives.add(STATE_SORTED) 461 return presentNegatives 462 else: 463 # This is not a state change; only positive states were supplied. 464 # Return all negative states which should be presented, excluding the positive states. 465 return presentNegatives - states 466 -
source/cursorManager.py
=== modified file 'source/cursorManager.py'
1 1 #cursorManager.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 08NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 … … 17 17 import speech 18 18 import config 19 19 import braille 20 import controlTypes 20 21 21 22 class CursorManager(baseObject.ScriptableObject): 22 23 """ … … 72 73 info.move(unit,direction) 73 74 self.selection=info 74 75 info.expand(unit) 75 speech.speakTextInfo(info,unit=unit,reason= speech.REASON_CARET)76 speech.speakTextInfo(info,unit=unit,reason=controlTypes.REASON_CARET) 76 77 if not oldInfo.isCollapsed: 77 78 speech.speakSelectionChange(oldInfo,self.selection) 78 79 … … 93 94 self.selection=info 94 95 speech.cancelSpeech() 95 96 info.move(textInfos.UNIT_LINE,1,endPoint="end") 96 speech.speakTextInfo(info,reason= speech.REASON_CARET)97 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 97 98 else: 98 99 wx.CallAfter(gui.messageBox,_('text "%s" not found')%text,_("Find Error"),wx.OK|wx.ICON_ERROR) 99 100 CursorManager._lastFindText=text -
source/editableText.py
=== modified file 'source/editableText.py'
2 2 #A part of NonVisual Desktop Access (NVDA) 3 3 #This file is covered by the GNU General Public License. 4 4 #See the file COPYING for more details. 5 #Copyright (C) 2006-201 0Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net>5 #Copyright (C) 2006-2011 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net> 6 6 7 7 """Common support for editable text. 8 8 """ … … 13 13 import braille 14 14 import speech 15 15 import config 16 import controlTypes 16 17 import eventHandler 17 18 from scriptHandler import isScriptWaiting 18 19 import textInfos … … 65 66 api.setReviewPosition(info.copy()) 66 67 if speakUnit: 67 68 info.expand(speakUnit) 68 speech.speakTextInfo(info, unit=speakUnit, reason= speech.REASON_CARET)69 speech.speakTextInfo(info, unit=speakUnit, reason=controlTypes.REASON_CARET) 69 70 70 71 def _caretMovementScriptHelper(self, gesture, unit): 71 72 try: -
source/globalCommands.py
=== modified file 'source/globalCommands.py'
2 2 #A part of NonVisual Desktop Access (NVDA) 3 3 #This file is covered by the GNU General Public License. 4 4 #See the file COPYING for more details. 5 #Copyright (C) 2006-201 0Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net>, Peter Vágner <peter.v@datagate.sk>, Aleksey Sadovoy <lex@onm.su>, Rui Batista<ruiandrebatista@gmail.com>5 #Copyright (C) 2006-2011 Michael Curran <mick@kulgan.net>, James Teh <jamie@jantrid.net>, Peter Vágner <peter.v@datagate.sk>, Aleksey Sadovoy <lex@onm.su>, Rui Batista<ruiandrebatista@gmail.com> 6 6 7 7 import time 8 8 import tones … … 65 65 info=obj.makeTextInfo(textInfos.POSITION_FIRST) 66 66 info.expand(textInfos.UNIT_LINE) 67 67 if scriptHandler.getLastScriptRepeatCount()==0: 68 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason= speech.REASON_CARET)68 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET) 69 69 else: 70 70 speech.speakSpelling(info.text) 71 71 script_reportCurrentLine.__doc__=_("Reports the current line under the application cursor. Pressing this key twice will spell the current line") … … 287 287 if api.copyToClip(text): 288 288 speech.speakMessage(_("%s copied to clipboard")%text) 289 289 else: 290 speech.speakObject(curObject,reason= speech.REASON_QUERY)290 speech.speakObject(curObject,reason=controlTypes.REASON_QUERY) 291 291 script_navigatorObject_current.__doc__=_("Reports the current navigator object. Pressing twice spells this information,and pressing three times Copies name and value of this object to the clipboard") 292 292 293 293 def script_navigatorObject_currentDimensions(self,gesture): … … 317 317 pos=obj.makeTextInfo(textInfos.POSITION_FIRST) 318 318 api.setReviewPosition(pos) 319 319 speech.speakMessage(_("move to focus")) 320 speech.speakObject(obj,reason= speech.REASON_QUERY)320 speech.speakObject(obj,reason=controlTypes.REASON_QUERY) 321 321 script_navigatorObject_toFocus.__doc__=_("Sets the navigator object to the current focus, and the review cursor to the position of the caret inside it, if possible.") 322 322 323 323 def script_navigatorObject_moveFocus(self,gesture): … … 336 336 return 337 337 info=review.copy() 338 338 info.expand(textInfos.UNIT_LINE) 339 speech.speakTextInfo(info,reason= speech.REASON_CARET)339 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET) 340 340 script_navigatorObject_moveFocus.__doc__=_("Pressed once Sets the keyboard focus to the navigator object, pressed twice sets the system caret to the position of the review cursor") 341 341 342 342 def script_navigatorObject_parent(self,gesture): … … 348 348 curObject=curObject.simpleParent if simpleReviewMode else curObject.parent 349 349 if curObject is not None: 350 350 api.setNavigatorObject(curObject) 351 speech.speakObject(curObject,reason= speech.REASON_QUERY)351 speech.speakObject(curObject,reason=controlTypes.REASON_QUERY) 352 352 else: 353 353 speech.speakMessage(_("No parents")) 354 354 script_navigatorObject_parent.__doc__=_("Moves the navigator object to the object containing it") … … 362 362 curObject=curObject.simpleNext if simpleReviewMode else curObject.next 363 363 if curObject is not None: 364 364 api.setNavigatorObject(curObject) 365 speech.speakObject(curObject,reason= speech.REASON_QUERY)365 speech.speakObject(curObject,reason=controlTypes.REASON_QUERY) 366 366 else: 367 367 speech.speakMessage(_("No next")) 368 368 script_navigatorObject_next.__doc__=_("Moves the navigator object to the next object") … … 376 376 curObject=curObject.simplePrevious if simpleReviewMode else curObject.previous 377 377 if curObject is not None: 378 378 api.setNavigatorObject(curObject) 379 speech.speakObject(curObject,reason= speech.REASON_QUERY)379 speech.speakObject(curObject,reason=controlTypes.REASON_QUERY) 380 380 else: 381 381 speech.speakMessage(_("No previous")) 382 382 script_navigatorObject_previous.__doc__=_("Moves the navigator object to the previous object") … … 390 390 curObject=curObject.simpleFirstChild if simpleReviewMode else curObject.firstChild 391 391 if curObject is not None: 392 392 api.setNavigatorObject(curObject) 393 speech.speakObject(curObject,reason= speech.REASON_QUERY)393 speech.speakObject(curObject,reason=controlTypes.REASON_QUERY) 394 394 else: 395 395 speech.speakMessage(_("No children")) 396 396 script_navigatorObject_firstChild.__doc__=_("Moves the navigator object to the first object it contains") … … 418 418 api.setReviewPosition(info.copy()) 419 419 info.expand(textInfos.UNIT_LINE) 420 420 speech.speakMessage(_("top")) 421 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason= speech.REASON_CARET)421 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET) 422 422 script_review_top.__doc__=_("Moves the review cursor to the top line of the current navigator object and speaks it") 423 423 424 424 def script_review_previousLine(self,gesture): … … 430 430 info.expand(textInfos.UNIT_LINE) 431 431 if res==0: 432 432 speech.speakMessage(_("top")) 433 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason= speech.REASON_CARET)433 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET) 434 434 script_review_previousLine.__doc__=_("Moves the review cursor to the previous line of the current navigator object and speaks it") 435 435 436 436 def script_review_currentLine(self,gesture): … … 438 438 info.expand(textInfos.UNIT_LINE) 439 439 scriptCount=scriptHandler.getLastScriptRepeatCount() 440 440 if scriptCount==0: 441 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason= speech.REASON_CARET)441 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET) 442 442 else: 443 443 speech.speakSpelling(info.text,useCharacterDescriptions=bool(scriptCount>1)) 444 444 script_review_currentLine.__doc__=_("Reports the line of the current navigator object where the review cursor is situated. If this key is pressed twice, the current line will be spelled. Pressing three times will spell the line using character descriptions.") … … 452 452 info.expand(textInfos.UNIT_LINE) 453 453 if res==0: 454 454 speech.speakMessage(_("bottom")) 455 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason= speech.REASON_CARET)455 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET) 456 456 script_review_nextLine.__doc__=_("Moves the review cursor to the next line of the current navigator object and speaks it") 457 457 458 458 def script_review_bottom(self,gesture): … … 460 460 api.setReviewPosition(info.copy()) 461 461 info.expand(textInfos.UNIT_LINE) 462 462 speech.speakMessage(_("bottom")) 463 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason= speech.REASON_CARET)463 speech.speakTextInfo(info,unit=textInfos.UNIT_LINE,reason=controlTypes.REASON_CARET) 464 464 script_review_bottom.__doc__=_("Moves the review cursor to the bottom line of the current navigator object and speaks it") 465 465 466 466 def script_review_previousWord(self,gesture): … … 472 472 info.expand(textInfos.UNIT_WORD) 473 473 if res==0: 474 474 speech.speakMessage(_("top")) 475 speech.speakTextInfo(info,reason= speech.REASON_CARET,unit=textInfos.UNIT_WORD)475 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET,unit=textInfos.UNIT_WORD) 476 476 script_review_previousWord.__doc__=_("Moves the review cursor to the previous word of the current navigator object and speaks it") 477 477 478 478 def script_review_currentWord(self,gesture): … … 480 480 info.expand(textInfos.UNIT_WORD) 481 481 scriptCount=scriptHandler.getLastScriptRepeatCount() 482 482 if scriptCount==0: 483 speech.speakTextInfo(info,reason= speech.REASON_CARET,unit=textInfos.UNIT_WORD)483 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET,unit=textInfos.UNIT_WORD) 484 484 else: 485 485 speech.speakSpelling(info.text,useCharacterDescriptions=bool(scriptCount>1)) 486 486 script_review_currentWord.__doc__=_("Speaks the word of the current navigator object where the review cursor is situated. If this key is pressed twice, the word will be spelled") … … 494 494 info.expand(textInfos.UNIT_WORD) 495 495 if res==0: 496 496 speech.speakMessage(_("bottom")) 497 speech.speakTextInfo(info,reason= speech.REASON_CARET,unit=textInfos.UNIT_WORD)497 speech.speakTextInfo(info,reason=controlTypes.REASON_CARET,unit=textInfos.UNIT_WORD) 498 498 script_review_nextWord.__doc__=_("Moves the review cursor to the next word of the current navigator object and speaks it") 499 499 500 500 def script_review_startOfLine(self,gesture): … … 504 504 api.setReviewPosition(info.copy()) 505 505 info.expand(textInfos.UNIT_CHARACTER) 506 506 speech.speakMessage(_("left")) 507 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)507 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 508 508 script_review_startOfLine.__doc__=_("Moves the review cursor to the first character of the line where it is situated in the current navigator object and speaks it") 509 509 510 510 def script_review_previousCharacter(self,gesture): … … 518 518 speech.speakMessage(_("left")) 519 519 reviewInfo=api.getReviewPosition().copy() 520 520 reviewInfo.expand(textInfos.UNIT_CHARACTER) 521 speech.speakTextInfo(reviewInfo,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)521 speech.speakTextInfo(reviewInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 522 522 else: 523 523 api.setReviewPosition(charInfo.copy()) 524 524 charInfo.expand(textInfos.UNIT_CHARACTER) 525 speech.speakTextInfo(charInfo,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)525 speech.speakTextInfo(charInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 526 526 script_review_previousCharacter.__doc__=_("Moves the review cursor to the previous character of the current navigator object and speaks it") 527 527 528 528 def script_review_currentCharacter(self,gesture): … … 530 530 info.expand(textInfos.UNIT_CHARACTER) 531 531 scriptCount=scriptHandler.getLastScriptRepeatCount() 532 532 if scriptCount==0: 533 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)533 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 534 534 elif scriptCount==1: 535 535 speech.speakSpelling(info.text,useCharacterDescriptions=True) 536 536 else: … … 539 539 speech.speakMessage("%d," % c) 540 540 speech.speakSpelling(hex(c)) 541 541 except: 542 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)542 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 543 543 script_review_currentCharacter.__doc__=_("Reports the character of the current navigator object where the review cursor is situated. If this key is pressed twice, ascii and hexadecimal values are spoken for the character") 544 544 545 545 def script_review_nextCharacter(self,gesture): … … 553 553 speech.speakMessage(_("right")) 554 554 reviewInfo=api.getReviewPosition().copy() 555 555 reviewInfo.expand(textInfos.UNIT_CHARACTER) 556 speech.speakTextInfo(reviewInfo,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)556 speech.speakTextInfo(reviewInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 557 557 else: 558 558 api.setReviewPosition(charInfo.copy()) 559 559 charInfo.expand(textInfos.UNIT_CHARACTER) 560 speech.speakTextInfo(charInfo,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)560 speech.speakTextInfo(charInfo,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 561 561 script_review_nextCharacter.__doc__=_("Moves the review cursor to the next character of the current navigator object and speaks it") 562 562 563 563 def script_review_endOfLine(self,gesture): … … 568 568 api.setReviewPosition(info.copy()) 569 569 info.expand(textInfos.UNIT_CHARACTER) 570 570 speech.speakMessage(_("right")) 571 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason= speech.REASON_CARET)571 speech.speakTextInfo(info,unit=textInfos.UNIT_CHARACTER,reason=controlTypes.REASON_CARET) 572 572 script_review_endOfLine.__doc__=_("Moves the review cursor to the last character of the line where it is situated in the current navigator object and speaks it") 573 573 574 574 def script_speechMode(self,gesture): … … 666 666 focusObject=api.getFocusObject() 667 667 if isinstance(focusObject,NVDAObject): 668 668 if scriptHandler.getLastScriptRepeatCount()==0: 669 speech.speakObject(focusObject, reason= speech.REASON_QUERY)669 speech.speakObject(focusObject, reason=controlTypes.REASON_QUERY) 670 670 else: 671 671 speech.speakSpelling(focusObject.name) 672 672 else: … … 717 717 def script_speakForeground(self,gesture): 718 718 obj=api.getForegroundObject() 719 719 if obj: 720 speech.speakObject(obj,reason= speech.REASON_QUERY)720 speech.speakObject(obj,reason=controlTypes.REASON_QUERY) 721 721 obj.speakDescendantObjects() 722 722 script_speakForeground.__doc__ = _("speaks the current foreground object") 723 723 -
source/inputCore.py
=== modified file 'source/inputCore.py'
2 2 #A part of NonVisual Desktop Access (NVDA) 3 3 #This file is covered by the GNU General Public License. 4 4 #See the file COPYING for more details. 5 #Copyright (C) 2010 James Teh <jamie@jantrid.net>5 #Copyright (C) 2010-2011 James Teh <jamie@jantrid.net> 6 6 7 7 import sys 8 8 import os … … 15 15 import speech 16 16 import characterProcessing 17 17 import config 18 import controlTypes 18 19 import watchdog 19 20 from logHandler import log 20 21 import globalVars … … 337 338 import braille 338 339 braille.handler.message("\t\t".join(textList)) 339 340 # Punctuation must be spoken for the gesture name (the first chunk) so that punctuation keys are spoken. 340 speech.speakText(textList[0], reason= speech.REASON_MESSAGE, symbolLevel=characterProcessing.SYMLVL_ALL)341 speech.speakText(textList[0], reason=controlTypes.REASON_MESSAGE, symbolLevel=characterProcessing.SYMLVL_ALL) 341 342 for text in textList[1:]: 342 343 speech.speakMessage(text) 343 344 -
source/sayAllHandler.py
=== modified file 'source/sayAllHandler.py'
1 1 #sayAllHandler.py 2 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-20 07NVDA Contributors <http://www.nvda-project.org/>3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 4 #This file is covered by the GNU General Public License. 5 5 #See the file COPYING for more details. 6 6 7 7 import queueHandler 8 8 import config 9 import controlTypes 9 10 import speech 10 11 import textInfos 11 12 import globalVars … … 58 59 yield 59 60 continue 60 61 if keepReading: 61 speech.speakObject(obj,index=indexCount,reason= speech.REASON_SAYALL)62 speech.speakObject(obj,index=indexCount,reason=controlTypes.REASON_SAYALL) 62 63 up=[] 63 64 down=[] 64 65 obj=obj.getNextInFlow(up=up,down=down) … … 117 118 speech.speakWithoutPauses(None) 118 119 keepReading=False 119 120 continue 120 speech.speakTextInfo(reader,unit=textInfos.UNIT_READINGCHUNK,reason= speech.REASON_SAYALL,index=index)121 speech.speakTextInfo(reader,unit=textInfos.UNIT_READINGCHUNK,reason=controlTypes.REASON_SAYALL,index=index) 121 122 sendCount+=1 122 123 cursorIndexMap[index]=bookmark 123 124 reader.collapse(end=True) -
source/speech.py
=== modified file 'source/speech.py' (properties changed: +x to -x)
34 34 isPaused=False 35 35 curWordChars=[] 36 36 37 REASON_FOCUS=138 REASON_MOUSE=239 REASON_QUERY=340 REASON_CHANGE=441 REASON_MESSAGE=542 REASON_SAYALL=643 REASON_CARET=744 REASON_DEBUG=845 REASON_ONLYCACHE=946 REASON_FOCUSENTERED=1047 37 48 38 #: The string used to separate distinct chunks of text when multiple chunks should be spoken without pauses. 49 39 CHUNK_SEPARATOR = " " … … 122 112 @param index: the index to mark this current text with, its best to use the character position of the text if you know it 123 113 @type index: int 124 114 """ 125 speakText(text,index=index,reason= REASON_MESSAGE)115 speakText(text,index=index,reason=controlTypes.REASON_MESSAGE) 126 116 127 117 _speakSpellingGenID = None 128 118 … … 188 178 if uppercase and synthConfig["beepForCapitals"]: 189 179 tones.beep(2000,50) 190 180 191 def speakObjectProperties(obj,reason= REASON_QUERY,index=None,**allowedProperties):181 def speakObjectProperties(obj,reason=controlTypes.REASON_QUERY,index=None,**allowedProperties): 192 182 if speechMode==speechMode_off: 193 183 return 194 184 #Fetch the values for all wanted properties … … 216 206 cachedPropertyValues.update(newPropertyValues) 217 207 obj._speakObjectPropertiesCache=cachedPropertyValues 218 208 #If we should only cache we can stop here 219 if reason== REASON_ONLYCACHE:209 if reason==controlTypes.REASON_ONLYCACHE: 220 210 return 221 211 #If only speaking change, then filter out all values that havn't changed 222 if reason== REASON_CHANGE:212 if reason==controlTypes.REASON_CHANGE: 223 213 for name in set(newPropertyValues)&set(oldCachedPropertyValues): 224 214 if newPropertyValues[name]==oldCachedPropertyValues[name]: 225 215 del newPropertyValues[name] … … 237 227 if text: 238 228 speakText(text,index=index) 239 229 240 def speakObject(obj,reason= REASON_QUERY,index=None):230 def speakObject(obj,reason=controlTypes.REASON_QUERY,index=None): 241 231 from NVDAObjects import NVDAObjectTextInfo 242 isEditable=(reason!= REASON_FOCUSENTERED and obj.TextInfo!=NVDAObjectTextInfo and (obj.role in (controlTypes.ROLE_EDITABLETEXT,controlTypes.ROLE_TERMINAL) or controlTypes.STATE_EDITABLE in obj.states))232 isEditable=(reason!=controlTypes.REASON_FOCUSENTERED and obj.TextInfo!=NVDAObjectTextInfo and (obj.role in (controlTypes.ROLE_EDITABLETEXT, controlTypes.ROLE_TERMINAL) or controlTypes.STATE_EDITABLE in obj.states)) 243 233 allowProperties={'name':True,'role':True,'states':True,'value':True,'description':True,'keyboardShortcut':True,'positionInfo_level':True,'positionInfo_indexInGroup':True,'positionInfo_similarItemsInGroup':True,"rowNumber":True,"columnNumber":True,"columnCount":True,"rowCount":True} 244 234 245 if reason== REASON_FOCUSENTERED:235 if reason==controlTypes.REASON_FOCUSENTERED: 246 236 allowProperties["value"]=False 247 237 allowProperties["keyboardShortcut"]=False 248 238 allowProperties["positionInfo_level"]=False 249 239 # Aside from excluding some properties, focus entered should be spoken like focus. 250 reason= REASON_FOCUS240 reason=controlTypes.REASON_FOCUS 251 241 252 242 if not config.conf["presentation"]["reportObjectDescriptions"]: 253 243 allowProperties["description"]=False … … 257 247 allowProperties["positionInfo_level"]=False 258 248 allowProperties["positionInfo_indexInGroup"]=False 259 249 allowProperties["positionInfo_similarItemsInGroup"]=False 260 if reason!= REASON_QUERY:250 if reason!=controlTypes.REASON_QUERY: 261 251 allowProperties["rowCount"]=False 262 252 allowProperties["columnCount"]=False 263 253 if (not config.conf["documentFormatting"]["reportTables"] … … 269 259 allowProperties['value']=False 270 260 271 261 speakObjectProperties(obj,reason=reason,index=index,**allowProperties) 272 if reason!= REASON_ONLYCACHE and isEditable:262 if reason!=controlTypes.REASON_ONLYCACHE and isEditable: 273 263 try: 274 264 info=obj.makeTextInfo(textInfos.POSITION_SELECTION) 275 265 if not info.isCollapsed: … … 281 271 newInfo=obj.makeTextInfo(textInfos.POSITION_ALL) 282 272 speakTextInfo(newInfo,unit=textInfos.UNIT_PARAGRAPH,reason=reason) 283 273 284 def speakText(text,index=None,reason= REASON_MESSAGE,symbolLevel=None):274 def speakText(text,index=None,reason=controlTypes.REASON_MESSAGE,symbolLevel=None): 285 275 """Speaks some text. 286 276 @param text: The text to speak. 287 277 @type text: str 288 278 @param index: The index to mark this text with, which can be used later to determine whether this piece of text has been spoken. 289 279 @type index: int 290 @param reason: The reason for this speech; one of the REASON_* constants.280 @param reason: The reason for this speech; one of the controlTypes.REASON_* constants. 291 281 @param symbolLevel: The symbol verbosity level; C{None} (default) to use the user's configuration. 292 282 """ 293 283 speechSequence=[] … … 425 415 if config.conf["keyboard"]["speakTypedCharacters"] and ord(ch)>=32: 426 416 speakSpelling(realChar) 427 417 428 silentRolesOnFocus=set([ 429 controlTypes.ROLE_PANE, 430 controlTypes.ROLE_ROOTPANE, 431 controlTypes.ROLE_FRAME, 432 controlTypes.ROLE_UNKNOWN, 433 controlTypes.ROLE_APPLICATION, 434 controlTypes.ROLE_TABLECELL, 435 controlTypes.ROLE_LISTITEM, 436 controlTypes.ROLE_MENUITEM, 437 controlTypes.ROLE_CHECKMENUITEM, 438 controlTypes.ROLE_TREEVIEWITEM, 439 ]) 440 441 silentValuesForRoles=set([ 442 controlTypes.ROLE_CHECKBOX, 443 controlTypes.ROLE_RADIOBUTTON, 444 controlTypes.ROLE_LINK, 445 controlTypes.ROLE_MENUITEM, 446 controlTypes.ROLE_APPLICATION, 447 ]) 448 449 def processPositiveStates(role, states, reason, positiveStates): 450 positiveStates = positiveStates.copy() 451 # The user never cares about certain states. 452 if role==controlTypes.ROLE_EDITABLETEXT: 453 positiveStates.discard(controlTypes.STATE_EDITABLE) 454 if role!=controlTypes.ROLE_LINK: 455 positiveStates.discard(controlTypes.STATE_VISITED) 456 positiveStates.discard(controlTypes.STATE_SELECTABLE) 457 positiveStates.discard(controlTypes.STATE_FOCUSABLE) 458 positiveStates.discard(controlTypes.STATE_CHECKABLE) 459 if controlTypes.STATE_DRAGGING in positiveStates: 460 # It's obvious that the control is draggable if it's being dragged. 461 positiveStates.discard(controlTypes.STATE_DRAGGABLE) 462 if role == controlTypes.ROLE_COMBOBOX: 463 # Combo boxes inherently have a popup, so don't report it. 464 positiveStates.discard(controlTypes.STATE_HASPOPUP) 465 if reason == REASON_QUERY: 466 return positiveStates 467 positiveStates.discard(controlTypes.STATE_DEFUNCT) 468 positiveStates.discard(controlTypes.STATE_MODAL) 469 positiveStates.discard(controlTypes.STATE_FOCUSED) 470 positiveStates.discard(controlTypes.STATE_OFFSCREEN) 471 positiveStates.discard(controlTypes.STATE_INVISIBLE) 472 if reason != REASON_CHANGE: 473 positiveStates.discard(controlTypes.STATE_LINKED) 474 if role in (controlTypes.ROLE_LISTITEM, controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_TABLEROW) and controlTypes.STATE_SELECTABLE in states: 475 positiveStates.discard(controlTypes.STATE_SELECTED) 476 if role != controlTypes.ROLE_EDITABLETEXT: 477 positiveStates.discard(controlTypes.STATE_READONLY) 478 if role == controlTypes.ROLE_CHECKBOX: 479 positiveStates.discard(controlTypes.STATE_PRESSED) 480 if role == controlTypes.ROLE_MENUITEM: 481 # The user doesn't usually care if a menu item is expanded or collapsed. 482 positiveStates.discard(controlTypes.STATE_COLLAPSED) 483 positiveStates.discard(controlTypes.STATE_EXPANDED) 484 return positiveStates 485 486 def processNegativeStates(role, states, reason, negativeStates): 487 speakNegatives = set() 488 # Add the negative selected state if the control is selectable, 489 # but only if it is either focused or this is something other than a change event. 490 # The condition stops "not selected" from being spoken in some broken controls 491 # when the state change for the previous focus is issued before the focus change. 492 if role in (controlTypes.ROLE_LISTITEM, controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_TABLEROW) and controlTypes.STATE_SELECTABLE in states and (reason != REASON_CHANGE or controlTypes.STATE_FOCUSED in states): 493 speakNegatives.add(controlTypes.STATE_SELECTED) 494 # Restrict "not checked" in a similar way to "not selected". 495 if (role in (controlTypes.ROLE_CHECKBOX, controlTypes.ROLE_RADIOBUTTON, controlTypes.ROLE_CHECKMENUITEM) or controlTypes.STATE_CHECKABLE in states) and (controlTypes.STATE_HALFCHECKED not in states) and (reason != REASON_CHANGE or controlTypes.STATE_FOCUSED in states): 496 speakNegatives.add(controlTypes.STATE_CHECKED) 497 if reason == REASON_CHANGE: 498 # We want to speak this state only if it is changing to negative. 499 speakNegatives.add(controlTypes.STATE_DROPTARGET) 500 # We were given states which have changed to negative. 501 # Return only those supplied negative states which should be spoken; 502 # i.e. the states in both sets. 503 speakNegatives &= negativeStates 504 if controlTypes.STATES_SORTED & negativeStates and not controlTypes.STATES_SORTED & states: 505 # If the object has just stopped being sorted, just report not sorted. 506 # The user doesn't care how it was sorted before. 507 speakNegatives.add(controlTypes.STATE_SORTED) 508 return speakNegatives 509 else: 510 # This is not a state change; only positive states were supplied. 511 # Return all negative states which should be spoken, excluding the positive states. 512 return speakNegatives - states 513 514 def speakTextInfo(info,useCache=True,formatConfig=None,unit=None,extraDetail=False,reason=REASON_QUERY,index=None): 418 def speakTextInfo(info,useCache=True,formatConfig=None,unit=None,extraDetail=False,reason=controlTypes.REASON_QUERY,index=None): 515 419 if unit in (textInfos.UNIT_CHARACTER,textInfos.UNIT_WORD): 516 420 extraDetail=True 517 421 if not formatConfig: … … 651 555 textList.append(text) 652 556 653 557 # If there is nothing that should cause the TextInfo to be considered non-blank, blank should be reported, unless we are doing a say all. 654 if reason != REASON_SAYALL and len(textList)==textListBlankLen:558 if reason != controlTypes.REASON_SAYALL and len(textList)==textListBlankLen: 655 559 textList.append(_("blank")) 656 560 657 561 #Cache a copy of the new controlFieldStack for future use … … 667 571 if text: 668 572 speechSequence.append(text) 669 573 if speechSequence: 670 if reason== REASON_SAYALL:574 if reason==controlTypes.REASON_SAYALL: 671 575 speakWithoutPauses(speechSequence) 672 576 else: 673 577 speak(speechSequence) 674 578 675 def getSpeechTextForProperties(reason= REASON_QUERY,**propertyValues):579 def getSpeechTextForProperties(reason=controlTypes.REASON_QUERY,**propertyValues): 676 580 global oldTreeLevel, oldTableID, oldRowNumber, oldColumnNumber 677 581 textList=[] 678 582 name=propertyValues.get('name') … … 687 591 else: 688 592 speakRole=False 689 593 role=controlTypes.ROLE_UNKNOWN 690 value=propertyValues.get('value') if role not in silentValuesForRoles else None594 value=propertyValues.get('value') if role not in controlTypes.ignoreValuesForRoles else None 691 595 rowNumber=propertyValues.get('rowNumber') 692 596 columnNumber=propertyValues.get('columnNumber') 693 597 includeTableCellCoords=propertyValues.get('includeTableCellCoords',True) 694 if speakRole and (reason not in ( REASON_SAYALL,REASON_CARET,REASON_FOCUS) or not (name or value or rowNumber or columnNumber) or role not in silentRolesOnFocus):695 textList.append(controlTypes. speechRoleLabels[role])598 if speakRole and (reason not in (controlTypes.REASON_SAYALL, controlTypes.REASON_CARET, controlTypes.REASON_FOCUS) or not (name or value or rowNumber or columnNumber) or role not in controlTypes.ignoreRolesOnFocus): 599 textList.append(controlTypes.labels[role]) 696 600 if value: 697 601 textList.append(value) 698 602 states=propertyValues.get('states') 699 603 realStates=propertyValues.get('_states',states) 700 604 if states is not None: 701 positiveStates= processPositiveStates(role,realStates,reason,states)702 textList.extend([controlTypes.s peechStateLabels[x] for x in positiveStates])605 positiveStates=controlTypes.processPositiveStates(role,realStates,reason,states) 606 textList.extend([controlTypes.stateLabels[x] for x in positiveStates]) 703 607 if 'negativeStates' in propertyValues: 704 608 negativeStates=propertyValues['negativeStates'] 705 609 else: 706 610 negativeStates=None 707 if negativeStates is not None or (reason != REASON_CHANGE and states is not None):708 negativeStates= processNegativeStates(role, realStates, reason, negativeStates)611 if negativeStates is not None or (reason != controlTypes.REASON_CHANGE and states is not None): 612 negativeStates=controlTypes.processNegativeStates(role, realStates, reason, negativeStates) 709 613 if controlTypes.STATE_DROPTARGET in negativeStates: 710 614 # "not drop target" doesn't make any sense, so use a custom message. 711 615 textList.append(_("done dragging")) 712 616 negativeStates.discard(controlTypes.STATE_DROPTARGET) 713 textList.extend([_("not %s")%controlTypes.s peechStateLabels[x] for x in negativeStates])617 textList.extend([_("not %s")%controlTypes.stateLabels[x] for x in negativeStates]) 714 618 if 'description' in propertyValues: 715 619 textList.append(propertyValues['description']) 716 620 if 'keyboardShortcut' in propertyValues: … … 722 626 if 'positionInfo_level' in propertyValues: 723 627 level=propertyValues.get('positionInfo_level',None) 724 628 role=propertyValues.get('role',None) 725 if level is not None and role in (controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_LISTITEM) and level!=oldTreeLevel:629 if level is not None and role in (controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_LISTITEM) and level!=oldTreeLevel: 726 630 textList.insert(0,_("level %s")%level) 727 631 oldTreeLevel=level 728 632 elif level: … … 766 670 formatConfig=config.conf["documentFormatting"] 767 671 768 672 childCount=int(attrs.get('_childcount',"0")) 769 if reason== REASON_FOCUS or attrs.get('alwaysReportName',False):673 if reason==controlTypes.REASON_FOCUS or attrs.get('alwaysReportName',False): 770 674 name=attrs.get('name',"") 771 675 else: 772 676 name="" 773 role=attrs.get('role', controlTypes.ROLE_UNKNOWN)677 role=attrs.get('role', controlTypes.ROLE_UNKNOWN) 774 678 states=attrs.get('states',set()) 775 679 keyboardShortcut=attrs.get('keyboardShortcut', "") 776 if reason== REASON_FOCUS or attrs.get('alwaysReportDescription',False):680 if reason==controlTypes.REASON_FOCUS or attrs.get('alwaysReportDescription',False): 777 681 description=attrs.get('description',"") 778 682 else: 779 683 description="" 780 684 level=attrs.get('level',None) 781 685 782 686 #Remove the clickable state from controls that are clearly clickable according to their role 783 if role in (controlTypes.ROLE_LINK, controlTypes.ROLE_BUTTON,controlTypes.ROLE_CHECKBOX,controlTypes.ROLE_RADIOBUTTON):687 if role in (controlTypes.ROLE_LINK, controlTypes.ROLE_BUTTON, controlTypes.ROLE_CHECKBOX, controlTypes.ROLE_RADIOBUTTON): 784 688 states=states.copy() 785 689 states.discard(controlTypes.STATE_CLICKABLE) 786 690 … … 806 710 tableID=None 807 711 808 712 # Honour verbosity configuration. 809 if reason in ( REASON_CARET,REASON_SAYALL,REASON_FOCUS) and (713 if reason in (controlTypes.REASON_CARET, controlTypes.REASON_SAYALL, controlTypes.REASON_FOCUS) and ( 810 714 (role==controlTypes.ROLE_LINK and not formatConfig["reportLinks"]) or 811 715 (role==controlTypes.ROLE_HEADING and not formatConfig["reportHeadings"]) or 812 716 (role==controlTypes.ROLE_BLOCKQUOTE and not formatConfig["reportBlockQuotes"]) or 813 (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL,controlTypes.ROLE_TABLEROWHEADER,controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"]) or814 (role in (controlTypes.ROLE_LIST, controlTypes.ROLE_LISTITEM) and controlTypes.STATE_READONLY in states and not formatConfig["reportLists"])717 (role in (controlTypes.ROLE_TABLE, controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLEROWHEADER, controlTypes.ROLE_TABLECOLUMNHEADER) and not formatConfig["reportTables"]) or 718 (role in (controlTypes.ROLE_LIST, controlTypes.ROLE_LISTITEM) and controlTypes.STATE_READONLY in states and not formatConfig["reportLists"]) 815 719 ): 816 720 return "" 817 721 … … 830 734 # speakExitForOther: When moving by word or character, speak when the user exits the control. 831 735 speakEntry=speakWithinForLine=speakExitForLine=speakExitForOther=False 832 736 if ( 833 role in (controlTypes.ROLE_LINK, controlTypes.ROLE_HEADING,controlTypes.ROLE_BUTTON,controlTypes.ROLE_RADIOBUTTON,controlTypes.ROLE_CHECKBOX,controlTypes.ROLE_GRAPHIC,controlTypes.ROLE_MENUITEM,controlTypes.ROLE_TAB,controlTypes.ROLE_COMBOBOX,controlTypes.ROLE_SLIDER,controlTypes.ROLE_SPINBUTTON,controlTypes.ROLE_COMBOBOX,controlTypes.ROLE_PROGRESSBAR)737 role in (controlTypes.ROLE_LINK, controlTypes.ROLE_HEADING, controlTypes.ROLE_BUTTON, controlTypes.ROLE_RADIOBUTTON, controlTypes.ROLE_CHECKBOX, controlTypes.ROLE_GRAPHIC, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_TAB, controlTypes.ROLE_COMBOBOX, controlTypes.ROLE_SLIDER, controlTypes.ROLE_SPINBUTTON, controlTypes.ROLE_COMBOBOX, controlTypes.ROLE_PROGRESSBAR) 834 738 or (role==controlTypes.ROLE_EDITABLETEXT and controlTypes.STATE_MULTILINE not in states and (controlTypes.STATE_READONLY not in states or controlTypes.STATE_FOCUSABLE in states)) 835 739 or (role==controlTypes.ROLE_LIST and controlTypes.STATE_READONLY not in states) 836 740 ): … … 838 742 speakEntry=True 839 743 speakWithinForLine=True 840 744 speakExitForOther=True 841 elif role in (controlTypes.ROLE_SEPARATOR, controlTypes.ROLE_EMBEDDEDOBJECT):745 elif role in (controlTypes.ROLE_SEPARATOR, controlTypes.ROLE_EMBEDDEDOBJECT): 842 746 # This node is only ever a marker; i.e. single character. 843 747 speakEntry=True 844 748 elif ( 845 role in (controlTypes.ROLE_BLOCKQUOTE, controlTypes.ROLE_FRAME,controlTypes.ROLE_INTERNALFRAME,controlTypes.ROLE_TOOLBAR,controlTypes.ROLE_MENUBAR,controlTypes.ROLE_POPUPMENU)749 role in (controlTypes.ROLE_BLOCKQUOTE, controlTypes.ROLE_FRAME, controlTypes.ROLE_INTERNALFRAME, controlTypes.ROLE_TOOLBAR, controlTypes.ROLE_MENUBAR, controlTypes.ROLE_POPUPMENU) 846 750 or (role==controlTypes.ROLE_EDITABLETEXT and (controlTypes.STATE_READONLY not in states or controlTypes.STATE_FOCUSABLE in states) and controlTypes.STATE_MULTILINE in states) 847 751 or (role==controlTypes.ROLE_LIST and controlTypes.STATE_READONLY in states) 848 752 or (role==controlTypes.ROLE_DOCUMENT and controlTypes.STATE_EDITABLE in states) … … 855 759 856 760 # Determine the order of speech. 857 761 # speakContentFirst: Speak the content before the control field info. 858 speakContentFirst=reason== REASON_FOCUS and role not in (controlTypes.ROLE_EDITABLETEXT,controlTypes.ROLE_COMBOBOX) and controlTypes.STATE_EDITABLE not in states762 speakContentFirst=reason==controlTypes.REASON_FOCUS and role not in (controlTypes.ROLE_EDITABLETEXT, controlTypes.ROLE_COMBOBOX) and controlTypes.STATE_EDITABLE not in states 859 763 # speakStatesFirst: Speak the states before the role. 860 764 speakStatesFirst=role==controlTypes.ROLE_LINK 861 765 … … 871 775 elif fieldType=="start_addedToControlFieldStack" and role==controlTypes.ROLE_TABLE and tableID: 872 776 # Table. 873 777 return " ".join((roleText, getSpeechTextForProperties(_tableID=tableID, rowCount=attrs.get("table-rowcount"), columnCount=attrs.get("table-columncount")))) 874 elif fieldType=="start_addedToControlFieldStack" and role in (controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLECOLUMNHEADER,controlTypes.ROLE_TABLEROWHEADER) and tableID:778 elif fieldType=="start_addedToControlFieldStack" and role in (controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLECOLUMNHEADER, controlTypes.ROLE_TABLEROWHEADER) and tableID: 875 779 # Table cell. 876 780 reportTableHeaders = formatConfig["reportTableHeaders"] 877 781 reportTableCellCoords = formatConfig["reportTableCellCoords"] -
source/virtualBuffers/__init__.py
=== modified file 'source/virtualBuffers/__init__.py'
1 #VirtualBuffer.py 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-2011 NVDA Contributors <http://www.nvda-project.org/> 4 #This file is covered by the GNU General Public License. 5 #See the file COPYING for more details. 6 1 7 import time 2 8 import threading 3 9 import ctypes … … 488 494 489 495 def _reportElement(self, element): 490 496 speech.cancelSpeech() 491 speech.speakTextInfo(element,reason= speech.REASON_FOCUS)497 speech.speakTextInfo(element,reason=controlTypes.REASON_FOCUS) 492 498 493 499 class VirtualBuffer(cursorManager.CursorManager, treeInterceptorHandler.TreeInterceptor): 494 500 … … 647 653 self.selection = self.makeTextInfo(initialPos) 648 654 speech.cancelSpeech() 649 655 reportPassThrough(self) 650 speech.speakObjectProperties(self.rootNVDAObject,name=True,states=True,reason= speech.REASON_FOCUS)656 speech.speakObjectProperties(self.rootNVDAObject,name=True,states=True,reason=controlTypes.REASON_FOCUS) 651 657 info=self.makeTextInfo(textInfos.POSITION_CARET) 652 658 sayAllHandler.readText(info,sayAllHandler.CURSOR_CARET) 653 659 self._hadFirstGainFocus = True … … 656 662 # This buffer has had focus before. 657 663 if not self.passThrough: 658 664 # Speak it like we would speak focus on any other document object. 659 speech.speakObject(self.rootNVDAObject, reason= speech.REASON_FOCUS)665 speech.speakObject(self.rootNVDAObject, reason=controlTypes.REASON_FOCUS) 660 666 info = self.selection 661 667 if not info.isCollapsed: 662 668 speech.speakSelectionMessage(_("selected %s"), info.text) 663 669 else: 664 670 info.expand(textInfos.UNIT_LINE) 665 speech.speakTextInfo(info, reason= speech.REASON_CARET)671 speech.speakTextInfo(info, reason=controlTypes.REASON_CARET) 666 672 667 673 reportPassThrough(self) 668 674 braille.handler.handleGainFocus(self) … … 692 698 reportPassThrough(self) 693 699 elif obj.role == controlTypes.ROLE_EMBEDDEDOBJECT: 694 700 obj.setFocus() 695 speech.speakObject(obj, reason= speech.REASON_FOCUS)701 speech.speakObject(obj, reason=controlTypes.REASON_FOCUS) 696 702 else: 697 703 self._activateNVDAObject(obj) 698 704 699 def _set_selection(self, info, reason= speech.REASON_CARET):705 def _set_selection(self, info, reason=controlTypes.REASON_CARET): 700 706 super(VirtualBuffer, self)._set_selection(info) 701 707 if isScriptWaiting() or not info.isCollapsed: 702 708 return 703 709 if config.conf['reviewCursor']['followCaret'] and api.getNavigatorObject() is self.rootNVDAObject: 704 710 api.setReviewPosition(info) 705 if reason == speech.REASON_FOCUS:711 if reason == controlTypes.REASON_FOCUS: 706 712 focusObj = api.getFocusObject() 707 713 if focusObj==self.rootNVDAObject: 708 714 return … … 800 806 if info.compareEndPoints(fieldInfo, "endToEnd") > 0: 801 807 # We've expanded past the end of the field, so limit to the end of the field. 802 808 info.setEndPoint(fieldInfo, "endToEnd") 803 speech.speakTextInfo(info, reason= speech.REASON_FOCUS)809 speech.speakTextInfo(info, reason=controlTypes.REASON_FOCUS) 804 810 info.collapse() 805 811 self._set_selection(info, reason=self.REASON_QUICKNAV) 806 812 … … 837 843 """Determine whether pass through mode should be enabled or disabled for a given object. 838 844 @param obj: The object in question. 839 845 @type obj: L{NVDAObjects.NVDAObject} 840 @param reason: The reason for this query; one of the speech reasons, L{REASON_QUICKNAV}, or C{None} for manual pass through mode activation by the user.846 @param reason: The reason for this query; one of the reasons in controlTypes, L{REASON_QUICKNAV}, or C{None} for manual pass through mode activation by the user. 841 847 @return: C{True} if pass through mode should be enabled, C{False} if it should be disabled. 842 848 """ 843 849 if reason and ( 844 850 self.disableAutoPassThrough 845 or (reason == speech.REASON_FOCUS and not config.conf["virtualBuffers"]["autoPassThroughOnFocusChange"])846 or (reason == speech.REASON_CARET and not config.conf["virtualBuffers"]["autoPassThroughOnCaretMove"])851 or (reason == controlTypes.REASON_FOCUS and not config.conf["virtualBuffers"]["autoPassThroughOnFocusChange"]) 852 or (reason == controlTypes.REASON_CARET and not config.conf["virtualBuffers"]["autoPassThroughOnCaretMove"]) 847 853 ): 848 854 # This check relates to auto pass through and auto pass through is disabled, so don't change the pass through state. 849 855 return self.passThrough … … 855 861 role = obj.role 856 862 if controlTypes.STATE_READONLY in states and role != controlTypes.ROLE_EDITABLETEXT: 857 863 return False 858 if reason == speech.REASON_CARET:864 if reason == controlTypes.REASON_CARET: 859 865 return role == controlTypes.ROLE_EDITABLETEXT or (role == controlTypes.ROLE_DOCUMENT and controlTypes.STATE_EDITABLE in states) 860 if reason == speech.REASON_FOCUS and role in (controlTypes.ROLE_LISTITEM, controlTypes.ROLE_RADIOBUTTON):866 if reason == controlTypes.REASON_FOCUS and role in (controlTypes.ROLE_LISTITEM, controlTypes.ROLE_RADIOBUTTON): 861 867 return True 862 868 if role in (controlTypes.ROLE_COMBOBOX, controlTypes.ROLE_EDITABLETEXT, controlTypes.ROLE_LIST, controlTypes.ROLE_SLIDER, controlTypes.ROLE_TABCONTROL, controlTypes.ROLE_TAB, controlTypes.ROLE_MENUBAR, controlTypes.ROLE_POPUPMENU, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_TREEVIEW, controlTypes.ROLE_TREEVIEWITEM, controlTypes.ROLE_SPINBUTTON) or controlTypes.STATE_EDITABLE in states: 863 869 return True … … 942 948 # This node is already focused, so we need to move to and speak this node here. 943 949 newCaret = newInfo.copy() 944 950 newCaret.collapse() 945 self._set_selection(newCaret,reason= speech.REASON_FOCUS)951 self._set_selection(newCaret,reason=controlTypes.REASON_FOCUS) 946 952 if self.passThrough: 947 953 obj.event_gainFocus() 948 954 else: 949 speech.speakTextInfo(newInfo,reason= speech.REASON_FOCUS)955 speech.speakTextInfo(newInfo,reason=controlTypes.REASON_FOCUS) 950 956 else: 951 957 # This node doesn't have the focus, so just set focus to it. The gainFocus event will handle the rest. 952 958 obj.setFocus() … … 1008 1014 except: 1009 1015 # This object is not in the virtual buffer, even though it resides beneath the document. 1010 1016 # Automatic pass through should be enabled in certain circumstances where this occurs. 1011 if not self.passThrough and self.shouldPassThrough(obj,reason= speech.REASON_FOCUS):1017 if not self.passThrough and self.shouldPassThrough(obj,reason=controlTypes.REASON_FOCUS): 1012 1018 self.passThrough=True 1013 1019 reportPassThrough(self) 1014 1020 self._replayFocusEnteredEvents() … … 1025 1031 # If pass-through is disabled, cancel speech, as a focus change should cause page reading to stop. 1026 1032 # This must be done before auto-pass-through occurs, as we want to stop page reading even if pass-through will be automatically enabled by this focus change. 1027 1033 speech.cancelSpeech() 1028 self.passThrough=self.shouldPassThrough(obj,reason= speech.REASON_FOCUS)1034 self.passThrough=self.shouldPassThrough(obj,reason=controlTypes.REASON_FOCUS) 1029 1035 if not self.passThrough: 1030 1036 # We read the info from the buffer instead of the control itself. 1031 speech.speakTextInfo(focusInfo,reason= speech.REASON_FOCUS)1037 speech.speakTextInfo(focusInfo,reason=controlTypes.REASON_FOCUS) 1032 1038 # However, we still want to update the speech property cache so that property changes will be spoken properly. 1033 speech.speakObject(obj, speech.REASON_ONLYCACHE)1039 speech.speakObject(obj,controlTypes.REASON_ONLYCACHE) 1034 1040 else: 1035 1041 if not oldPassThrough: 1036 1042 self._replayFocusEnteredEvents() 1037 1043 nextHandler() 1038 1044 focusInfo.collapse() 1039 self._set_selection(focusInfo,reason= speech.REASON_FOCUS)1045 self._set_selection(focusInfo,reason=controlTypes.REASON_FOCUS) 1040 1046 else: 1041 1047 # The virtual buffer caret was already at the focused node. 1042 1048 if not self.passThrough: 1043 1049 # This focus change was caused by a virtual caret movement, so don't speak the focused node to avoid double speaking. 1044 1050 # However, we still want to update the speech property cache so that property changes will be spoken properly. 1045 speech.speakObject(obj, speech.REASON_ONLYCACHE)1051 speech.speakObject(obj,controlTypes.REASON_ONLYCACHE) 1046 1052 else: 1047 1053 return nextHandler() 1048 1054 … … 1076 1082 if not scrollInfo.isOverlapping(caretInfo): 1077 1083 if scrollInfo.isCollapsed: 1078 1084 scrollInfo.expand(textInfos.UNIT_LINE) 1079 speech.speakTextInfo(scrollInfo,reason= speech.REASON_CARET)1085 speech.speakTextInfo(scrollInfo,reason=controlTypes.REASON_CARET) 1080 1086 scrollInfo.collapse() 1081 1087 self.selection = scrollInfo 1082 1088 return True … … 1192 1198 # Retrieve the cell on which we started. 1193 1199 info = next(self._iterTableCells(tableID, row=origRow, column=origCol)) 1194 1200 1195 speech.speakTextInfo(info,formatConfig=formatConfig,reason= speech.REASON_CARET)1201 speech.speakTextInfo(info,formatConfig=formatConfig,reason=controlTypes.REASON_CARET) 1196 1202 info.collapse() 1197 1203 self.selection = info 1198 1204

