Программа берет текст из entry и декодирует его в utf-8
text_to_find = self.find_entry.get_text().decode("utf-8") # take text from textview
d_all = dict()
l_name = list() # list to find objects
l_name.append(text_to_find)
l_d = list()
# if root is not None -> use in select
entry = self.name_combo.get_child()
paramount_item = entry.get_text()
if not self.id_paramount==0 and not paramount_item == "":
for c in Chain.select().where(Chain.id_root == self.id_paramount):
if not c.b_root == 1: # not use root items
d_all[c.id] = c.c_item # take all data in database
else:
for c in Chain.select():
if not c.b_root == True: # not use root items
d_all[c.id] = c.c_item # take all data in database
d_all[c.id] = c.c_item # take all data in database
for k, v in d_all.items(): # combine list of values from dictionary
l_d.append(v)
for i in range(len(l_d)):
set_d = set(l_d[i]) # set of each element of dictionary
for j in range(len(l_name)):
set_l = set(l_name[j])
inter = set_d.intersection(set_l)
l_i = len(inter)
if len(inter) == len(set(l_name[j])):
for k, v in d_all.items():
if v == l_d[i]:
res = k # take key
if not self.is_root(int(res)):
self.rewrite_class_data(int(res))
self.write_cont()
if self.have_previous(self.id_previous):
self.b_up.set_visible(True)
else:
self.b_up.hide()
if self.id_previous == 0:
self.b_up.hide()
return