def executeMouseMoveEvent(x,y): global currentMouseWindow desktopObject=api.getDesktopObject() displays = [ wx.Display(i).GetGeometry() for i in xrange(wx.Display.GetCount()) ] x, y = getMouseRestrictedToScreens(x, y, displays) screenWidth, screenHeight, minPos = getTotalWidthAndHeightAndMinimumPosition(displays) if config.conf["mouse"]["audioCoordinatesOnMouseMove"]: playAudioCoordinates(x, y, screenWidth, screenHeight, minPos, config.conf['mouse']['audioCoordinates_detectBrightness'], config.conf['mouse']['audioCoordinates_blurFactor']) oldMouseObject=api.getMouseObject() mouseObject=desktopObject.objectFromPoint(x, y) while mouseObject and mouseObject.beTransparentToMouse: mouseObject=mouseObject.parent if not mouseObject: return if oldMouseObject==mouseObject: mouseObject=oldMouseObject else: api.setMouseObject(mouseObject) try: eventHandler.executeEvent("mouseMove",mouseObject,x=x,y=y) oldMouseObject=mouseObject except: log.error("api.notifyMouseMoved", exc_info=True)
def script_toolBar(self, gesture): obj = self.getToolBar() if obj is not None: if obj != api.getMouseObject(): api.moveMouseToNVDAObject(obj) api.setMouseObject(obj) if controlTypes.State.FOCUSED not in obj.states: obj.setFocus() eventHandler.queueEvent("gainFocus", obj)
def mouseClick(self, button="left"): if controlTypes.State.INVISIBLE in api.getMouseObject().states: return (False) if button == "left": winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0, None, None) winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP, 0, 0, None, None) return (True) if button == "right": winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN, 0, 0, None, None) winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP, 0, 0, None, None) return (True)
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)
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)
def move_mouse(self, d): w, h = win32api.GetMonitorInfo(1)['Monitor'][2:] x, y = win32api.GetCursorPos() oldX = x oldY = y if d == 1: x = x + self.pixelMoving pos = str(x) elif d == 2: x = x - self.pixelMoving pos = str(x) elif d == 3: y = y + self.pixelMoving pos = str(y) elif d == 4: y = y - self.pixelMoving pos = str(y) o = api.getMouseObject() if x in range(0, w) and y in range(0, h): win32api.SetCursorPos((x, y)) mouseHandler.executeMouseMoveEvent(x, y) else: winsound.MessageBeep(0) return if self.restriction == 1 and self.getAppRestriction.appModule.appName != self.getMouse( ).appModule.appName: winsound.MessageBeep(0) win32api.SetCursorPos((oldX, oldY)) mouseHandler.executeMouseMoveEvent(oldX, oldY) if self.getAppRestriction.appModule.appName != self.getMouse( ).appModule.appName: x, y, w, h = self.getAppRestriction.location win32api.SetCursorPos((x, y)) mouseHandler.executeMouseMoveEvent(x, y) return if self.sayPixel == 1: ui.message(pos) else: pass
def executeMouseMoveEvent(x,y): global currentMouseWindow desktopObject=api.getDesktopObject() screenLeft,screenTop,screenWidth,screenHeight=desktopObject.location x=min(max(screenLeft,x),(screenLeft+screenWidth)-1) y=min(max(screenTop,y),(screenTop+screenHeight)-1) if config.conf["mouse"]["audioCoordinatesOnMouseMove"]: playAudioCoordinates(x,y,screenWidth,screenHeight,config.conf['mouse']['audioCoordinates_detectBrightness'],config.conf['mouse']['audioCoordinates_blurFactor']) oldMouseObject=api.getMouseObject() mouseObject=desktopObject.objectFromPoint(x,y) while mouseObject and mouseObject.beTransparentToMouse: mouseObject=mouseObject.parent if not mouseObject: return if oldMouseObject==mouseObject: mouseObject=oldMouseObject else: api.setMouseObject(mouseObject) try: eventHandler.executeEvent("mouseMove",mouseObject,x=x,y=y) oldMouseObject=mouseObject except: log.error("api.notifyMouseMoved", exc_info=True)
def script_moveNavigatorObjectToMouse(self,gesture): ui.message(_("Move navigator object to mouse")) obj=api.getMouseObject() api.setNavigatorObject(obj) speech.speakObject(obj)