コード例 #1
0
def setNavigatorObject(obj, isFocus=False):
    """Sets an object to be the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. It also sets the current review position to None so that next time the review position is asked for, it is created from the navigator object.  
@param obj: the object that will be set as the current navigator object
@type obj: NVDAObjects.NVDAObject  
@param isFocus: true if the navigator object was set due to a focus change.
@type isFocus: bool
"""
    if not isinstance(obj, NVDAObjects.NVDAObject):
        return False
    globalVars.navigatorObject = obj
    oldPos = globalVars.reviewPosition
    oldPosObj = globalVars.reviewPositionObj
    globalVars.reviewPosition = None
    globalVars.reviewPositionObj = None
    reviewMode = review.getCurrentMode()
    # #3320: If in document review yet there is no document to review the mode should be forced to object.
    if reviewMode == 'document' and (
            not isinstance(obj.treeInterceptor,
                           treeInterceptorHandler.DocumentTreeInterceptor)
            or not obj.treeInterceptor.isReady
            or obj.treeInterceptor.passThrough):
        review.setCurrentMode('object', False)
    elif isinstance(
            obj.treeInterceptor, treeInterceptorHandler.DocumentTreeInterceptor
    ) and obj.treeInterceptor.isReady and not obj.treeInterceptor.passThrough:
        if reviewMode == 'object':
            review.setCurrentMode('document', False)
        if isFocus:
            globalVars.reviewPosition = obj.treeInterceptor.makeTextInfo(
                textInfos.POSITION_CARET)
            globalVars.reviewPositionObj = globalVars.reviewPosition
    eventHandler.executeEvent("becomeNavigatorObject", obj, isFocus=isFocus)
コード例 #2
0
def setNavigatorObject(obj,isFocus=False):
	"""Sets an object to be the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. It also sets the current review position to None so that next time the review position is asked for, it is created from the navigator object.  
@param obj: the object that will be set as the current navigator object
@type obj: NVDAObjects.NVDAObject  
@param isFocus: true if the navigator object was set due to a focus change.
@type isFocus: bool
"""
	if not isinstance(obj,NVDAObjects.NVDAObject):
		return False
	globalVars.navigatorObject=obj
	oldPos=globalVars.reviewPosition
	oldPosObj=globalVars.reviewPositionObj
	globalVars.reviewPosition=None
	globalVars.reviewPositionObj=None
	reviewMode=review.getCurrentMode()
	# #3320: If in document review yet there is no document to review the mode should be forced to object. 
	if reviewMode=='document' and (not isinstance(obj.treeInterceptor,treeInterceptorHandler.DocumentTreeInterceptor)  or not obj.treeInterceptor.isReady or obj.treeInterceptor.passThrough):
		review.setCurrentMode('object',False)
	elif isinstance(obj.treeInterceptor,treeInterceptorHandler.DocumentTreeInterceptor) and obj.treeInterceptor.isReady and not obj.treeInterceptor.passThrough:
		if reviewMode=='object':
			review.setCurrentMode('document',False)
		if isFocus:
			globalVars.reviewPosition=obj.treeInterceptor.makeTextInfo(textInfos.POSITION_CARET)
			globalVars.reviewPositionObj=globalVars.reviewPosition
	eventHandler.executeEvent("becomeNavigatorObject",obj)
コード例 #3
0
ファイル: api.py プロジェクト: lpintes/NVDA
def setNavigatorObject(obj,isFocus=False):
	"""Sets an object to be the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. It also sets the current review position to None so that next time the review position is asked for, it is created from the navigator object.  
@param obj: the object that will be set as the current navigator object
@type obj: NVDAObjects.NVDAObject  
@param isFocus: true if the navigator object was set due to a focus change.
@type isFocus: bool
"""
	if not isinstance(obj,NVDAObjects.NVDAObject):
		return False
	globalVars.navigatorObject=obj
	oldPos=globalVars.reviewPosition
	oldPosObj=globalVars.reviewPositionObj
	globalVars.reviewPosition=None
	globalVars.reviewPositionObj=None
	reviewMode=review.getCurrentMode()
	# #3320: If in document review yet there is no document to review the mode should be forced to object. 
	if reviewMode=='document' and (not obj.treeInterceptor or not obj.treeInterceptor.isReady or obj.treeInterceptor.passThrough):
		review.setCurrentMode('object',False)
	elif isFocus and reviewMode=='object' and obj.treeInterceptor and obj.treeInterceptor.isReady and not obj.treeInterceptor.passThrough:
		review.setCurrentMode('document',False)
	#Specifically handle when the navigator object is set due to a focus change in a virtualBuffer
	#The focus change may have been becaus the caret was moved, which caused the focus change.
	#If so, don't clober the review position as it will have been already set to a more accurate position.
	if isFocus and oldPos and oldPos.obj is obj.treeInterceptor and isinstance(obj.treeInterceptor,virtualBuffers.VirtualBuffer):
		try:
			objPos=obj.treeInterceptor.makeTextInfo(obj)
		except LookupError:
			objPos=None
		if objPos and objPos.isOverlapping(oldPos):
			globalVars.reviewPosition=oldPos
			globalVars.reviewPositionObj=oldPosObj
	eventHandler.executeEvent("becomeNavigatorObject",obj)
