def set_keyboard(self, layout): index = self.page.keyboard_layout_combobox.findText(misc.utf8(layout)) if index > -1: self.page.keyboard_layout_combobox.setCurrentIndex(index) if self.keyboardDisplay: lang = self.controller.dbfilter.get_locale() try: ly = keyboard_names.layout_id(lang, misc.utf8(layout)) except KeyError: ly = keyboard_names.layout_id('C', misc.utf8(layout)) self.keyboardDisplay.setLayout(ly)
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 on_keyboard_layout_selected(self, *args): layout = self.get_keyboard() lang = self.controller.dbfilter.get_locale() if layout is not None: # skip updating keyboard if not using display if self.keyboardDisplay: try: ly = keyboard_names.layout_id(lang, misc.utf8(layout)) except KeyError: ly = keyboard_names.layout_id('C', misc.utf8(layout)) self.keyboardDisplay.setLayout(ly) # no variants, force update by setting none # if not keyboard_names.has_variants(l, ly): # self.keyboardDisplay.setVariant(None) self.current_layout = layout self.controller.dbfilter.change_layout(layout)
def set_keyboard(self, layout): index = self.page.keyboard_layout_combobox.findText(misc.utf8(layout)) if index > -1: self.page.keyboard_layout_combobox.setCurrentIndex(index) if self.keyboardDisplay: lang = 'C' ly = keyboard_names.layout_id(lang, misc.utf8(layout)) self.keyboardDisplay.setLayout(ly)
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 = self.controller.dbfilter.get_locale() try: layout = keyboard_names.layout_id(lang, self.get_keyboard()) except KeyError: layout = keyboard_names.layout_id('C', 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 = self.controller.dbfilter.get_locale() try: layout = keyboard_names.layout_id(lang, self.get_keyboard()) except KeyError: layout = keyboard_names.layout_id('C', 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 on_keyboard_variant_selected(self, *args): layout = self.get_keyboard() variant = self.get_keyboard_variant() if self.keyboardDisplay: var = None lang = self.controller.dbfilter.get_locale() try: ly = keyboard_names.layout_id(lang, layout) except KeyError: ly = keyboard_names.layout_id('C', layout) if variant: try: var = keyboard_names.variant_id(lang, 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)