[master] [PATCH] Do not list some layouts twice (#882526)

Vratislav Podzimek vpodzime at redhat.com
Mon Dec 3 08:52:05 UTC 2012


If some layout is related to two (or more) languages, we get it twice
while iterating over languages and their related layouts. Since we use
a mapping from a layout name (e.g. 'us') to decription ('English (English (US))')
the result is that some items are listed twice in the list of all available
layouts. This needs some further fixing, but I'm leaving this for the related
post-F18 UI changes (see #859465 for more information).

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/keyboard.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index f317398..5d4db68 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -374,10 +374,14 @@ class XklWrapper(object):
             name = item_str(item.name)
             description = item_str(item.description)
 
-        if dest:
-            self.name_to_show_str[name] = "%s (%s)" % (dest.encode("utf-8"),
-                                                       description.encode("utf-8"))
-        self._variants_list.append(_Layout(name, description))
+        #if this layout has already been added for some other language,
+        #do not add it again (would result in duplicates in our lists)
+        if name not in self.name_to_show_str:
+            if dest:
+                self.name_to_show_str[name] = "%s (%s)" % (dest.encode("utf-8"),
+                                                    description.encode("utf-8"))
+
+            self._variants_list.append(_Layout(name, description))
 
     def _get_language_variants(self, c_reg, item, user_data=None):
         #helper "global" variable
-- 
1.7.11.7



More information about the anaconda-patches mailing list