コード例 #1
0
ファイル: pythonConsole.py プロジェクト: xingkong0113/nvda
    def updateNamespaceSnapshotVars(self):
        """Update the console namespace with a snapshot of NVDA's current state.
		This creates/updates variables for the current focus, navigator object, etc.
		Typically, used before the NVDA python console is opened, after which, calls
		to the 'api' module will refer to this new focus.
		"""
        try:
            caretPos = api.getCaretPosition()
        except RuntimeError:
            log.debug(
                "Unable to set caretPos snapshot variable for python console.")
            caretPos = None

        self._namespaceSnapshotVars = {
            "focus": api.getFocusObject(),
            # Copy the focus ancestor list, as it gets mutated once it is replaced in api.setFocusObject.
            "focusAnc": list(api.getFocusAncestors()),
            "fdl": api.getFocusDifferenceLevel(),
            "fg": api.getForegroundObject(),
            "nav": api.getNavigatorObject(),
            "caretObj": api.getCaretObject(),
            "caretPos": caretPos,
            "review": api.getReviewPosition(),
            "mouse": api.getMouseObject(),
            "brlRegions": braille.handler.buffer.regions,
        }
        self.namespace.update(self._namespaceSnapshotVars)
コード例 #2
0
	def event_gainFocus(self):
		#See if this object is the focus and the focus is on a group item.
		#if so, then morph this object to a groupingItem object
		if self is api.getFocusObject():
			groupIndex=watchdog.cancellableSendMessage(self.windowHandle,LVM_GETFOCUSEDGROUP,0,0)
			if groupIndex>=0:
				info=self.getListGroupInfo(groupIndex)
				if info is not None:
					ancestors=api.getFocusAncestors()
					if api.getFocusDifferenceLevel()==len(ancestors)-1:
						self.event_focusEntered()
					groupingObj=GroupingItem(windowHandle=self.windowHandle,parentNVDAObject=self,groupInfo=info)
					return eventHandler.queueEvent("gainFocus",groupingObj)
		return super(List,self).event_gainFocus()
コード例 #3
0
	def event_gainFocus(self):
		#See if this object is the focus and the focus is on a group item.
		#if so, then morph this object to a groupingItem object
		if self is api.getFocusObject():
			groupIndex=watchdog.cancellableSendMessage(self.windowHandle,LVM_GETFOCUSEDGROUP,0,0)
			if groupIndex>=0:
				info=self.getListGroupInfo(groupIndex)
				if info is not None:
					ancestors=api.getFocusAncestors()
					if api.getFocusDifferenceLevel()==len(ancestors)-1:
						self.event_focusEntered()
					groupingObj=GroupingItem(windowHandle=self.windowHandle,parentNVDAObject=self,groupInfo=info)
					return eventHandler.queueEvent("gainFocus",groupingObj)
		return super(List,self).event_gainFocus()
コード例 #4
0
ファイル: pythonConsole.py プロジェクト: ehollig/nvda
	def updateNamespaceSnapshotVars(self):
		"""Update the console namespace with a snapshot of NVDA's current state.
		This creates/updates variables for the current focus, navigator object, etc.
		"""
		self._namespaceSnapshotVars = {
			"focus": api.getFocusObject(),
			# Copy the focus ancestor list, as it gets mutated once it is replaced in api.setFocusObject.
			"focusAnc": list(api.getFocusAncestors()),
			"fdl": api.getFocusDifferenceLevel(),
			"fg": api.getForegroundObject(),
			"nav": api.getNavigatorObject(),
			"review":api.getReviewPosition(),
			"mouse": api.getMouseObject(),
			"brlRegions": braille.handler.buffer.regions,
		}
		self.namespace.update(self._namespaceSnapshotVars)
コード例 #5
0
    def updateNamespaceSnapshotVars(self):
        """Update the console namespace with a snapshot of NVDA's current state.
		This creates/updates variables for the current focus, navigator object, etc.
		"""
        self._namespaceSnapshotVars = {
            "focus": api.getFocusObject(),
            # Copy the focus ancestor list, as it gets mutated once it is replaced in api.setFocusObject.
            "focusAnc": list(api.getFocusAncestors()),
            "fdl": api.getFocusDifferenceLevel(),
            "fg": api.getForegroundObject(),
            "nav": api.getNavigatorObject(),
            "review": api.getReviewPosition(),
            "mouse": api.getMouseObject(),
            "brlRegions": braille.handler.buffer.regions,
        }
        self.namespace.update(self._namespaceSnapshotVars)