예제 #1
0
파일: gecko_ia2.py 프로젝트: davidacm/nvda
 def _activateNVDAObject(self, obj):
     while obj and obj != self.rootNVDAObject:
         try:
             obj.doAction()
             break
         except:
             log.debugWarning("doAction failed")
         if controlTypes.STATE_OFFSCREEN in obj.states or controlTypes.STATE_INVISIBLE in obj.states:
             obj = obj.parent
             continue
         try:
             l, t, w, h = obj.location
         except TypeError:
             log.debugWarning("No location for object")
             obj = obj.parent
             continue
         if not w or not h:
             obj = obj.parent
             continue
         log.debugWarning("Clicking with mouse")
         x = l + w / 2
         y = t + h / 2
         oldX, oldY = winUser.getCursorPos()
         winUser.setCursorPos(x, y)
         mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
         mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
         winUser.setCursorPos(oldX, oldY)
         break
예제 #2
0
파일: gecko_ia2.py 프로젝트: MarcoZehe/nvda
	def _activateNVDAObject(self, obj):
		while obj and obj != self.rootNVDAObject:
			try:
				obj.doAction()
				break
			except:
				log.debugWarning("doAction failed")
			if controlTypes.STATE_OFFSCREEN in obj.states or controlTypes.STATE_INVISIBLE in obj.states:
				obj = obj.parent
				continue
			try:
				l, t, w, h = obj.location
			except TypeError:
				log.debugWarning("No location for object")
				obj = obj.parent
				continue
			if not w or not h:
				obj = obj.parent
				continue
			log.debugWarning("Clicking with mouse")
			x = l + w / 2
			y = t + h / 2
			oldX, oldY = winUser.getCursorPos()
			winUser.setCursorPos(x, y)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
			winUser.setCursorPos(oldX, oldY)
			break
