[PATCH 1/2] Try to get layout name for layout description not for 'language (description)'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We display layout as 'language (description)' but we have a dict mapping
description -> name. Therefore to get the name we need the description.
Having 'language (description)' -> name mapping would be hard with the
way how querying libxklavier works.
---
 pyanaconda/ui/gui/spokes/keyboard.py |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 0230203..f649961 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -137,9 +137,9 @@ class KeyboardSpoke(NormalSpoke):
         NormalSpoke.initialize(self)
 
         self._store = self.builder.get_object("addedLayoutStore")
-        self._addLayout(self._store, "English (US)")
-        self._addLayout(self._store, "Irish")
-        self._addLayout(self._store, "English (US, with some other stuff)")
+        self._addLayout(self._store, "English (English (US))")
+        self._addLayout(self._store, "English (Irish)")
+        self._addLayout(self._store, "Czech (Czech (qwerty))")
 
     def refresh(self):
         NormalSpoke.refresh(self)
@@ -245,11 +245,11 @@ class KeyboardSpoke(NormalSpoke):
     def on_preview_clicked(self, button):
         selection = self.builder.get_object("layoutSelection")
         (store, cur) = selection.get_selected()
-        layout_description = store[cur]
-        if not layout_description:
+        layout_row = store[cur]
+        if not layout_row:
             return
 
-        layout_name = self._xkl_wrapper.description_to_name.get(layout_description[0], None)
+        layout_name = self.get_layout_name(layout_row[0])
         if not layout_name:
             return
 
@@ -290,3 +290,12 @@ class KeyboardSpoke(NormalSpoke):
         else:
             self._upButton.set_sensitive(True)
             self._downButton.set_sensitive(True)
+
+    def get_layout_name(self, layout):
+        #we have a layout displayed as
+        #language (description)
+        #where description may contain brackets
+        lindex = layout.find("(") + 1
+        rindex = layout.rfind(")")
+        layout_description = layout[lindex:rindex]
+        return self._xkl_wrapper.description_to_name.get(layout_description, None)
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux