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)
def set_keyboard_variant(self, variant): index = self.page.keyboard_variant_combobox.findText( misc.utf8(variant)) if index > -1: self.page.keyboard_variant_combobox.setCurrentIndex(index) if self.keyboardDisplay: l = self.controller.dbfilter.get_locale() layout = keyboard_names.layout_id(l, self.get_keyboard()) if variant: try: var = keyboard_names.variant_id( l, layout, misc.utf8(variant)) except KeyError: var = None self.keyboardDisplay.setVariant(var)
def on_keyboard_variant_selected(self, *args): layout = self.get_keyboard() variant = self.get_keyboard_variant() if self.keyboardDisplay: var = None l = self.controller.dbfilter.get_locale() ly = keyboard_names.layout_id(l, layout) if variant: try: var = keyboard_names.variant_id(l, ly, misc.utf8(variant)) except KeyError: var = None self.keyboardDisplay.setVariant(var) if layout is not None and variant is not None: self.controller.dbfilter.apply_keyboard(layout, variant)
def set_keyboard_variant(self, variant): index = self.page.keyboard_variant_combobox.findText( misc.utf8(variant)) if index > -1: self.page.keyboard_variant_combobox.setCurrentIndex(index) if self.keyboardDisplay: lang = 'C' layout = keyboard_names.layout_id(lang, self.get_keyboard()) if variant: try: var = keyboard_names.variant_id(lang, layout, misc.utf8(variant)) except KeyError: var = None self.keyboardDisplay.setVariant(var)
def set_keyboard_variant(self, variant): index = self.page.keyboard_variant_combobox.findText( misc.utf8(variant)) if index > -1: self.page.keyboard_variant_combobox.setCurrentIndex(index) if self.keyboardDisplay: lang = 'C' layout = keyboard_names.layout_id(lang, self.get_keyboard()) if variant: try: var = keyboard_names.variant_id( lang, layout, misc.utf8(variant)) except KeyError: var = None self.keyboardDisplay.setVariant(var)