def search(self, *a): text = self.entry_search.get_text().decode('utf8') if text == u'': return elif len(text) < 3: daw_customs.erro(self.parent, 'أدخل كلمة بها أكثر من حرفين للبحث عنها') return all_root, all_term = daw_stemming.get_root(u''+text) self.tree_dict.collapse_all() self.store_dict.clear() self.view_dict_bfr.set_text('') if len(all_root['taje'])+len(all_root['assas'])+len(all_root['lisan'])+len(all_root['mekhtar']) == 0: daw_customs.erro(self.parent, 'لا يوجد نتيجة'); return if len(all_root['lisan']) != 0: a1 = self.store_dict.append(None, ['لسان العرب', 'lisan']) for text in all_root['lisan']: self.store_dict.append(a1, [text, 'lisan']) if len(all_root['taje']) != 0: a2 = self.store_dict.append(None, ['تاج العروس', 'taje']) for text in all_root['taje']: self.store_dict.append(a2, [text, 'taje']) if len(all_root['assas']) != 0: a3 = self.store_dict.append(None, ['أساس البلاغة', 'assas']) for text in all_root['assas']: self.store_dict.append(a3, [text, 'assas']) if len(all_root['mekhtar']) != 0: a4 = self.store_dict.append(None, ['مختار الصحاح', 'mekhtar']) for text in all_root['mekhtar']: self.store_dict.append(a4, [text, 'mekhtar']) self.all_term = all_term
def explain_term(self, *a): if self.view_poem_bfr.get_has_selection(): sel = self.view_poem_bfr.get_selection_bounds() sel_text = self.view_poem_bfr.get_text(sel[0], sel[1],True) text = daw_araby.stripTatweel(sel_text.decode('utf8')) text = daw_tools.first_term(text) if len(text) >= 3: all_root, all_term = daw_stemming.get_root(u''+text) if len(all_root['taje'])+len(all_root['assas'])+len(all_root['lisan'])+len(all_root['mekhtar']) == 0: daw_customs.erro(self.parent, 'لا يوجد نتيجة'); return self.parent.dictpage.tree_dict.collapse_all() self.parent.dictpage.store_dict.clear() self.parent.dictpage.view_dict_bfr.set_text('') if len(all_root['taje'])+len(all_root['assas'])+len(all_root['lisan'])+len(all_root['mekhtar']) == 0: daw_customs.erro(self.parent, 'لا يوجد نتيجة'); return if len(all_root['lisan']) != 0: a1 = self.parent.dictpage.store_dict.append(None, ['لسان العرب', 'lisan']) for text in all_root['lisan']: self.parent.dictpage.store_dict.append(a1, [text, 'lisan']) if len(all_root['taje']) != 0: a2 = self.parent.dictpage.store_dict.append(None, ['تاج العروس', 'taje']) for text in all_root['taje']: self.parent.dictpage.store_dict.append(a2, [text, 'taje']) if len(all_root['assas']) != 0: a3 = self.parent.dictpage.store_dict.append(None, ['أساس البلاغة', 'assas']) for text in all_root['assas']: self.parent.dictpage.store_dict.append(a3, [text, 'assas']) if len(all_root['mekhtar']) != 0: a4 = self.parent.dictpage.store_dict.append(None, ['مختار الصحاح', 'mekhtar']) for text in all_root['mekhtar']: self.parent.dictpage.store_dict.append(a4, [text, 'mekhtar']) self.parent.dictpage.all_term = all_term self.parent.main_notebook.set_current_page(7) self.parent.dicty_page.set_active(True)