[PATCH 1/4] Remove the Layout class and things we don't need in XklWrapper

Vratislav Podzimek vpodzime at redhat.com
Fri Sep 13 10:59:38 UTC 2013


We no longer use libxklavier to get language/country-default keyboard layout so
we don't need to hold all items that were used for that.

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

diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index fa10579..4967cb4 100644
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -338,24 +338,6 @@ def item_str(s):
 
     return s.decode("utf-8") #there are some non-ascii layout descriptions
 
-class _Layout(object):
-    """Internal class representing a single layout variant"""
-
-    def __init__(self, name, desc):
-        self.name = name
-        self.desc = desc
-
-    def __str__(self):
-        return '%s (%s)' % (self.name, self.desc)
-
-    def __eq__(self, obj):
-        return isinstance(obj, self.__class__) and \
-            self.name == obj.name
-
-    @property
-    def description(self):
-        return self.desc
-
 class XklWrapperError(KeyboardConfigError):
     """Exception class for reporting libxklavier-related problems"""
 
@@ -424,10 +406,7 @@ class XklWrapper(object):
         self.configreg = Xkl.ConfigRegistry.get_instance(self._engine)
         self.configreg.load(False)
 
-        self._language_keyboard_variants = dict()
-        self._country_keyboard_variants = dict()
         self._switching_options = list()
-        self._variants_list = list()
 
         #we want to display layouts as 'language (description)'
         self.name_to_show_str = dict()
@@ -460,8 +439,6 @@ class XklWrapper(object):
             else:
                 self.name_to_show_str[name] = "%s" % description.encode("utf-8")
 
-            self._variants_list.append(_Layout(name, description))
-
     def _get_country_variant(self, c_reg, item, subitem, country):
         if subitem:
             name = item_str(item.name) + " (" + item_str(subitem.name) + ")"
@@ -478,27 +455,17 @@ class XklWrapper(object):
             else:
                 self.name_to_show_str[name] = "%s" % 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
-        self._variants_list = list()
         lang_name, lang_desc = item_str(item.name), item_str(item.description)
 
         c_reg.foreach_language_variant(lang_name, self._get_lang_variant, lang_desc)
 
-        self._language_keyboard_variants[lang_desc] = self._variants_list
-
     def _get_country_variants(self, c_reg, item, user_data=None):
-        #helper "global" variable
-        self._variants_list = list()
         country_name, country_desc = item_str(item.name), item_str(item.description)
 
         c_reg.foreach_country_variant(country_name, self._get_country_variant,
                                       country_desc)
 
-        self._country_keyboard_variants[country_name] = self._variants_list
-
     def _get_switch_option(self, c_reg, item, user_data=None):
         """Helper function storing layout switching options in foreach cycle"""
         desc = item_str(item.description)
-- 
1.7.11.7



More information about the anaconda-patches mailing list