[Nvda-dev] commit r1875 - in trunk: . source/NVDAObjects/IAccessible source/appModules

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Nvda-dev] commit r1875 - in trunk: . source/NVDAObjects/IAccessible source/appModules

NVDA Subversion
Author: jteh
Date: Thu Apr  3 01:51:57 2008
New Revision: 1875

Log:
Changes to status bar reporting:
        * Status bars are generally at the bottom of the screen. Therefore, the reportStatusLine script now searches for the status bar by getting the object at the bottom left of the foreground object using screen coordinates. reportStatusLine now works in many more applications, including Mozilla products. Implements #8.
        * The reportStatusLine script now handles concatenation of the name/value for all children, rather than having a StatusBar NVDAObject which does this and fakes an object with no children. This means that one can now access the real representation of a status bar, which may actually be easier if one is only interested in certain portions of the information.
        * Remove the statusBar property of IAccessible NVDAObjects, as this is no longer necessary.
Fix the children property of IAccessible NVDAObjects to correctly handle children which are a completely different object to the parent. This fixes reading of Mozilla status bars.


Modified:
   trunk/   (props changed)
   trunk/source/NVDAObjects/IAccessible/__init__.py
   trunk/source/appModules/_default.py

Modified: trunk/source/NVDAObjects/IAccessible/__init__.py
==============================================================================
--- trunk/source/NVDAObjects/IAccessible/__init__.py (original)
+++ trunk/source/NVDAObjects/IAccessible/__init__.py Thu Apr  3 01:51:57 2008
@@ -372,10 +372,12 @@
  return []
  children=[]
  for child in IAccessibleHandler.accessibleChildren(self.IAccessibleObject,0,childCount):
- if child and child[0]==self.IAccessibleObject:
+ if child[0]==self.IAccessibleObject:
  children.append(IAccessible(windowHandle=self.windowHandle,IAccessibleObject=self.IAccessibleObject,IAccessibleChildID=child[1],event_windowHandle=self.event_windowHandle,event_objectID=self.event_objectID,event_childID=child[1]))
- elif child and child[0].accRole(child[1])==IAccessibleHandler.ROLE_SYSTEM_WINDOW:
+ elif child[0].accRole(child[1])==IAccessibleHandler.ROLE_SYSTEM_WINDOW:
  children.append(getNVDAObjectFromEvent(IAccessibleHandler.windowFromAccessibleObject(child[0]),IAccessibleHandler.OBJID_CLIENT,0))
+ else:
+ children.append(IAccessible(IAccessibleObject=child[0],IAccessibleChildID=child[1]))
  children=[x for x in children if x and winUser.isDescendantWindow(self.windowHandle,x.windowHandle)]
  return children
 
@@ -402,21 +404,6 @@
  except:
  pass
 
- def _get_statusBar(self):
- windowClasses=(u'msctls_statusbar32',u'TTntStatusBar.UnicodeClass',u'ATL:msctls_statusbar32')
- curWindow=self.windowHandle
- statusWindow=0
- while not statusWindow and curWindow:
- for windowClass in windowClasses:
- statusWindow=ctypes.windll.user32.FindWindowExW(curWindow,0,windowClass,0)
- if statusWindow:
- break
- curWindow=winUser.getAncestor(curWindow,winUser.GA_PARENT)
- if statusWindow:
- return getNVDAObjectFromEvent(statusWindow,IAccessibleHandler.OBJID_CLIENT,0)
- else:
- return None
-
  def _get_positionString(self):
  position=""
  childID=self.IAccessibleChildID
@@ -721,25 +708,6 @@
  def _get_description(self):
  return None
 
-class StatusBar(IAccessible):
-
- def _get_value(self):
- oldValue=super(StatusBar,self)._get_value()
- valueFromChildren=" ".join([" ".join([y for y in (x.name,x.value) if y and not y.isspace()]) for x in super(StatusBar,self)._get_children() if x.role in (controlTypes.ROLE_EDITABLETEXT,controlTypes.ROLE_STATICTEXT)])
- if valueFromChildren:
- return valueFromChildren
- else:
- return oldValue
-
- def _get_firstChild(self):
- return None
-
- def _get_lastChild(self):
- return None
-
- def _get_children(self):
- return []
-
 class SysLink(IAccessible):
 
  def reportFocus(self):