コード例 #4
0
ファイル: __init__.py プロジェクト: ABuffEr/toolbarsExplorer
 def script_startExploration(self, gesture):
     self.configVars()
     with measureTime("Toolbars found in"):
         self.findToolbars()
     self.initialFilterBars()
     if self.bars:
         self.populateBar(self.bars[self.barIndex])
     if not self.bars:
         # Translators: message in applications without toolbars
         ui.message(_("No toolbar found"))
         return
     # a backup of various info, useful later
     self.startSnap["focus"] = api.getFocusObject()
     self.startSnap["nav"] = api.getNavigatorObject()
     self.startSnap["foreground"] = api.getForegroundObject()
     self.startSnap["pid"] = api.getFocusObject().processID
     self.startSnap["reviewMode"] = review.getCurrentMode()
     # declare exploration started
     self.exploring = True
     # set object navigation active
     review.setCurrentMode("object", updateReviewPosition=False)
     # see script_explore for gesture explanation
     for direction in ("up", "right", "down", "left"):
         self.bindGesture("kb:%sArrow" % direction, "explore")
     self.bindGesture("kb:escape", "finish")
     self.bindGesture("kb:enter", "objActivate")
     self.bindGesture("kb:space", "objLeftClick")
     self.bindGesture("kb:applications", "objRightClick")
     self.bindGesture("kb:shift+f10", "objRightClick")
     bar = self.bars[self.barIndex]
     api.setNavigatorObject(bar)
     speech.speakObject(bar, reason=REASON_FOCUS)
コード例 #5
0
	def _set_passThrough(self, state):
		if self._passThrough == state:
			return
		self._passThrough = state
		if state:
			if config.conf['reviewCursor']['followFocus']:
				focusObj=api.getFocusObject()
				if self is focusObj.treeInterceptor:
					if review.getCurrentMode()=='document':
						# if focus is in this treeInterceptor and review mode is document, turning on passThrough should force object review
						review.setCurrentMode('object')
					api.setNavigatorObject(focusObj)
			braille.handler.handleGainFocus(api.getFocusObject())
		else:
			obj=api.getNavigatorObject()
			if config.conf['reviewCursor']['followCaret'] and self is obj.treeInterceptor: 
				if review.getCurrentMode()=='object':
					# if navigator object is in this treeInterceptor and the review mode is object, then turning off passThrough should force document review 
					review.setCurrentMode('document',True)
			braille.handler.handleGainFocus(self)
コード例 #6
0
ファイル: treeInterceptorHandler.py プロジェクト: ma10/nvdajp
	def _set_passThrough(self, state):
		if self._passThrough == state:
			return
		self._passThrough = state
		if state:
			if config.conf['reviewCursor']['followFocus']:
				focusObj=api.getFocusObject()
				if self is focusObj.treeInterceptor:
					if review.getCurrentMode()=='document':
						# if focus is in this treeInterceptor and review mode is document, turning on passThrough should force object review
						review.setCurrentMode('object')
					api.setNavigatorObject(focusObj)
			braille.handler.handleGainFocus(api.getFocusObject())
		else:
			obj=api.getNavigatorObject()
			if config.conf['reviewCursor']['followCaret'] and self is obj.treeInterceptor: 
				if review.getCurrentMode()=='object':
					# if navigator object is in this treeInterceptor and the review mode is object, then turning off passThrough should force document review 
					review.setCurrentMode('document',True)
			braille.handler.handleGainFocus(self)
コード例 #7
0
ファイル: api.py プロジェクト: lpintes/NVDA
def getNavigatorObject():
	"""Gets the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. If the navigator object is not set, it fetches it from the review position. 
@returns: the current navigator object
@rtype: L{NVDAObjects.NVDAObject}
"""
	if globalVars.navigatorObject:
		return globalVars.navigatorObject
	else:
		if review.getCurrentMode()=='object':
			obj=globalVars.reviewPosition.obj
		else:
			try:
				obj=globalVars.reviewPosition.NVDAObjectAtStart
			except (NotImplementedError,LookupError):
				obj=globalVars.reviewPosition.obj
		globalVars.navigatorObject=getattr(obj,'rootNVDAObject',None) or obj
		return globalVars.navigatorObject
コード例 #8
0
ファイル: api.py プロジェクト: rohan485/nvda
def getNavigatorObject():
	"""Gets the current navigator object. Navigator objects can be used to navigate around the operating system (with the number pad) with out moving the focus. If the navigator object is not set, it fetches it from the review position. 
@returns: the current navigator object
@rtype: L{NVDAObjects.NVDAObject}
"""
	if globalVars.navigatorObject:
		return globalVars.navigatorObject
	else:
		if review.getCurrentMode()=='object':
			obj=globalVars.reviewPosition.obj
		else:
			try:
				obj=globalVars.reviewPosition.NVDAObjectAtStart
			except (NotImplementedError,LookupError):
				obj=globalVars.reviewPosition.obj
		globalVars.navigatorObject=getattr(obj,'rootNVDAObject',None) or obj
		return globalVars.navigatorObject
コード例 #9
0
ファイル: api.py プロジェクト: zstanecic/nvda
def getNavigatorObject() -> NVDAObjects.NVDAObject:
    """Gets the current navigator object.
	Navigator objects can be used to navigate around the operating system (with the numpad),
	without moving the focus.
	If the navigator object is not set, it fetches and sets it from the review position.
	@returns: the current navigator object
	"""
    if globalVars.navigatorObject:
        return globalVars.navigatorObject
    elif review.getCurrentMode() == 'object':
        obj = globalVars.reviewPosition.obj
    else:
        try:
            obj = globalVars.reviewPosition.NVDAObjectAtStart
        except (NotImplementedError, LookupError):
            obj = globalVars.reviewPosition.obj
    nextObj = getattr(obj, 'rootNVDAObject', None) or obj
    if _isSecureObjectWhileLockScreenActivated(nextObj):
        return globalVars.navigatorObject
    globalVars.navigatorObject = nextObj
    return globalVars.navigatorObject