Пример #1
0
	def __init__(self,windowHandle=None,parent=None,msg=None):
		if not parent or not msg:
			raise ArguementError("__init__ needs windowHandle, parent and msg arguments")
		if not windowHandle:
			windowHandle=parent.windowHandle
		self.msg=msg
		self.parent=parent
		Window.__init__(self,windowHandle=windowHandle)
Пример #2
0
	def __init__(self,windowHandle=None,parent=None,msg=None):
		if not parent or not msg:
			raise ArguementError("__init__ needs windowHandle, parent and msg arguments")
		if not windowHandle:
			windowHandle=parent.windowHandle
		self.msg=msg
		self.parent=parent
		Window.__init__(self,windowHandle=windowHandle)
Пример #3
0
	def event_NVDAObject_init(self, obj):
		if not isinstance(obj, Window):
			return
		role = obj.role
		if role == controlTypes.ROLE_WINDOW:
			return
		wclass = Window.normalizeWindowClassName(obj.windowClassName)

		if wclass == "Window.8" and role == controlTypes.ROLE_PANE:
			# optimisation: There are quite a lot of these, so let's not instantiate parent NVDAObjects unnecessarily.
			parentWindow = winUser.getAncestor(obj.windowHandle, winUser.GA_PARENT)
			if parentWindow and Window.normalizeWindowClassName(winUser.getClassName(parentWindow)) == "SysTabControl32":
				obj.role = controlTypes.ROLE_PROPERTYPAGE

		elif wclass == "SysTabControl32":
			obj.isPresentableFocusAncestor = False
Пример #4
0
	def event_NVDAObject_init(self,obj):
		role=obj.role
		windowClassName=obj.windowClassName
		controlID=obj.windowControlID
		#The control showing plain text messages has very stuffed parents
		#Use the grandparent window as its parent
		if role==controlTypes.ROLE_EDITABLETEXT and windowClassName=="RichEdit20W" and controlID==8224:
			obj.parent=Window._get_parent(Window._get_parent(obj))
		#The control that shows HTML messages has stuffed parents. Use the control's parent window as its parent
		if windowClassName=="Internet Explorer_Server" and role==controlTypes.ROLE_PANE and not isinstance(obj,MSHTML):
			obj.parent=Window._get_parent(Window._get_parent(obj))
		if role in (controlTypes.ROLE_MENUBAR,controlTypes.ROLE_MENUITEM):
			obj.description=None
		if role in (controlTypes.ROLE_TREEVIEW,controlTypes.ROLE_TREEVIEWITEM,controlTypes.ROLE_LIST,controlTypes.ROLE_LISTITEM):
			obj.shouldAllowIAccessibleFocusEvent=True
		if ((windowClassName=="SUPERGRID" and controlID==4704) or (windowClassName=="rctrl_renwnd32" and controlID==109)) and role==controlTypes.ROLE_UNKNOWN:
			obj.role=controlTypes.ROLE_LISTITEM
Пример #5
0
	def event_NVDAObject_init(self,obj):
		role=obj.role
		windowClassName=obj.windowClassName
		controlID=obj.windowControlID
		#The control showing plain text messages has very stuffed parents
		#Use the grandparent window as its parent
		if role==controlTypes.Role.EDITABLETEXT and windowClassName=="RichEdit20W" and controlID==8224:
			obj.parent=Window._get_parent(Window._get_parent(obj))
		#The control that shows HTML messages has stuffed parents. Use the control's parent window as its parent
		if windowClassName=="Internet Explorer_Server" and role==controlTypes.Role.PANE and not isinstance(obj,MSHTML):
			obj.parent=Window._get_parent(Window._get_parent(obj))
		if role in (controlTypes.Role.MENUBAR,controlTypes.Role.MENUITEM):
			obj.description=None
		if role in (controlTypes.Role.TREEVIEW,controlTypes.Role.TREEVIEWITEM,controlTypes.Role.LIST,controlTypes.Role.LISTITEM):
			obj.shouldAllowIAccessibleFocusEvent=True
		if ((windowClassName=="SUPERGRID" and controlID==4704) or (windowClassName=="rctrl_renwnd32" and controlID==109)) and role==controlTypes.Role.UNKNOWN:
			obj.role=controlTypes.Role.LISTITEM
