def __init__(self, parent=None, db=None, prefs=None): self.prefs = prefs or gui_prefs() self.refresh_recently_used() EditWithComplete.__init__(self, parent, sort_func=self.sort_language_items_key) self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon) self.setMinimumContentsLength(20) self._lang_map = lang_map_for_ui() self.names_with_commas = [x for x in itervalues(self._lang_map) if ',' in x] self.comma_map = {k:k.replace(',', '|') for k in self.names_with_commas} self.comma_rmap = {v:k for k, v in iteritems(self.comma_map)} self._rmap = {lower(v):k for k,v in iteritems(self._lang_map)} self.init_langs(db) self.item_selected.connect(self.update_recently_used)
def __init__(self, parent=None, db=None, prefs=None): self.prefs = prefs or gui_prefs() self.refresh_recently_used() EditWithComplete.__init__(self, parent, sort_func=self.sort_language_items_key) self.setSizeAdjustPolicy(self.AdjustToMinimumContentsLengthWithIcon) self.setMinimumContentsLength(20) self._lang_map = lang_map_for_ui() self.names_with_commas = [x for x in self._lang_map.itervalues() if ',' in x] self.comma_map = {k:k.replace(',', '|') for k in self.names_with_commas} self.comma_rmap = {v:k for k, v in self.comma_map.iteritems()} self._rmap = {lower(v):k for k,v in self._lang_map.iteritems()} self.init_langs(db) self.item_selected.connect(self.update_recently_used)