[PATCH 2/2] Determine the lang selected arrow direction at render time

Vratislav Podzimek vpodzime at redhat.com
Wed Jul 23 07:33:14 UTC 2014


On Tue, 2014-07-22 at 17:31 -0400, David Shea wrote:
> This fixes the arrow direction for the welcome spoke when switching
> between LTR and RTL languages.
> ---
>  pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py b/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py
> index 5e4d9de..6e3caca 100644
> --- a/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py
> +++ b/pyanaconda/ui/gui/spokes/lib/lang_locale_handler.py
> @@ -56,10 +56,8 @@ class LangLocaleHandler(object):
>      def initialize(self):
>          # Render an arrow for the chosen language
>          datadir = os.environ.get("ANACONDA_WIDGETS_DATADIR", "/usr/share/anaconda")
> -        if Gtk.get_locale_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._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"))
>          self._langSelectedColumn.set_cell_data_func(self._langSelectedRenderer,
>                                                      self._render_lang_selected)
>  
> @@ -97,8 +95,13 @@ class LangLocaleHandler(object):
>      def _render_lang_selected(self, column, renderer, model, itr, user_data=None):
>          (lang_store, sel_itr) = self._langSelection.get_selected()
>  
> +        if Gtk.get_locale_direction() == Gtk.TextDirection.LTR:
> +            _arrow = self._right_arrow
> +        else:
> +            _arrow = self._left_arrow
> +
>          if sel_itr and lang_store[sel_itr][2] == model[itr][2]:
> -            renderer.set_property("pixbuf", self._arrow.get_pixbuf())
> +            renderer.set_property("pixbuf", _arrow.get_pixbuf())
>          else:
>              renderer.set_property("pixbuf", None)
This is definitely good, ACK. 

-- 
Vratislav Podzimek

Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic




More information about the anaconda-patches mailing list