def apply_keyboard(self, layout_name, variant_name): model = self.db.get('keyboard-configuration/modelcode') l = self.get_locale() try: layout = keyboard_names.layout_id(l, layout_name) except KeyError: self.debug("Unknown keyboard layout '%s'" % layout_name) return if not keyboard_names.has_variants(l, layout): self.debug("No known variants for layout '%s'" % layout) variant = '' else: try: variant = keyboard_names.variant_id( l, layout, variant_name) except KeyError: self.debug("Unknown keyboard variant '%s' for layout '%s'" % (variant_name, layout_name)) return (model, layout, variant, options) = \ self.adjust_keyboard(model, layout, variant, []) self.debug("Setting keyboard layout: %s %s %s %s" % (model, layout, variant, options)) self.apply_real_keyboard(model, layout, variant, options)
def apply_keyboard(self, layout_name, variant_name): model = self.db.get('keyboard-configuration/modelcode') ret = self.get_locale() try: layout = keyboard_names.layout_id(ret, layout_name) except KeyError: self.debug("Unknown keyboard layout '%s'" % layout_name) return if not keyboard_names.has_variants(ret, layout): self.debug("No known variants for layout '%s'" % layout) variant = '' else: try: variant = keyboard_names.variant_id(ret, layout, variant_name) except KeyError: self.debug("Unknown keyboard variant '%s' for layout '%s'" % (variant_name, layout_name)) return (model, layout, variant, options) = \ self.adjust_keyboard(model, layout, variant, []) self.debug("Setting keyboard layout: %s %s %s %s" % (model, layout, variant, options)) self.apply_real_keyboard(model, layout, variant, options)