예제 #3
0
파일: b2.py 프로젝트: lukaszgo1/Becky
 def script_deleteItem(self, gesture):
     if self.IAccessibleChildID == 1:
         return
     (left, top, width, height) = self.location
     oldMouseCoords = winUser.getCursorPos()
     x = left + (width // 2)
     y = top + (height // 2)
     winUser.setCursorPos(x, y)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTDOWN, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTUP, 0, 0)
     winUser.setCursorPos(*oldMouseCoords)
예제 #4
0
	def _setCaretOffset(self,offset):
		rects=self._storyFieldsAndRects[1]
		if offset>=len(rects):
			raise RuntimeError("offset %d out of range")
		rect = rects[offset]
		x = rect.left
		y= rect.center.y
		x,y=windowUtils.logicalToPhysicalPoint(self.obj.windowHandle,x,y)
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
예제 #5
0
	def _setCaretOffset(self,offset):
		rects=self._storyFieldsAndRects[1]
		if offset>=len(rects):
			raise RuntimeError("offset %d out of range")
		left,top,right,bottom=rects[offset]
		x=left #+(right-left)/2
		y=top+(bottom-top)/2
		x,y=windowUtils.logicalToPhysicalPoint(self.obj.windowHandle,x,y)
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
예제 #6
0
	def _setCaretOffset(self,offset):
		rects=self._storyFieldsAndRects[1]
		if offset>=len(rects):
			raise RuntimeError("offset %d out of range")
		left,top,right,bottom=rects[offset]
		x=left #+(right-left)/2
		y=top+(bottom-top)/2
		x,y=windowUtils.logicalToPhysicalPoint(self.obj.windowHandle,x,y)
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
예제 #7
0
 def script_enter(self, gesture):
     api.moveMouseToNVDAObject(self)
     api.setMouseObject(self)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
예제 #8
0
파일: mscandui.py 프로젝트: BabbageCom/nvda
	def doAction(self,index=None):
		if not index:
			l=self.location
			if l:
				x=l[0]
				y=l[1]
				oldX,oldY=winUser.getCursorPos()
				winUser.setCursorPos(x,y)
				mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
				time.sleep(0.2)
				mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
				winUser.setCursorPos(oldX,oldY)
				return
		raise NotImplementedError
예제 #9
0
파일: kindle.py 프로젝트: BabbageCom/nvda
	def script_showSelectionOptions(self, gesture):
		fakeSel = self.selection
		if fakeSel.isCollapsed:
			# Double click to access the toolbar; e.g. for annotations.
			try:
				p = fakeSel.pointAtStart
			except NotImplementedError:
				log.debugWarning("Couldn't get point to click")
				return
			log.debug("Double clicking")
			winUser.setCursorPos(p.x, p.y)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
			return

		# The user makes a selection using browse mode virtual selection.
		# Update the selection in Kindle.
		# This will cause the options to appear.
		fakeSel.innerTextInfo.updateSelection()
		# The selection might have been adjusted to meet word boundaries,
		# so retrieve and report the selection from Kindle.
		# we can't just use self.makeTextInfo, as that will use our fake selection.
		realSel = self.rootNVDAObject.makeTextInfo(textInfos.POSITION_SELECTION)
		# Translators: Announces selected text. %s is replaced with the text.
		speech.speakSelectionMessage(_("selected %s"), realSel.text)
		# Remove our virtual selection and move the caret to the active end.
		fakeSel.innerTextInfo = realSel
		fakeSel.collapse(end=not self._lastSelectionMovedStart)
		self.selection = fakeSel
예제 #10
0
	def script_enter(self, gesture):
		api.moveMouseToNVDAObject(self)
		api.setMouseObject(self)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
예제 #11
0
    def script_showSelectionOptions(self, gesture):
        fakeSel = self.selection
        if fakeSel.isCollapsed:
            # Double click to access the toolbar; e.g. for annotations.
            try:
                p = fakeSel.pointAtStart
            except NotImplementedError:
                log.debugWarning("Couldn't get point to click")
                return
            log.debug("Double clicking")
            winUser.setCursorPos(p.x, p.y)
            mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
            mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
            mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
            mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
            return

        # The user makes a selection using browse mode virtual selection.
        # Update the selection in Kindle.
        # This will cause the options to appear.
        fakeSel.innerTextInfo.updateSelection()
        # The selection might have been adjusted to meet word boundaries,
        # so retrieve and report the selection from Kindle.
        # we can't just use self.makeTextInfo, as that will use our fake selection.
        realSel = self.rootNVDAObject.makeTextInfo(
            textInfos.POSITION_SELECTION)
        speech.speakTextSelected(realSel.text)
        # Remove our virtual selection and move the caret to the active end.
        fakeSel.innerTextInfo = realSel
        fakeSel.collapse(end=not self._lastSelectionMovedStart)
        self.selection = fakeSel
예제 #12
0
    def activate(self):
        """Activate this position.
		For example, this might activate the object at this position or click the point at this position.
		@raise NotImplementedError: If not supported.
		"""
        if not self.obj.isInForeground:
            raise NotImplementedError
        import mouseHandler
        import winUser
        p = self.pointAtStart
        oldX, oldY = winUser.getCursorPos()
        winUser.setCursorPos(p.x, p.y)
        mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
        mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
        winUser.setCursorPos(oldX, oldY)
예제 #13
0
파일: __init__.py 프로젝트: ehollig/nvda
	def activate(self):
		"""Activate this position.
		For example, this might activate the object at this position or click the point at this position.
		@raise NotImplementedError: If not supported.
		"""
		if not self.obj.isInForeground:
			raise NotImplementedError
		import mouseHandler
		import winUser
		p=self.pointAtStart
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(p.x,p.y)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
예제 #14
0
 def doAction(self, index=None):
     if not index:
         l = self.location
         if l:
             x = l[0]
             y = l[1]
             oldX, oldY = winUser.getCursorPos()
             winUser.setCursorPos(x, y)
             mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0,
                                            0)
             time.sleep(0.2)
             mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0,
                                            0)
             winUser.setCursorPos(oldX, oldY)
             return
     raise NotImplementedError
