Exemple #1
0
    def getDisplayTextForIdentifier(cls, identifier):
        layout, keys = cls.RE_IDENTIFIER.match(identifier).groups()
        dispSource = None
        if layout:
            try:
                # Translators: Used when describing keys on the system keyboard with a particular layout.
                # %s is replaced with the layout name.
                # For example, in English, this might produce "laptop keyboard".
                dispSource = _("%s keyboard") % cls.LAYOUTS[layout]
            except KeyError:
                pass
        if not dispSource:
            # Translators: Used when describing keys on the system keyboard applying to all layouts.
            dispSource = _("keyboard, all layouts")

        keys = set(keys.split("+"))
        names = []
        main = None
        try:
            # If present, the NVDA key should appear first.
            keys.remove("nvda")
            names.append("NVDA")
        except KeyError:
            pass
        for key in keys:
            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
        if main is not None:
            # If there is no main key, this gesture identifier only contains modifiers.
            names.append(main)
        return dispSource, "+".join(names)
Exemple #2
0
	def getDisplayTextForIdentifier(cls, identifier):
		layout, keys = cls.RE_IDENTIFIER.match(identifier).groups()
		dispSource = None
		if layout:
			try:
				# Translators: Used when describing keys on the system keyboard with a particular layout.
				# %s is replaced with the layout name.
				# For example, in English, this might produce "laptop keyboard".
				dispSource = _("%s keyboard") % cls.LAYOUTS[layout]
			except KeyError:
				pass
		if not dispSource:
			# Translators: Used when describing keys on the system keyboard applying to all layouts.
			dispSource = _("keyboard, all layouts")

		keys = set(keys.split("+"))
		names = []
		main = None
		try:
			# If present, the NVDA key should appear first.
			keys.remove("nvda")
			names.append("NVDA")
		except KeyError:
			pass
		for key in keys:
			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)
Exemple #3
0
 def _reportToggleKey(self):
     toggleState = winUser.getKeyState(self.vkCode) & 1
     key = self.mainKeyName
     ui.message(u"{key} {state}".format(
         key=localizedKeyLabels.get(key.lower(), key),
         state=_("on") if toggleState else _("off")))
	def _reportToggleKey(self):
		toggleState = winUser.getKeyState(self.vkCode) & 1
		key = self.mainKeyName
		ui.message(u"{key} {state}".format(
			key=localizedKeyLabels.get(key, key),
			state=_("on") if toggleState else _("off")))
	def _get_displayName(self):
		return "+".join(localizedKeyLabels.get(key, key) for key in self._keyNamesInDisplayOrder)
Exemple #6
0
	def _get_displayName(self):
		return "+".join(
			# Translators: Reported for an unknown key press.
			# %s will be replaced with the key code.
			_("unknown %s") % key[8:] if key.startswith("unknown_")
			else localizedKeyLabels.get(key.lower(), key) for key in self._keyNamesInDisplayOrder)
Exemple #7
0
 def _get_displayName(self):
     return "+".join(
         localizedKeyLabels.get(key, key)
         for key in self._keyNamesInDisplayOrder)
Exemple #8
0
	def _get_displayName(self):
		return "+".join(
			# Translators: Reported for an unknown key press.
			# %s will be replaced with the key code.
			_("unknown %s") % key[8:] if key.startswith("unknown_")
			else localizedKeyLabels.get(key.lower(), key) for key in self._keyNamesInDisplayOrder)