Пример #1
0
						action=pluralActionLabel.format(action=action)
						foundPlural=True
						continue
				if subID.endswith('finger'):
					numFingers=int(subID[:0-len('finger')])
					if numFingers>1:
						action=cls.multiFingerActionLabel.format(numFingers=numFingers,action=action)
				break
			actions.append(action)
		# Translators: a touch screen gesture
		source=_("Touch screen")
		if mode:
			source=u"{source}, {mode}".format(source=source,mode=touchModeLabels[mode])
		return source,u" + ".join(actions)

inputCore.registerGestureSource("ts", TouchInputGesture)

class TouchHandler(threading.Thread):

	def __init__(self):
		super(TouchHandler,self).__init__()
		self._curTouchMode='object'
		self.initializedEvent=threading.Event()
		self.threadExc=None
		self.start()
		self.initializedEvent.wait()
		if self.threadExc:
			raise self.threadExc

	def terminate(self):
		windll.user32.PostThreadMessageW(self.ident,WM_QUIT,0,0)
Пример #2
0
			try:
				# vkCodes.byName values are (vk, ext)
				vk = vkCodes.byName[key][0]
			except KeyError:
				# This could be a fake vk.
				vk = key
			label = localizedKeyLabels.get(key, key)
			if vk in cls.NORMAL_MODIFIER_KEYS:
				names.append(label)
			else:
				# The main key must be last, so handle that outside the loop.
				main = label
		names.append(main)
		return dispSource, "+".join(names)

inputCore.registerGestureSource("kb", KeyboardInputGesture)

def injectRawKeyboardInput(isPress, code, isExtended):
	"""Inject raw input from a system keyboard that is not handled natively by Windows.
	For example, this might be used for input from a QWERTY keyboard on a braille display.
	NVDA will treat the key as if it had been pressed on a normal system keyboard.
	If it is not handled by NVDA, it will be sent to the operating system.
	@param isPress: Whether the key is being pressed.
	@type isPress: bool
	@param code: The scan code (PC set 1) of the key.
	@type code: int
	@param isExtended: Whether this is an extended key.
	@type isExtended: bool
	"""
	mapScan = code
	if isExtended:
Пример #3
0
	@classmethod
	def getDisplayTextForIdentifier(cls, identifier):
		# Translators: Used when describing keys on a braille keyboard.
		source = _("braille keyboard")
		if identifier == cls.GENERIC_ID_SPACE_DOTS:
			# Translators: Used to describe the press of space
			# along with any dots on a braille keyboard.
			return (source, _("space with any dots"))
		if identifier == cls.GENERIC_ID_DOTS:
			# Translators: Used to describe the press of any dots
			# on a braille keyboard.
			return (source, _("any dots"))
		# Example identifier: bk:space+dot1+dot2
		# Strip the bk: prefix.
		partsStr = identifier.split(":", 1)[1]
		parts = partsStr.split("+")
		dots = 0
		space = False
		for part in parts:
			if part == "space":
				space = True
			else:
				# Example part: "dot1"
				# Get the dot number and make it 0 based instead of 1 based.
				dot = int(part[3]) - 1
				# Update the dots bitmask.
				dots += 1 << dot
		return (source, cls._makeDisplayText(dots, space))

inputCore.registerGestureSource("bk", BrailleInputGesture)
Пример #4
0
                # vkCodes.byName values are (vk, ext)
                vk = vkCodes.byName[key][0]
            except KeyError:
                # This could be a fake vk.
                vk = key
            label = localizedKeyLabels.get(key, key)
            if vk in cls.NORMAL_MODIFIER_KEYS:
                names.append(label)
            else:
                # The main key must be last, so handle that outside the loop.
                main = label
        names.append(main)
        return dispSource, "+".join(names)


inputCore.registerGestureSource("kb", KeyboardInputGesture)


def injectRawKeyboardInput(isPress, code, isExtended):
    """Injet raw input from a system keyboard that is not handled natively by Windows.
	For example, this might be used for input from a QWERTY keyboard on a braille display.
	NVDA will treat the key as if it had been pressed on a normal system keyboard.
	If it is not handled by NVDA, it will be sent to the operating system.
	@param isPress: Whether the key is being pressed.
	@type isPress: bool
	@param code: The scan code (PC set 1) of the key.
	@type code: int
	@param isExtended: Whether this is an extended key.
	@type isExtended: bool
	"""
    mapScan = code
Пример #5
0
                if subID.endswith('finger'):
                    numFingers = int(subID[:0 - len('finger')])
                    if numFingers > 1:
                        action = cls.multiFingerActionLabel.format(
                            numFingers=numFingers, action=action)
                break
            actions.append(action)
        # Translators: a touch screen gesture
        source = _("Touch screen")
        if mode:
            source = u"{source}, {mode}".format(source=source,
                                                mode=touchModeLabels[mode])
        return source, u" + ".join(actions)


inputCore.registerGestureSource("ts", TouchInputGesture)


class TouchHandler(threading.Thread):
    def __init__(self):
        self.pendingEmitsTimer = gui.NonReEntrantTimer(core.requestPump)
        super().__init__(
            name=f"{self.__class__.__module__}.{self.__class__.__qualname__}")
        self._curTouchMode = 'object'
        self.initializedEvent = threading.Event()
        self.threadExc = None
        self.start()
        self.initializedEvent.wait()
        if self.threadExc:
            raise self.threadExc
Пример #6
0
    def getDisplayTextForIdentifier(cls, identifier):
        # Translators: Used when describing keys on a braille keyboard.
        source = _("braille keyboard")
        if identifier == cls.GENERIC_ID_SPACE_DOTS:
            # Translators: Used to describe the press of space
            # along with any dots on a braille keyboard.
            return (source, _("space with any dots"))
        if identifier == cls.GENERIC_ID_DOTS:
            # Translators: Used to describe the press of any dots
            # on a braille keyboard.
            return (source, _("any dots"))
        # Example identifier: bk:space+dot1+dot2
        # Strip the bk: prefix.
        partsStr = identifier.split(":", 1)[1]
        parts = partsStr.split("+")
        dots = 0
        space = False
        for part in parts:
            if part == "space":
                space = True
            else:
                # Example part: "dot1"
                # Get the dot number and make it 0 based instead of 1 based.
                dot = int(part[3]) - 1
                # Update the dots bitmask.
                dots += 1 << dot
        return (source, cls._makeDisplayText(dots, space))


inputCore.registerGestureSource("bk", BrailleInputGesture)