def initialize_things(self): self.signal.startLoading.emit() db = Database() prop = db.get_property(4) global autocomplete sql = ('SELECT DISTINCT Word FROM Word' if prop == 'Lemmata' else 'SELECT Flection FROM Flection') cmwords = db.read_database(sql) words = dict() for r in cmwords: words.setdefault(r[0], {}) del cmwords autocomplete = AutoComplete(words=words) self.signal.stopLoading.emit()
class WriteFlection(): def __init__(self, dictionary_id): self.db = Database() self.decliner = CollatinusDecliner() self._get_all_words(dictionary_id) def _get_all_words(self, dictionary_id): self.data = self.db.read_database("""select distinct a.WordId , a.Word from Word as a inner join Definition as b on a.WordId = b.WordId left outer join Flection as c on a.WordId = c.WordId where b.DictionaryId = {0} and c.FlectionId is null""".format( dictionary_id))