Exemple #1
0
 def on_listbox_row_selected(self, listbox, listbox_row):
     """ Someone selected a different row of the listbox """
     if listbox_row is not None:
         for vbox in listbox_row:
             for label in vbox.get_children():
                 current_language, sorted_choices, display_map = i18n.get_languages(self.language_list)
                 lang = label.get_text()
                 lang_code = display_map[lang][1]
                 self.set_language(lang_code)
Exemple #2
0
 def on_listbox_row_selected(self, listbox, listbox_row):
     """ Someone selected a different row of the listbox """
     if listbox_row is not None:
         for vbox in listbox_row:
             for label in vbox.get_children():
                 current_language, sorted_choices, display_map = i18n.get_languages(self.language_list)
                 lang = label.get_text()
                 lang_code = display_map[lang][1]
                 self.set_language(lang_code)
    def store_values(self):
        lang = ""
        listbox_row = self.listbox.get_selected_row()
        if listbox_row is not None:
            for vbox in listbox_row:
                for label in vbox.get_children():
                    lang = label.get_text()

        current_language, sorted_choices, display_map = i18n.get_languages(self.language_list)
        if len(lang) > 0:
            self.settings.set("language_name", display_map[lang][0])
            self.settings.set("language_code", display_map[lang][1])

        return True
Exemple #4
0
    def store_values(self):
        lang = ""
        listbox_row = self.listbox.get_selected_row()
        if listbox_row is not None:
            for vbox in listbox_row:
                for label in vbox.get_children():
                    lang = label.get_text()

        current_language, sorted_choices, display_map = i18n.get_languages(self.language_list)
        if len(lang) > 0:
            self.settings.set("language_name", display_map[lang][0])
            self.settings.set("language_code", display_map[lang][1])

        return True
Exemple #5
0
 def on_listbox_row_selected(self, listbox, listbox_row):
     """ Someone selected a different row of the listbox """
     if listbox_row is not None:
         for vbox in listbox_row:
             for label in vbox.get_children():
                 (current_language, sorted_choices,
                  display_map) = i18n.get_languages(self.language_list)
                 lang = label.get_text()
                 lang_code = display_map[lang][1]
                 self.set_language(lang_code)
                 self.store_values()
                 self.language_button.set_label(lang_code.upper()[:2])
                 if hasattr(self.main_window, 'popover'):
                     if not self.selecting_default_row and self.popover_is_visible:
                         self.main_window.popover.set_visible(False)
                         self.popover_is_visible = False
Exemple #6
0
    def set_languages_list(self):
        """ Load languages list """
        sorted_choices = display_map = None

        try:
            (current_language,
             sorted_choices,
             display_map) = i18n.get_languages(self.language_list)
        except FileNotFoundError as file_error:
            self.logger.exception(file_error)

        current_language = self.langcode_to_lang(display_map)

        for lang in sorted_choices:
            selected = lang == current_language
            self.languages.append((lang, selected))
Exemple #7
0
    def set_languages_list(self):
        """ Load languages list """
        try:
            current_language, sorted_choices, display_map = i18n.get_languages(self.language_list)
        except FileNotFoundError as file_error:
            logging.error(file_error)
            sys.exit(1)

        current_language = self.langcode_to_lang(display_map)
        for lang in sorted_choices:
            box = Gtk.VBox()
            label = Gtk.Label()
            label.set_markup(lang)
            box.add(label)
            self.listbox.add(box)
            if current_language == lang:
                self.select_default_row(current_language)
Exemple #8
0
 def on_listbox_row_selected(self, listbox, listbox_row):
     """ Someone selected a different row of the listbox """
     if listbox_row is not None:
         for vbox in listbox_row:
             for label in vbox.get_children():
                 (current_language,
                     sorted_choices,
                     display_map) = i18n.get_languages(self.language_list)
                 lang = label.get_text()
                 lang_code = display_map[lang][1]
                 self.set_language(lang_code)
                 self.store_values()
                 self.language_button.set_label(lang_code.upper()[:2])
                 if hasattr(self.main_window, 'popover'):
                     if not self.selecting_default_row and self.popover_is_visible:
                         self.main_window.popover.set_visible(False)
                         self.popover_is_visible = False
Exemple #9
0
    def set_languages_list(self):
        """ Load languages list """
        try:
            current_language, sorted_choices, display_map = i18n.get_languages(self.language_list)
        except FileNotFoundError as file_error:
            logging.error(file_error)
            sys.exit(1)

        current_language = self.langcode_to_lang(display_map)
        for lang in sorted_choices:
            box = Gtk.VBox()
            label = Gtk.Label()
            label.set_markup(lang)
            box.add(label)
            self.listbox.add(box)
            if current_language == lang:
                self.select_default_row(current_language)
Exemple #10
0
    def set_languages_list(self):
        """ Load languages list """
        sorted_choices = display_map = None

        try:
            (current_language,
             sorted_choices,
             display_map) = i18n.get_languages(self.language_list)
        except FileNotFoundError as file_error:
            self.logger.exception(file_error)

        current_language = self.langcode_to_lang(display_map)

        for lang in sorted_choices:
            if lang == current_language:
                self.selected_language = lang

            self.languages.append(lang)