def layout_keys_to_indexes(continent_key, country_key): continent_list = [ continent.lower() for continent in keyboard_layouts.get_continents() ] country_list = keyboard_layouts.sorted_countries( keyboard_layouts.get_countries_for_continent(continent_key)) try: continent_idx = continent_list.index(continent_key) except ValueError: continent_idx = 1 # America's index try: country_idx = country_list.index(country_key) except ValueError: country_idx = 21 # US country index return continent_idx, country_idx
def layout_keys_to_indexes(continent_key, country_key): continent_list = [ continent.lower() for continent in keyboard_layouts.get_continents() ] country_list = keyboard_layouts.sorted_countries( keyboard_layouts.get_countries_for_continent(continent_key) ) try: continent_idx = continent_list.index(continent_key) except ValueError: continent_idx = 1 # America's index try: country_idx = country_list.index(country_key) except ValueError: country_idx = 21 # US country index return continent_idx, country_idx
def fill_countries_combo(self, continent): continent = continent.lower() self.selected_layout = keyboard_layouts.get_countries_for_continent( continent) self.selected_continent_hr = continent # Remove entries from countries and variants combo box self.countries_combo.remove_all() self.variants_combo.remove_all() # Get a sorted list of the countries from the dict layout sorted_countries = keyboard_layouts.sorted_countries( self.selected_layout) # Refresh countries combo box for country in sorted_countries: self.countries_combo.append(country)
def fill_countries_combo(self, continent): continent = continent.lower() self.selected_layout = keyboard_layouts.get_countries_for_continent( continent ) self.selected_continent_hr = continent # Remove entries from countries and variants combo box self.countries_combo.remove_all() self.variants_combo.remove_all() # Get a sorted list of the countries from the dict layout sorted_countries = keyboard_layouts.sorted_countries( self.selected_layout ) # Refresh countries combo box for country in sorted_countries: self.countries_combo.append(country)