예제 #15
0
	def _activateNVDAObject(self, obj):
		try:
			obj.doAction()
			return
		except:
			pass

		log.debugWarning("could not programmatically activate field, trying mouse")
		l=obj.location
		if not l:
			log.debugWarning("no location for field")
			return
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(*l.center)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
 def _setCaretOffset(self, offset):
     rects = self._storyFieldsAndRects[1]
     if offset >= len(rects):
         raise RuntimeError("offset %d out of range")
     rect = rects[offset]
     # Place the cursor at the left coordinate of the character, vertically centered.
     point = Point(rect.left, rect.center.y)
     try:
         point = point.toPhysical(self.obj.windowHandle)
     except RuntimeError:
         raise RuntimeError(
             "Conversion to physical coordinates failed when setting caret offset"
         )
     oldX, oldY = winUser.getCursorPos()
     winUser.setCursorPos(*point)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
     winUser.setCursorPos(oldX, oldY)
예제 #17
0
 def script_clickPinConsoleButton(self, gesture):
     self.get_pin_console_button()
     if self.pinConsoleButton != None:
         try:
             oldX, oldY = winUser.getCursorPos()
             winUser.setCursorPos(self.pinConsoleButton.location.left,
                                  self.pinConsoleButton.location.top)
             #perform Mouse Left-Click
             mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0,
                                            0)
             mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0,
                                            0)
             winUser.setCursorPos(oldX, oldY)
             if controlTypes.State.CHECKED in self.pinConsoleButton.states:
                 ui.message(_("Pin Console") + " " + _("not checked"))
             else:
                 ui.message(_("Pin Console") + " " + _("checked"))
         except:
             pass
예제 #18
0
파일: b2.py 프로젝트: lukaszgo1/Becky
 def _activateURLAtPos(pos):
     # If user configures Becky! to open links with a single click they're underlined.
     shouldClickTwice = DanaEdit._TIMatchesCondition(
         pos, "underline", False)
     oldMouseCoords = winUser.getCursorPos()
     winUser.setCursorPos(pos.pointAtStart.x, pos.pointAtStart.y)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
     if shouldClickTwice:
         mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
         mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
     winUser.setCursorPos(*oldMouseCoords)
예제 #19
0
	def _activateNVDAObject(self, obj):
		try:
			obj.doAction()
			return
		except:
			pass

		log.debugWarning("could not programmatically activate field, trying mouse")
		l=obj.location
		if not l:
			log.debugWarning("no location for field")
			return
		x=(l[0]+l[2]/2)
		y=l[1]+(l[3]/2) 
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
예제 #20
0
파일: gecko_ia2.py 프로젝트: sdokowe/nvda
	def _activateNVDAObject(self, obj):
		while obj and obj != self.rootNVDAObject:
			try:
				obj.doAction()
				break
			except:
				log.debugWarning("doAction failed")
			if obj.hasIrrelevantLocation:
				# This check covers invisible, off screen and a None location
				log.debugWarning("No relevant location for object")
				obj = obj.parent
				continue
			location = obj.location
			if not location.width or not location.height:
				obj = obj.parent
				continue
			log.debugWarning("Clicking with mouse")
			oldX, oldY = winUser.getCursorPos()
			winUser.setCursorPos(*location.center)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
			winUser.setCursorPos(oldX, oldY)
			break
예제 #21
0
	def script_contextMenu(self, gesture):
		api.moveMouseToNVDAObject(self)
		api.setMouseObject(self)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTUP,0,0)
예제 #22
0
 def script_contextMenu(self, gesture):
     api.moveMouseToNVDAObject(self)
     api.setMouseObject(self)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTDOWN, 0, 0)
     mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_RIGHTUP, 0, 0)