Пример #6
0
	def event_valueChange(self,obj,nextHandler):
		#Ignore value changes from an annoying progress bar  which is a child of the main window
		#that keeps moving due to application performance
		if isinstance(obj,IAccessible) and obj.role==controlTypes.ROLE_PROGRESSBAR:
			windowParent=Window._get_parent(obj)
			if windowParent and windowParent.windowClassName=="SWT_Window0":
				return
		return nextHandler()
Пример #7
0
	def event_valueChange(self,obj,nextHandler):
		#Ignore value changes from an annoying progress bar  which is a child of the main window
		#that keeps moving due to application performance
		if isinstance(obj,IAccessible) and obj.role==controlTypes.ROLE_PROGRESSBAR:
			windowParent=Window._get_parent(obj)
			if windowParent and windowParent.windowClassName=="SWT_Window0":
				return
		return nextHandler()
Пример #8
0
    def event_NVDAObject_init(self, obj):
        if not isinstance(obj, Window):
            return
        role = obj.role
        if role == controlTypes.ROLE_WINDOW:
            return
        wclass = Window.normalizeWindowClassName(obj.windowClassName)

        if wclass == "Window.8" and role == controlTypes.ROLE_PANE:
            # optimisation: There are quite a lot of these, so let's not instantiate parent NVDAObjects unnecessarily.
            parentWindow = winUser.getAncestor(obj.windowHandle,
                                               winUser.GA_PARENT)
            if parentWindow and Window.normalizeWindowClassName(
                    winUser.getClassName(parentWindow)) == "SysTabControl32":
                obj.role = controlTypes.ROLE_PROPERTYPAGE

        elif wclass == "SysTabControl32":
            obj.isPresentableFocusAncestor = False
Пример #9
0
def getScreenPosition(obj):
	"""
	Fetches a TextInfo instance suitable for reviewing the screen, positioned at the given object's coordinates. 
	@param obj: the NVDAObject to review
	@type obj: L{NVDAObject}
	@return: the TextInfo instance and the Scriptable object the TextInfo instance is referencing, or None on error. 
	@rtype: (L{TextInfo},L{ScriptableObject})
	"""
	focus=api.getFocusObject()
	while focus and not isinstance(focus,Window):
		focus=focus.parent
	if not focus: return None
	w=winUser.getAncestor(focus.windowHandle,winUser.GA_ROOT) or focus.windowHandle
	s=Window(windowHandle=w)
	if s:
		s.redraw()
		try:
			pos=DisplayModelTextInfo(s,obj)
		except LookupError:
			pos=DisplayModelTextInfo(s,textInfos.POSITION_FIRST)
		return pos,pos.obj
Пример #10
0
def getScreenPosition(obj):
    """
	Fetches a TextInfo instance suitable for reviewing the screen, positioned at the given object's coordinates. 
	@param obj: the NVDAObject to review
	@type obj: L{NVDAObject}
	@return: the TextInfo instance and the Scriptable object the TextInfo instance is referencing, or None on error. 
	@rtype: (L{TextInfo},L{ScriptableObject})
	"""
    focus = api.getFocusObject()
    while focus and not isinstance(focus, Window):
        focus = focus.parent
    if not focus: return None
    w = winUser.getAncestor(focus.windowHandle,
                            winUser.GA_ROOT) or focus.windowHandle
    s = Window(windowHandle=w)
    if s:
        s.redraw()
        try:
            pos = DisplayModelTextInfo(s, obj)
        except LookupError:
            pos = DisplayModelTextInfo(s, textInfos.POSITION_FIRST)
        return pos, pos.obj
Пример #11
0
	def _get_name(self):
		superName = super(TorrentContentsListItem, self).name
		if superName:
			return superName

		# We need to use the display model to retrieve the Name column.
		try:
			# We don't want to just use displayText because it also contains the size, which is exposed correctly in the value property.
			# Therefore, use the left and right of the Name column as obtained from the column header.
			nameHdrLoc = Window._get_firstChild(self).firstChild.firstChild.location
			left = nameHdrLoc[0]
			right = left + nameHdrLoc[2]
			# Use the top and bottom of the list item.
			selfLoc = self.location
			top = selfLoc[1]
			bottom = top + selfLoc[3]
			return displayModel.getWindowTextInRect(self.appModule.helperLocalBindingHandle, self.windowHandle,
				left, top, right, bottom,
				displayModel.DisplayModelTextInfo.minHorizontalWhitespace, displayModel.DisplayModelTextInfo.minVerticalWhitespace)[0]
		except:
			log.debugWarning("Error retrieving name using display model", exc_info=True)
			return superName