예제 #1
0
	def mouseCapture(self, msg, x, y, injected):
		if msg in allowedMouseActions and not self.locked and not config.conf['inputlock']['blockClicks']:
			return mouseCallbackFunc(msg, x, y, injected)
		else:
			if self.mouseLocked and not self.locked:
				mouseHandler.executeMouseMoveEvent(self.cursorPos[0], self.cursorPos[1])
			winUser.setCursorPos(self.cursorPos[0], self.cursorPos[1])
예제 #2
0
def setMousePosition(x, y, announceMousePosition=False):
    # Setter version of report mouse position function.
    # The new position announcement is to be used if needed.
    winUser.setCursorPos(x, y)
    mouseHandler.executeMouseMoveEvent(x, y)
    if announceMousePosition:
        # Announce this half a second later to give the appearance of mouse movement.
        wx.CallLater(500, reportMousePosition, x=x, y=y)
예제 #3
0
def mouseMove (x, y, relative=False):
	if relative:
		obj=api.getForegroundObject()
		left, top, width, height = obj.location
		x += left
		y += top
	winUser.setCursorPos(x, y)
	mouseHandler.executeMouseMoveEvent(x, y)
예제 #4
0
 def event_show(self):
     if not (config.conf["keyboard"]["nvdajpEnableKeyEvents"] and
             config.conf["inputComposition"]["announceSelectedCandidate"]):
         return
     tones.beep(880, 20)
     api.setNavigatorObject(self)
     speech.cancelSpeech()
     time.sleep(0.2)
     speech.speakMessage(self.name)
     (left, top, width, height) = self.location
     x = left + (width / 2)
     y = top + (height / 2)
     winUser.setCursorPos(x, y)
     mouseHandler.executeMouseMoveEvent(x, y)
 def mouseMove(self):
     if not self.checkNodeManager():
         return False
     self.moveto()
     info = self.getTextInfo()
     obj = info.NVDAObjectAtStart
     try:
         (left, top, width, height) = obj.location
     except:
         ui.message(u"Impossible de déplacer la souris à cet emplacement")
         return False
     x = left + (width / 2)
     y = top + (height / 2)
     winUser.setCursorPos(x, y)
     mouseHandler.executeMouseMoveEvent(x, y)
예제 #6
0
 def mouseMove(self):
     if not self.nodeManager.isReady:
         return False
     self.moveto()
     info = self.nodeManager.treeInterceptor.makeTextInfo(
         textInfos.offsets.Offsets(self.offset, self.offset))
     obj = info.NVDAObjectAtStart
     try:
         (left, top, width, height) = obj.location
     except:
         ui.message(u"Impossible de déplacer la souris à cet emplacement")
         return False
     x = left + (width / 2)
     y = top + (height / 2)
     winUser.setCursorPos(x, y)
     mouseHandler.executeMouseMoveEvent(x, y)
예제 #7
0
	def script_moveMouseToNavigatorObject(self,gesture):
		obj=api.getNavigatorObject() 
		try:
			p=api.getReviewPosition().pointAtStart
		except (NotImplementedError, LookupError):
			p=None
		if p:
			x=p.x
			y=p.y
		else:
			try:
				(left,top,width,height)=obj.location
			except:
				ui.message(_("object has no location"))
				return
			x=left+(width/2)
			y=top+(height/2)
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseMoveEvent(x,y)
예제 #8
0
 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 jumpToTime(self, jumpTime, totalTime, startPlaying=False):
        printDebug("MainWindow: jumpToTime")
        mainWindow = self
        speech.cancelSpeech()
        oldSpeechMode = getSpeechMode()
        setSpeechMode_off()
        api.processPendingEvents()
        speech.cancelSpeech()
        if jumpTime is None or jumpTime == 0:
            setSpeechMode(oldSpeechMode)
            # Translators: message to the user to report no time change.
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       speech.speakMessage, _("No change"))
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       mainWindow.sayElapsedTime, True)
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       mainWindow.reportMediaStates)
            return
        isPlaying = mainWindow.isPlaying()
        curTimeInSec = getTimeInSec(mainWindow.getCurrentTime())
        if type(jumpTime) is int:
            jumpTimeInSec = jumpTime
        else:
            jumpTimeInSec = getTimeInSec(jumpTime)

        if abs(curTimeInSec - jumpTimeInSec) <= 2:
            # we are at time
            setSpeechMode(oldSpeechMode)
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       mainWindow.sayElapsedTime)
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       mainWindow.reportMediaStates)
            if not isPlaying and startPlaying:
                mainWindow.togglePlayOrPause()
                return
        if isPlaying:
            # pause playing
            mainWindow.togglePlayOrPause()
            time.sleep(0.2)
        totalTimeInSec = getTimeInSec(totalTime)
        (x, y) = self.calculatePosition(jumpTimeInSec, totalTimeInSec,
                                        isPlaying)
        leftClick(int(x), int(y))
        api.processPendingEvents()
        time.sleep(0.2)
        winUser.setCursorPos(int(x), int(y - 20))
        mouseHandler.executeMouseMoveEvent(x, y)
        speech.cancelSpeech()
        setSpeechMode(oldSpeechMode)
        # wait for new time
        api.processPendingEvents()
        i = 20
        newCurTimeInSec = getTimeInSec(mainWindow.getCurrentTime())
        while i > 0 and newCurTimeInSec == curTimeInSec:
            time.sleep(0.05)
            i = i - 1
            if i == 0:
                # time out
                # Translators: message to the user to say that jump is not possible.
                queueHandler.queueFunction(queueHandler.eventQueue,
                                           speech.speakMessage,
                                           _("Jump is not possible"))
                queueHandler.queueFunction(queueHandler.eventQueue,
                                           mainWindow.sayElapsedTime)
                queueHandler.queueFunction(queueHandler.eventQueue,
                                           mainWindow.reportMediaStates)
                printDebug("MainWindow: jump is not completed")
                return

            newCurTimeInSec = getTimeInSec(mainWindow.getCurrentTime())
        if newCurTimeInSec != jumpTimeInSec:
            self.adjustPosition(jumpTimeInSec, totalTimeInSec, x, y)
        if not startPlaying and isPlaying:
            mainWindow.togglePlayOrPause()
            queueHandler.queueFunction(queueHandler.eventQueue,
                                       mainWindow.reportMediaStates)
            return

        queueHandler.queueFunction(queueHandler.eventQueue,
                                   mainWindow.sayElapsedTime)
        if startPlaying:
            mainWindow.togglePlayOrPause()
        queueHandler.queueFunction(queueHandler.eventQueue,
                                   mainWindow.reportMediaStates)