Exemplo n.º 1
0
    def _refresh_locale_store(self, lang):
        """Refresh the localeStore with locales for the given language."""

        self._localeStore.clear()
        locales = localization.get_language_locales(lang)
        for locale in locales:
            self._add_locale(self._localeStore,
                             localization.get_native_name(locale), locale)

        # select the first locale (with the highest rank)
        set_treeview_selection(self._localeView, locales[0], col=1)
Exemplo n.º 2
0
    def _refresh_locale_store(self, lang):
        """Refresh the localeStore with locales for the given language."""

        self._localeStore.clear()
        locales = localization.get_language_locales(lang)
        for locale in locales:
            self._add_locale(self._localeStore,
                             localization.get_native_name(locale),
                             locale)

        # select the first locale (with the highest rank)
        set_treeview_selection(self._localeView, locales[0], col=1)
Exemplo n.º 3
0
    def get_locale_data(self, locale_id):
        """Get data about the specified locale.

        :param: a locale id (for example, "en_US.UTF-8")
        :return: a locale data
        """
        tdata = LocaleData()
        tdata.english_name = get_english_name(locale_id)
        tdata.language_id = get_language_id(locale_id)
        tdata.locale_id = locale_id
        tdata.native_name = get_native_name(locale_id)

        return tdata
Exemplo n.º 4
0
    def get_language_data(self, language_id):
        """Get data about the specified language.

        :param: a language id (for example, "en")
        :return: a language data
        """
        tdata = LanguageData()
        tdata.english_name = get_english_name(language_id)
        tdata.is_common = language_id in get_common_languages()
        tdata.language_id = language_id
        tdata.native_name = get_native_name(language_id)

        return tdata