@@ -821,7 +789,6 @@
  ("Internet Explorer_Server",IAccessibleHandler.ROLE_SYSTEM_TEXT):"MSHTML.MSHTML",
  ("Internet Explorer_Server",IAccessibleHandler.ROLE_SYSTEM_PANE):"MSHTML.MSHTML",
  ("Internet Explorer_Server",IAccessibleHandler.ROLE_SYSTEM_CLIENT):"InternetExplorerClient",
- ("msctls_statusbar32",IAccessibleHandler.ROLE_SYSTEM_STATUSBAR):"StatusBar",
  ("TTntEdit.UnicodeClass",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
  ("TMaskEdit",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
  ("TTntMemo.UnicodeClass",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
@@ -840,7 +807,6 @@
  ("#32771",IAccessibleHandler.ROLE_SYSTEM_LISTITEM):"TaskListIcon",
  ("TInEdit.UnicodeClass",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
  ("TEdit",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
- ("TTntStatusBar.UnicodeClass",IAccessibleHandler.ROLE_SYSTEM_STATUSBAR):"StatusBar",
  ("ToolbarWindow32",IAccessibleHandler.ROLE_SYSTEM_PUSHBUTTON):"ToolBarButton",
  ("TFilenameEdit",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
  ("TSpinEdit",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
@@ -855,5 +821,4 @@
  ("TPasswordEdit",IAccessibleHandler.ROLE_SYSTEM_TEXT):"edit.Edit",
  ("#32768",IAccessibleHandler.ROLE_SYSTEM_MENUITEM):"MenuItem",
  ("ToolbarWindow32",IAccessibleHandler.ROLE_SYSTEM_MENUITEM):"MenuItem",
- ("ATL:msctls_statusbar32",IAccessibleHandler.ROLE_SYSTEM_STATUSBAR):"StatusBar",
 }

Modified: trunk/source/appModules/_default.py
==============================================================================
--- trunk/source/appModules/_default.py (original)
+++ trunk/source/appModules/_default.py Thu Apr  3 01:51:57 2008
@@ -598,16 +598,32 @@
  script_reportCurrentFocus.__doc__ = _("reports the object with focus")
 
  def script_reportStatusLine(self,keyPress,nextScript):
- focus=api.getFocusObject()
- statusBarObject=focus.statusBar
- if not statusBarObject:
+ import NVDAObjects.IAccessible
+ # The status bar is usually at the bottom of the screen.
+ # Therefore, get the object at the bottom left of the foreground object using screen coordinates.
+ foreground = api.getForegroundObject()
+ left, top, width, height = foreground.location
+ bottom = top + height - 1
+ obj = NVDAObjects.IAccessible.getNVDAObjectFromPoint(left, bottom)
+
+ # We may have landed in a child of the status bar, so search the ancestry for a status bar.
+ while obj and not obj.role == controlTypes.ROLE_STATUSBAR:
+ obj = obj.parent
+
+ if not obj:
  speech.speakMessage(_("no status bar found"))
  return
+
+ text = obj.name
+ if text is None:
+ text = ""
+ text += " ".join(chunk for child in obj.children for chunk in (child.name, child.value) if chunk and isinstance(chunk, basestring) and not chunk.isspace())
+
  if keyboardHandler.lastKeyCount == 1:
- speech.speakObject(statusBarObject,reason=speech.REASON_QUERY)
+ speech.speakMessage(text)
  else:
- speech.speakSpelling(statusBarObject.value)
- api.setNavigatorObject(statusBarObject)
+ speech.speakSpelling(text)
+ api.setNavigatorObject(obj)
  script_reportStatusLine.__doc__ = _("reads the current aplication status bar and moves the navigation cursor to it")
 
  def script_toggleReportObjectUnderMouse(self,keyPress,nextScript):


Loading...