def on_listbox_row_selected(self, listbox, listbox_row): """ Someone selected a different row of the listbox """ if listbox_row is not None: for vbox in listbox_row: for label in vbox.get_children(): current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) lang = label.get_text() lang_code = display_map[lang][1] self.set_language(lang_code)
def on_treeview_language_cursor_changed(self, treeview): selected = treeview.get_selection() if selected: (ls, iter) = selected.get_selected() if iter: current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) language = ls.get_value(iter, 0) language_code = display_map[language][1] self.set_language(language_code)
def on_listbox_row_selected(self, listbox, listbox_row): """ Someone selected a different row of the listbox """ if listbox_row is not None: for vbox in listbox_row: for label in vbox.get_children(): current_language, sorted_choices, display_map = i18n.get_languages( self.language_list) lang = label.get_text() lang_code = display_map[lang][1] self.set_language(lang_code)
def on_treeview_language_cursor_changed(self, treeview): selected = treeview.get_selection() if selected: (ls, iter) = selected.get_selected() if iter: current_language, sorted_choices, display_map = i18n.get_languages( self.language_list) language = ls.get_value(iter, 0) language_code = display_map[language][1] self.set_language(language_code)
def store_values(self): selected = self.treeview_language.get_selection() (ls, iter) = selected.get_selected() language = ls.get_value(iter,0) current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) self.settings.set("language_name", display_map[language][0]) self.settings.set("language_code", display_map[language][1]) return True
def set_languages_list(self): current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) current_language = self.langcode_to_lang(display_map) for lang in sorted_choices: box = Gtk.VBox() label = Gtk.Label() label.set_markup(lang) label.set_alignment(0, 0.5) box.add(label) self.listbox.add(box) if current_language == lang: self.select_default_row(current_language)
def store_values(self): listbox_row = self.listbox.get_selected_row() if listbox_row != None: for vbox in listbox_row: for label in vbox.get_children(): lang = label.get_text() current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) self.settings.set("language_name", display_map[lang][0]) self.settings.set("language_code", display_map[lang][1]) return True
def set_languages_list(self): current_language, sorted_choices, display_map = i18n.get_languages( self.language_list) current_language = self.langcode_to_lang(display_map) for lang in sorted_choices: box = Gtk.VBox() label = Gtk.Label() label.set_markup(lang) label.set_alignment(0, 0.5) box.add(label) self.listbox.add(box) if current_language == lang: self.select_default_row(current_language)
def store_values(self): selected = self.treeview_language.get_selection() (ls, iter) = selected.get_selected() language = ls.get_value(iter, 0) current_language, sorted_choices, display_map = i18n.get_languages( self.language_list) self.settings.set("language_name", display_map[language][0]) self.settings.set("language_code", display_map[language][1]) return True
def set_languages_list(self): liststore_language = Gtk.ListStore(str) render = Gtk.CellRendererText() col_languages = Gtk.TreeViewColumn(_("Languages"), render, text=0) self.treeview_language.set_model(liststore_language) self.treeview_language.append_column(col_languages) current_language, sorted_choices, display_map = i18n.get_languages(self.language_list) current_language = self.langcode_to_lang(display_map) for lang in sorted_choices: liststore_language.append([lang]) if current_language == lang: self.select_default_row(self.treeview_language, current_language)
def store_values(self): listbox_row = self.listbox.get_selected_row() if listbox_row != None: for vbox in listbox_row: for label in vbox.get_children(): lang = label.get_text() current_language, sorted_choices, display_map = i18n.get_languages( self.language_list) self.settings.set("language_name", display_map[lang][0]) self.settings.set("language_code", display_map[lang][1]) return True
def set_languages_list(self): liststore_language = Gtk.ListStore(str) render = Gtk.CellRendererText() col_languages = Gtk.TreeViewColumn(_("Languages"), render, text=0) self.treeview_language.set_model(liststore_language) self.treeview_language.append_column(col_languages) current_language, sorted_choices, display_map = i18n.get_languages( self.language_list) current_language = self.langcode_to_lang(display_map) for lang in sorted_choices: liststore_language.append([lang]) if current_language == lang: self.select_default_row(self.treeview_language, current_language)