Exemplo n.º 1
0
	def turnPage(self, previous=False):
		try:
			# Find the slider which indicates the current position.
			posSlider = self.parent.parent.next.lastChild
		except AttributeError:
			raise RuntimeError
		# We need the raw value, not the percentage.
		oldPos = posSlider.UIAElement.getCurrentPropertyValueEx(UIAHandler.UIA_RangeValueValuePropertyId, True)
		KeyboardInputGesture.fromName("pageUp" if previous else "pageDown").send()
		if posSlider.UIAElement.getCurrentPropertyValueEx(UIAHandler.UIA_RangeValueValuePropertyId, True) == oldPos:
			# No more pages.
			raise RuntimeError
Exemplo n.º 2
0
	def event_gainFocus(self,obj,nextHandler):
		nextHandler()
		#Force focus to move to something sane when landing on an outlook express message window
		if obj.windowClassName=="ATH_Note" and obj.event_objectID==winUser.OBJID_CLIENT and obj.IAccessibleChildID==0:
			api.processPendingEvents()
			if obj==api.getFocusObject() and controlTypes.STATE_FOCUSED in obj.states:
				return KeyboardInputGesture.fromName("shift+tab").send()
Exemplo n.º 3
0
	def _expandToLine(self,textRange):
		#Try to calculate the line range by finding screen coordinates and using moveToPoint
		parent=textRange.parentElement()
		if not parent.isMultiline: #fastest solution for single line edits (<input type="text">)
			textRange.expand("textEdit")
			return
		parentRect=parent.getBoundingClientRect()
		#This can be simplified when comtypes is fixed
		lineTop=comtypes.client.dynamic._Dispatch(textRange._comobj).offsetTop
		lineLeft=parentRect.left+parent.clientLeft
		#editable documents have a different right most boundary to <textarea> elements.
		if self.obj.HTMLNode.document.body.isContentEditable:
			lineRight=parentRect.right 
		else:
			lineRight=parentRect.left+parent.clientWidth
		tempRange=textRange.duplicate()
		try:
			tempRange.moveToPoint(lineLeft,lineTop)
			textRange.setEndPoint("startToStart",tempRange)
			tempRange.moveToPoint(lineRight,lineTop)
			textRange.setEndPoint("endToStart",tempRange)
			return
		except COMError:
			pass
		#MoveToPoint fails on Some (possibly floated) textArea elements.
		#Instead use the physical selection, by moving it with key presses, to work out the line.
		#This approach is somewhat slower, and less accurate.
		with self.obj.suspendCaretEvents():
			selObj=parent.document.selection
			oldSelRange=selObj.createRange().duplicate()
			# #1566: Calling textRange.select() sometimes throws focus onto the document,
			# so create a new range from the selection and move the selection using that.
			selObj.createRange().moveToBookmark(textRange.getBookmark())
			KeyboardInputGesture.fromName("home").send()
			api.processPendingEvents(False)
			newSelStartMark=selObj.createRange().getBookmark()
			KeyboardInputGesture.fromName("end").send()
			api.processPendingEvents(False)
			newSelEndMark=selObj.createRange().getBookmark()
			tempRange.moveToBookmark(newSelStartMark)
			textRange.setEndPoint("startToStart",tempRange)
			tempRange.moveToBookmark(newSelEndMark)
			textRange.setEndPoint("endToStart",tempRange)
			oldSelRange.select()
Exemplo n.º 4
0
	def event_gainFocus(self,obj,nextHandler):
		nextHandler()
		#Force focus to move to something sane when landing on a plain text message window
		if obj.windowClassName=="ME_DocHost" and obj.windowControlID==1000 and obj.role==controlTypes.ROLE_PANE:
			firstChild=obj.firstChild
			if firstChild: 
				firstChild=obj.firstChild
				if firstChild:
					firstChild.setFocus()
				return
		if obj.windowClassName=="ATH_Note" and obj.event_objectID==winUser.OBJID_CLIENT and obj.IAccessibleChildID==0:
			api.processPendingEvents()
			if obj==api.getFocusObject() and controlTypes.STATE_FOCUSED in obj.states:
				return KeyboardInputGesture.fromName("shift+tab").send()
