def on_country_changed(self, combo):

        # making sure the country has been set
        country_text = combo.get_selected_item_text()
        country_index = combo.get_selected_item_index()
        if not country_text or country_index == -1:
            return

        # Remove entries from variants combo box
        self.variants_combo.remove_all()
        self.selected_country_hr = country_text
        self.selected_country_index = country_index

        # Refresh variants combo box
        self.selected_country = keyboard_config.find_country_code(country_text, self.selected_layout)
        variants = keyboard_config.find_keyboard_variants(self.selected_country)
        self.variants_combo.append('generic')
        if variants is not None:
            for v in variants:
                self.variants_combo.append(v[0])

        # if kano keyboard is connected, change to Mac layout
        kano_keyboard = detect_kano_keyboard()

        if kano_keyboard:
            self.set_variants_to_mac_layout()
        else:
            self.set_variants_to_generic()
        self.on_variants_changed(self.variants_combo)
Exemple #2
0
    def on_country_changed(self, combo):

        # making sure the country has been set
        country_text = combo.get_selected_item_text()
        country_index = combo.get_selected_item_index()
        if not country_text or country_index == -1:
            return

        # Remove entries from variants combo box
        self.variants_combo.remove_all()
        self.selected_country_hr = country_text
        self.selected_country_index = country_index

        # Refresh variants combo box
        self.selected_country = keyboard_config.find_country_code(country_text, self.selected_layout)
        variants = keyboard_config.find_keyboard_variants(self.selected_country)
        self.variants_combo.append('generic')
        if variants is not None:
            for v in variants:
                self.variants_combo.append(v[0])

        # if kano keyboard is connected, change to Mac layout
        kano_keyboard = detect_kano_keyboard()

        if kano_keyboard:
            self.set_variants_to_mac_layout()
        else:
            self.set_variants_to_generic()
        self.on_variants_changed(self.variants_combo)
    def on_variants_changed(self, combo):

        # making sure the variant has been set
        variant_text = combo.get_selected_item_text()
        variant_index = combo.get_selected_item_index()
        if not variant_text or variant_index == -1:
            return

        self.kano_button.set_sensitive(True)

        if variant_text == 'generic':
            self.selected_variant = self.selected_variant_hr = variant_text
            self.selected_variant_index = 0
            return
        # Select the variant code
        variants = keyboard_config.find_keyboard_variants(self.selected_country)
        if variants is not None:
            for v in variants:
                if v[0] == variant_text:
                    self.selected_variant = v[1]
                    self.selected_variant_index = variant_index
                    self.selected_variant_hr = variant_text
Exemple #4
0
    def on_variants_changed(self, combo):

        # making sure the variant has been set
        variant_text = combo.get_selected_item_text()
        variant_index = combo.get_selected_item_index()
        if not variant_text or variant_index == -1:
            return

        self.kano_button.set_sensitive(True)

        if variant_text == 'generic':
            self.selected_variant = self.selected_variant_hr = variant_text
            self.selected_variant_index = 0
            return
        # Select the variant code
        variants = keyboard_config.find_keyboard_variants(self.selected_country)
        if variants is not None:
            for v in variants:
                if v[0] == variant_text:
                    self.selected_variant = v[1]
                    self.selected_variant_index = variant_index
                    self.selected_variant_hr = variant_text