Store layouts as their names and only render them as 'language (description)'
We need to store layouts as their names because that is the way how they are
identified in kickstarts, libxklavier and libgnomekbd. On the other hand, we
need to display layouts in a more user-friendly way.
---
pyanaconda/ui/gui/spokes/keyboard.py | 40 +++++++++++++++++++++++----------
pyanaconda/ui/gui/spokes/keyboard.ui | 6 ++--
pyanaconda/xklavier.py | 13 +++++------
3 files changed, 37 insertions(+), 22 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 0230203..f2d471c 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -34,6 +34,10 @@ from pyanaconda import xklavier
def matches_entry(self, model, itr, user_data=None):
- value = model.get_value(itr, 0)
+ value = model[itr][0]
+ value = self._xkl_wrapper.name_to_show_str[value]
entry_text = self._entry.get_text()
if entry_text is not None:
entry_text = entry_text.lower()
@@ -68,6 +73,13 @@ class AddLayoutDialog(UIObject):
self._entry.grab_focus()
def initialize(self):
+ # We want to store layouts' names but show layouts as
+ # 'language (description)'.
+ layoutColumn = self.builder.get_object("newLayoutColumn")
+ layoutRenderer = self.builder.get_object("newLayoutRenderer")
+ layoutColumn.set_cell_data_func(layoutRenderer, _show_layout,
+ self._xkl_wrapper)
+
self._store = self.builder.get_object("newLayoutStore")
for layout in self._xkl_wrapper.get_available_layouts():
self._addLayout(self._store, layout)
@@ -131,15 +143,22 @@ class KeyboardSpoke(NormalSpoke):
@property
def status(self):
# We don't need to check that self._store is empty, because that isn't allowed.
- return self._store[0][0]
+ return self._xkl_wrapper.name_to_show_str[self._store[0][0]]
for (lang_name, lang_desc), variants in sorted(self._language_keyboard_variants.items()):
for layout in variants:
- yield "%s (%s)" % (lang_desc.encode("utf-8"), layout.description.encode("utf-8"))
+ yield layout.name
--
1.7.4.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list