Exemplo n.º 5
0
    def initialize(self):
        # Render a right arrow for the chosen language
        self._right_arrow = Gtk.Image.new_from_file(
            "/usr/share/anaconda/pixmaps/right-arrow-icon.png")
        self._langSelectedColumn.set_cell_data_func(self._langSelectedRenderer,
                                                    self._render_lang_selected)

        # fill the list with available translations
        for lang in localization.get_available_translations():
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 6
0
    def initialize(self):
        # Render an arrow for the chosen language
        self._right_arrow = Gtk.Image.new_from_resource("/org/fedoraproject/anaconda/widgets/right-arrow-icon.png")
        self._left_arrow = Gtk.Image.new_from_resource("/org/fedoraproject/anaconda/wdigets/left-arrow-icon.png")
        override_cell_property(self._langSelectedColumn, self._langSelectedRenderer,
                               "pixbuf", self._render_lang_selected)

        # fill the list with available translations
        for lang in localization.get_available_translations():
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
    def initialize(self):
        # Render an arrow for the chosen language
        datadir = os.environ.get("ANACONDA_WIDGETS_DATA", "/usr/share/anaconda")
        self._right_arrow = Gtk.Image.new_from_file(os.path.join(datadir, "pixmaps", "right-arrow-icon.png"))
        self._left_arrow = Gtk.Image.new_from_file(os.path.join(datadir, "pixmaps", "left-arrow-icon.png"))
        override_cell_property(self._langSelectedColumn, self._langSelectedRenderer,
                               "pixbuf", self._render_lang_selected)

        # fill the list with available translations
        for lang in localization.get_available_translations():
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 8
0
    def initialize(self):
        # Render an arrow for the chosen language
        if get_default_widget_direction() == Gtk.TextDirection.LTR:
            self._arrow = Gtk.Image.new_from_file("/usr/share/anaconda/pixmaps/right-arrow-icon.png")
        else:
            self._arrow = Gtk.Image.new_from_file("/usr/share/anaconda/pixmaps/left-arrow-icon.png")
        self._langSelectedColumn.set_cell_data_func(self._langSelectedRenderer,
                                                    self._render_lang_selected)

        # fill the list with available translations
        for lang in localization.get_available_translations():
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 9
0
    def initialize(self):
        # Render an arrow for the chosen language
        datadir = os.environ.get("ANACONDA_WIDGETS_DATADIR", "/usr/share/anaconda")
        if get_default_widget_direction() == Gtk.TextDirection.LTR:
            self._arrow = Gtk.Image.new_from_file(os.path.join(datadir, "pixmaps", "right-arrow-icon.png"))
        else:
            self._arrow = Gtk.Image.new_from_file(os.path.join(datadir, "pixmaps", "left-arrow-icon.png"))
        self._langSelectedColumn.set_cell_data_func(self._langSelectedRenderer,
                                                    self._render_lang_selected)

        # fill the list with available translations
        for lang in localization.get_available_translations():
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 10
0
    def initialize(self):
        # Render an arrow for the chosen language
        self._right_arrow = Gtk.Image.new_from_resource(
            "/org/fedoraproject/anaconda/widgets/right-arrow-icon.png")
        self._left_arrow = Gtk.Image.new_from_resource(
            "/org/fedoraproject/anaconda/wdigets/left-arrow-icon.png")
        override_cell_property(self._langSelectedColumn,
                               self._langSelectedRenderer, "pixbuf",
                               self._render_lang_selected)

        # fill the list with available translations
        for lang in localization.get_available_translations():
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 11
0
    def initialize(self):
        # Load arrows from resources. Unfortunately, Gtk.Image.new_from_resource does not
        # work for some reason, so we should use GdkPixbuf.Pixbuf.new_from_resource instead.
        resource_path = "/org/fedoraproject/anaconda/widgets/"
        self._right_arrow = GdkPixbuf.Pixbuf.new_from_resource(resource_path + "right-arrow-icon.png")
        self._left_arrow = GdkPixbuf.Pixbuf.new_from_resource(resource_path + "left-arrow-icon.png")

        # Render an arrow for the chosen language.
        override_cell_property(self._langSelectedColumn, self._langSelectedRenderer,
                               "pixbuf", self._render_lang_selected)

        # fill the list with available translations
        langs = localization.get_available_translations()
        langs = self._filter_languages(langs)
        for lang in langs:
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 12
0
    def initialize(self):
        # Load arrows from resources. Unfortunately, Gtk.Image.new_from_resource does not
        # work for some reason, so we should use GdkPixbuf.Pixbuf.new_from_resource instead.
        resource_path = "/org/fedoraproject/anaconda/widgets/"
        self._right_arrow = GdkPixbuf.Pixbuf.new_from_resource(resource_path + "right-arrow-icon.png")
        self._left_arrow = GdkPixbuf.Pixbuf.new_from_resource(resource_path + "left-arrow-icon.png")

        # Render an arrow for the chosen language.
        override_cell_property(self._langSelectedColumn, self._langSelectedRenderer,
                               "pixbuf", self._render_lang_selected)

        # fill the list with available translations
        langs = localization.get_available_translations()
        langs = self._filter_languages(langs)
        for lang in langs:
            self._add_language(self._languageStore,
                               localization.get_native_name(lang),
                               localization.get_english_name(lang), lang)

        # make filtering work
        self._languageStoreFilter.set_visible_func(self._matches_entry, None)
Exemplo n.º 13
0
 def status(self):
     return ", ".join(
         localization.get_native_name(locale)
         for locale in self._installed_langsupports)
Exemplo n.º 14
0
 def test_native_name(self):
     self.assertEqual(localization.get_native_name("de"), "Deutsch")
     self.assertEqual(localization.get_native_name("cs_CZ"), "Čeština (Česko)")
Exemplo n.º 15
0
 def test_native_name(self):
     assert localization.get_native_name("de") == "Deutsch"
     assert localization.get_native_name("cs_CZ") == "Čeština (Česko)"
Exemplo n.º 16
0
 def test_invalid_raise_decorator(self):
     with pytest.raises(localization.InvalidLocaleSpec):
         localization.get_native_name("blah")
     with pytest.raises(localization.InvalidLocaleSpec):
         localization.is_supported_locale("blah")
Exemplo n.º 17
0
 def status(self):
     return ", ".join(localization.get_native_name(locale)
                      for locale in self._installed_langsupports)