Пример #1
0
    def fill_layout_treeview(self):
        lang = self.settings.get("language_code")

        keyboard_names._default_filename = self.filename

        if not keyboard_names.has_language(lang):
            lang = "C"

        kbd_names = keyboard_names.KeyboardNames(self.filename)
        kbd_names._load(lang)

        sorted_layouts = []

        for layout in kbd_names._layout_by_human:
            sorted_layouts.append(layout)

        sorted_layouts = misc.sort_list(sorted_layouts, self.settings.get("locale"))

        # Block signal
        self.layout_treeview.handler_block_by_func(self.on_keyboardlayout_cursor_changed)

        # Clear our model
        liststore = self.layout_treeview.get_model()
        liststore.clear()

        # Add layouts (sorted)
        for layout in sorted_layouts:
            liststore.append([layout])
        
        # Unblock signal
        self.layout_treeview.handler_unblock_by_func(self.on_keyboardlayout_cursor_changed)
Пример #2
0
    def fill_layout_treeview(self):
        lang = self.settings.get("language_code")

        keyboard_names._default_filename = self.filename

        if not keyboard_names.has_language(lang):
            lang = "C"

        kbd_names = keyboard_names.KeyboardNames(self.filename)
        kbd_names._load(lang)

        sorted_layouts = []

        for layout in kbd_names._layout_by_human:
            sorted_layouts.append(layout)

        sorted_layouts = misc.sort_list(sorted_layouts,
                                        self.settings.get("locale"))

        # Block signal
        self.layout_treeview.handler_block_by_func(
            self.on_keyboardlayout_cursor_changed)

        # Clear our model
        liststore = self.layout_treeview.get_model()
        liststore.clear()

        # Add layouts (sorted)
        for layout in sorted_layouts:
            liststore.append([layout])

        # Unblock signal
        self.layout_treeview.handler_unblock_by_func(
            self.on_keyboardlayout_cursor_changed)
Пример #3
0
    def fill_variant_treeview(self):
        selected = self.layout_treeview.get_selection()

        if selected:
            (ls, iter) = selected.get_selected()
            if iter:

                keyboard_layout = ls.get_value(iter, 0)

                # store layout selected
                self.keyboard_layout_human = keyboard_layout

                lang = self.settings.get("language_code")

                if not keyboard_names.has_language(lang):
                    lang = "C"

                kbd_names = keyboard_names.KeyboardNames(self.filename)
                kbd_names._load(lang)

                country_code = kbd_names._layout_by_human[
                    self.keyboard_layout_human]
                self.keyboard_layout = country_code

                variants = kbd_names._variant_by_human

                sorted_variants = []

                for variant in variants[country_code]:
                    sorted_variants.append(variant)

                sorted_variants.sort()
                #sorted_variants = misc.sort_list(sorted_variants, self.settings.get("locale"))

                # Block signal
                self.variant_treeview.handler_block_by_func(
                    self.on_keyboardvariant_cursor_changed)

                # Clear our model
                liststore = self.variant_treeview.get_model()
                liststore.clear()

                # Add keyboard variants (sorted)
                for variant in sorted_variants:
                    liststore.append([variant])

                # Unblock signal
                self.variant_treeview.handler_unblock_by_func(
                    self.on_keyboardvariant_cursor_changed)

                #selection = self.variant_treeview.get_selection()
                self.variant_treeview.set_cursor(0)
        else:
            liststore = self.variant_treeview.get_model()
            liststore.clear()
Пример #4
0
    def fill_variant_treeview(self):
        selected = self.layout_treeview.get_selection()

        if selected:
            (ls, iter) = selected.get_selected()
            if iter:

                keyboard_layout = ls.get_value(iter, 0)

                # store layout selected
                self.keyboard_layout_human = keyboard_layout

                lang = self.settings.get("language_code")

                if not keyboard_names.has_language(lang):
                    lang = "C"

                kbd_names = keyboard_names.KeyboardNames(self.filename)
                kbd_names._load(lang)

                country_code = kbd_names._layout_by_human[self.keyboard_layout_human]
                self.keyboard_layout = country_code

                variants = kbd_names._variant_by_human

                sorted_variants = []

                for variant in variants[country_code]:
                    sorted_variants.append(variant)

                #sorted_variants.sort()
                sorted_variants = misc.sort_list(sorted_variants, self.settings.get("locale"))
                
                # Block signal
                self.variant_treeview.handler_block_by_func(self.on_keyboardvariant_cursor_changed)

                # Clear our model
                liststore = self.variant_treeview.get_model()
                liststore.clear()

                # Add keyboard variants (sorted)
                for variant in sorted_variants:
                    liststore.append([variant])

                # Unblock signal
                self.variant_treeview.handler_unblock_by_func(self.on_keyboardvariant_cursor_changed)

                #selection = self.variant_treeview.get_selection()
                self.variant_treeview.set_cursor(0)
        else:
            liststore = self.variant_treeview.get_model()
            liststore.clear()