Exemplo n.º 5
0
 def script_selectMessages(self, item):
     Thread(target=speak, args=(None, 0.2), daemon=True).start()
     KeyboardInputGesture.fromName("applications").send()
     Thread(target=self.getMenuItems, args=(2, ), daemon=True).start()
Exemplo n.º 6
0
 def script_contextMenu(self, gesture):
     KeyboardInputGesture.fromName("applications").send()
Exemplo n.º 7
0
 def script_markAsRead(self, gesture):
     Thread(target=speak, args=(None, 0.2), daemon=True).start()
     KeyboardInputGesture.fromName("applications").send()
     Thread(target=self.getMenuItems, args=(3, ), daemon=True).start()
Exemplo n.º 8
0
 def cut(self):
     keyName = "control+x" if not isArabicKeyboardLayout() else u"control+ء"
     KeyboardInputGesture.fromName(keyName).send()
Exemplo n.º 9
0
 def tab(self):
     sleep(0.5)
     KeyboardInputGesture.fromName("tab").send()
Exemplo n.º 10
0
    def script_activarMenu(self, gesture):
        # Prevents the helper was launched when the keyboard is locked by the InputLock addon
        if inputCore.manager._captureFunc and not inputCore.manager._captureFunc(
                gesture):
            return

        if varGlobal.IS_WinON == True:
            msg = \
         _("""Ya hay una instancia de zUtilidades abierta.

No es posible tener dos instancias a la vez.""")
            varGlobal.mensaje(msg)
            return

        self.leerCategoriaDAT()
        if len(self.categorias) == 0:
            varGlobal.mensaje(_("No hay categorías"))
            return

        varGlobal.IS_WinON = True
        if self.lanzador == "zl":
            catTotalTemporal = self.catTotalzl
        elif self.lanzador == "zn":
            catTotalTemporal = self.catTotalzn
        if catTotalTemporal == len(self.categorias):
            pass
        else:
            if self.lanzador == "zl":
                self.catIndexzl = 0
                self.itemIndexzl = -1
            elif self.lanzador == "zn":
                self.catIndexzn = 0
                self.itemIndexzn = -1
            if len(self.categorias) == 0:
                varGlobal.mensaje(_("No hay categorías"))
                varGlobal.IS_WinON = False
                return

        if self.toggling:
            self.script_exit(gesture)
            self.finish()
            return
        for k in ("upArrow", "downArrow", "leftArrow", "rightArrow", "enter",
                  "shift+enter", "control+enter", "numpadEnter",
                  "shift+numpadEnter", "control+numpadEnter", "escape",
                  "backspace", "F1", "F12", "numpad2", "numpad4", "numpad5",
                  "numpad6", "numpad8", "numpadPlus", "numpadMinus",
                  "numpadDelete"):
            try:
                script = KeyboardInputGesture.fromName(k).script
            except KeyError:
                script = None
            if script and self != script.__self__:
                try:
                    script.__self__.removeGestureBinding("kb:" + k)
                except KeyError:
                    pass
                else:
                    self.oldGestureBindings["kb:" + k] = script

        if self.lanzador == "zl":
            self.bindGestures(self.__zlmenuGestures)
        elif self.lanzador == "zn":
            self.bindGestures(self.__znmenuGestures)

        for c in ascii_uppercase:
            self.bindGesture("kb:" + c, "skipToCategory")

        if self.lanzador == "zn":
            self.bindGesture("kb:F1", "viewNote")
            self.bindGesture("kb:F2", "copyPP")
            self.bindGesture("kb:F3", "pastePP")

        self.toggling = True
        varGlobal.mensaje(_("Menú activado"))

        if self.lanzador == "zl":
            firstTimeTemporal = self.firstTimezl
        if self.lanzador == "zn":
            firstTimeTemporal = self.firstTimezn
        if firstTimeTemporal:
            self.script_speechHelp(None)
            if self.lanzador == "zl":
                self.firstTimezl = False
            elif self.lanzador == "zn":
                self.firstTimezn = False
            self.leerArchivosDAT(0)
            varGlobal.mensaje(self.categorias[0])
            if self.lanzador == "zl":
                self.catTotalzl = len(self.categorias)
            elif self.lanzador == "zn":
                self.catTotalzn = len(self.categorias)
        else:
            if self.lanzador == "zl":
                try:
                    varGlobal.mensaje(self.categorias[self.catIndexzl])
                except:
                    varGlobal.mensaje(self.categorias[0])
            elif self.lanzador == "zn":
                try:
                    varGlobal.mensaje(self.categorias[self.catIndexzn])
                except:
                    varGlobal.mensaje(self.categorias[0])
