[Tails-dev] [PATCH tails-greeter] Enable users to select lay…

Delete this message

Reply to this message
Autor: Tails developers
Data:  
A: tails-dev
Assumpte: [Tails-dev] [PATCH tails-greeter] Enable users to select layout variants
The 'Other…' entry for layouts now also list all variants for a given country
layout. This should help Bépo and Dvorak users to enter their passphrase.
---
GdmGreeter/language.py | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/GdmGreeter/language.py b/GdmGreeter/language.py
index b07d62e..8b791c5 100644
--- a/GdmGreeter/language.py
+++ b/GdmGreeter/language.py
@@ -109,12 +109,20 @@ def __fill_layouts_dict():

     layouts_dict = {}


-    def layout_iter(registry, item, layouts):
-        layout_code = item.get_name()
-        if layout_code not in layouts:
-            layouts_dict[layout_code] = item.get_description()
-
-    _xkl_registry.foreach_layout(layout_iter, layouts_dict)
+    def variant_iter(registry, variant, layout):
+        code = '%s/%s' % (layout.get_name(), variant.get_name())
+        description = '%s - %s' % (layout.get_description(), variant.get_description())
+        if code not in layouts_dict:
+            layouts_dict[code] = description
+
+    def layout_iter(registry, layout, _):
+        code = layout.get_name()
+        description = layout.get_description()
+        if code not in layouts_dict:
+            layouts_dict[code] = description
+    _xkl_registry.foreach_layout_variant(code, variant_iter, layout)
+
+    _xkl_registry.foreach_layout(layout_iter, None)
     return layouts_dict


 def language_from_locale(locale):
@@ -442,7 +450,13 @@ class LocalisationSettings(object):
         return self._layout


     def set_layout(self, layout):
+        try:
+            layout, variant = layout.split('/')
+        except ValueError:
+            layout = layout
+            variant = ''
         self._layout = layout
+        self._variant = variant
         self.__apply_layout()


     def __set_default_layout(self):
-- 
1.7.2.5