示例#1
0
 def add_words(self, dicname, rows):
     words = {self.word_for_row(r) for r in rows}
     words.discard(None)
     for w in words:
         if not dictionaries.add_to_user_dictionary(dicname, *w):
             dictionaries.remove_from_user_dictionary(dicname, [w])
         self.spell_map[w] = dictionaries.recognized(*w)
         self.update_word(w)
示例#2
0
 def remove_word(self):
     words = {i.data(Qt.UserRole).toPyObject() for i in self.words.selectedItems()}
     if words:
         kwords = [(w, DictionaryLocale(l, None)) for w, l in words]
         d = self.current_dictionary
         if dictionaries.remove_from_user_dictionary(d.name, kwords):
             dictionaries.clear_caches()
             self.show_current_dictionary()
             self.dictionaries_changed = True