Exemplo n.º 11
0
 def cut(self):
     keyName = getKeyForCut()
     KeyboardInputGesture.fromName(keyName).send()
Exemplo n.º 12
0
 def script_expandLeft(self, gesture):
     KIGesture.fromName('Shift+LeftArrow').send()
     KIGesture.fromName('Shift+F6').send()
Exemplo n.º 13
0
 def script_expandRight(self, gesture):
     KIGesture.fromName('Shift+RightArrow').send()
     KIGesture.fromName('Shift+F8').send()
Exemplo n.º 14
0
 def script_pageUpByThree(self, gesture):
     for i in range(3):
         KIGesture.fromName('upArrow').send()
Exemplo n.º 15
0
 def script_pageDownByThree(self, gesture):
     for i in range(3):
         KIGesture.fromName('downArrow').send()
Exemplo n.º 16
0
 def script_quickMarker(self, gesture):
     KIGesture.fromName('control+m').send()
     KIGesture.fromName('enter').send()
Exemplo n.º 17
0
 def script_changeAndPreview(self, gesture):
     gesture.send()
     api.getFocusObject().displayText = ''
     api.getFocusObject().name == ''
     KIGesture.fromName('Shift+F6').send()
Exemplo n.º 18
0
 def script_replaceApplications(self, gesture):
     # This is necessary because the usage of the applications key deselects all tracks.
     KIGesture.fromName('shift+f10').send()
Exemplo n.º 19
0
 def script_close(self, gesture):
     KeyboardInputGesture.fromName("escape").send()
Exemplo n.º 20
0
	def cut(self):
		KeyboardInputGesture.fromName("control+x").send()
Exemplo n.º 21
0
 def paste(self):
     sleep(0.1)
     KeyboardInputGesture.fromName("control+v").send()
     sleep(0.5)
     self.obj.setFocus()
     pt.clean()
Exemplo n.º 22
0
 def doAction(self):
     if controlTypes.STATE_FOCUSED not in self.states:
         return
     KeyboardInputGesture.fromName("space").send()
Exemplo n.º 23
0
	def doAction(self):
		if controlTypes.STATE_FOCUSED not in self.states:
			return
		KeyboardInputGesture.fromName("space").send()
Exemplo n.º 24
0
 def handleConfigProfileSwitch(self):
     activation = config.conf["sharedComputer"]["numLockActivationChoice"]
     if activation < 2 and winUser.getKeyState(
             winUser.VK_NUMLOCK) != activation:
         KeyboardInputGesture.fromName("numLock").send()
Exemplo n.º 25
0
 def script_reduceRight(self, gesture):
     KIGesture.fromName('Control+Shift+LeftArrow').send()
     KIGesture.fromName('Shift+F8').send()
Exemplo n.º 26
0
def sendGestures(gestureList):
    waitKeyUp()
    for gesture in gestureList:
        KeyboardInputGesture.fromName(gesture).send()
        time.sleep(0.1)
Exemplo n.º 27
0
def SendKey(keys):
	KeyboardInputGesture.fromName(keys).send()
Exemplo n.º 28
0
	def sendCombKeys(sendKS, send=True):
		if send:
			log.debug("Sending " + sendKS)
			if not sendKS == "":
				KeyboardInputGesture.fromName(sendKS).send()
		return