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)
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)
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)
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, isFocus=True) 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)
def callback(column): speech.cancelSpeech() comboBox = self._getSearchEditComboBoxObject() api.setNavigatorObject(comboBox) review.setCurrentMode("screen", updateReviewPosition=True) info = api.getReviewPosition().copy() info.collapse() info.expand(textInfos.UNIT_LINE) baseInfo = info.copy() info.collapse(True) api.setReviewPosition(info) curObject = api.getNavigatorObject() if curObject.role == ROLE_LISTITEM: info = baseInfo.copy() info.collapse() api.setReviewPosition(info) curObject = api.getNavigatorObject() columnHeaders = curObject.parent.children columnObj = columnHeaders[column - 1] if columnObj is None: log.error("Cannot found stations list column object:%s" % column) return name = columnObj.name[1:] if columnObj.name[ 0] == "*" else columnObj.name ui.message(name) time.sleep(0.5) location = columnObj.location (l, t, w, h) = location i = int(l + w - 10) j = int(t + h / 2) import winUser winUser.setCursorPos(i, j) winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN, 0, 0, None, None) winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP, 0, 0, None, None)
def setNavigatorObject(obj: NVDAObjects.NVDAObject, isFocus: bool = False) -> Optional[bool]: """Sets an object to be the current navigator object. Navigator objects can be used to navigate around the operating system (with the numpad), without 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 @param isFocus: true if the navigator object was set due to a focus change. """ if not isinstance(obj, NVDAObjects.NVDAObject): return False if _isSecureObjectWhileLockScreenActivated(obj): return False globalVars.navigatorObject = obj 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)