예제 #1
0
 def modify_poet_cb(self, *a):
     model, i = self.sel_poet.get_selected()
     id_poet = model.get_value(i,0)
     if id_poet != 0:
         nm = self.nm_poet.get_text().decode('utf8')
         lak = self.lak_poet.get_text().decode('utf8')
         if nm == lak == '': daw_customs.erro(self.parent, 'ضع أسما للشاعر'); return
         if nm == '': nm += lak
         elif lak == '': lak += nm
         age = daw_customs.value_active(self.ages)
         if age == None : daw_customs.erro(self.parent, 'حدد عصر الشاعر\nأو اجعله غير معروف'); return
         balad = daw_customs.value_active(self.lands)
         if self.lands.get_sensitive():
             if balad == None : daw_customs.erro(self.parent, 'حدد بلد الشاعر\nأو اجعله غير معروف'); return
         else: balad = 22
         sex = daw_customs.value_active(self.sexs)
         if sex == None : daw_customs.erro(self.parent, 'حدد جنس الشاعر'); return
         die = self.dh_poet.get_value()
         tarjama = self.view_tarjama_bfr.get_text(self.view_tarjama_bfr.get_start_iter(),
                                                  self.view_tarjama_bfr.get_end_iter(), False).decode('utf8')
         msg = daw_customs.sure(self.parent, '''
             هل أنت متأكد بأنك 
             تريد تعديل بيانات الشاعر ؟
             ''' )
         if msg == Gtk.ResponseType.NO:
             return
         check = self.parent.db.modify_poet(id_poet, nm, lak, tarjama, die, sex, balad, age)
         if check == None: daw_customs.info(self.parent, 'تم تعديل البيانات بنجاح'); return
     else: return
예제 #2
0
파일: daw_add.py 프로젝트: RaaH/dawawin
 def add_poet(self, *a):
     if self.outsider.get_active():
         msg = daw_customs.sure(self.parent, '''
         هل أنت متأكد من أن 
         قائل هذه الأبيات غير معروف ؟
         ''' )
         if msg == Gtk.ResponseType.NO:
             return 'none', False, False, False
         else:
             return 0, 0, 22, 9
     elif self.present.get_active():
         poet, sex, balad, age = self.parent.db.id_name_poet(self.poets.get_text().decode('utf8'))
         if poet == None:
             daw_customs.erro(self.parent, 'ضع الاسم الصحيح للشاعر'); return
     elif self.nopresent.get_active():
         nm = self.nm_poet.get_text().decode('utf8')
         lak = self.lak_poet.get_text().decode('utf8')
         if nm == lak == '': daw_customs.erro(self.parent, 'ضع أسما للشاعر'); return
         if nm == '': nm += lak
         elif lak == '': lak += nm
         age = daw_customs.value_active(self.ages)
         if age == None : daw_customs.erro(self.parent, 'حدد عصر الشاعر\nأو اجعله غير معروف'); return
         balad = daw_customs.value_active(self.lands)
         if self.lands.get_sensitive():
             if balad == None : daw_customs.erro(self.parent, 'حدد بلد الشاعر\nأو اجعله غير معروف'); return
         else: balad = 22
         sex = daw_customs.value_active(self.sexs)
         if sex == None : daw_customs.erro(self.parent, 'حدد جنس الشاعر'); return
         if self.death.get_active(): die = self.dh_poet.get_value()
         else: die = 0
         tarjama = self.tarjama_bfr.get_text(self.tarjama_bfr.get_start_iter(),
                                             self.tarjama_bfr.get_end_iter(), False).decode('utf8')
         poet, sex, balad, age = self.parent.db.add_poet(nm, lak, tarjama, die, sex, balad, age)
     return poet, sex, balad, age
예제 #3
0
파일: daw_filter.py 프로젝트: RaaH/dawawin
 def change_filter(self, *a):
     age = daw_customs.value_active(self.ages)
     balad = daw_customs.value_active(self.lands)
     sex = daw_customs.value_active(self.sexs)
     baher = daw_customs.value_active(self.baher)
     rawi = daw_customs.value_active(self.rawi)
     kafia = daw_customs.value_active(self.kafia)
     arodh = daw_customs.value_active(self.arodh)
     naw3 = daw_customs.value_active(self.naw3)
     gharadh = daw_customs.value_active(self.gharadh)
     self.poems_id = self.parent.db.filter_poem(sex, balad, age, baher, rawi, kafia, arodh, gharadh, naw3)
     self.list_filtereds()
예제 #4
0
 def a3aridh_elbaher(self, *a):
     model = self.arodh.get_model()
     model.clear()
     baher = daw_customs.value_active(self.baher)
     if baher == None: return
     a3aridh = daw_tools.ela3aridh_in_behor[baher]
     for a in a3aridh:
         nm = daw_tools.get_name(daw_tools.ela3aridh, a)
         model.append([a, nm])
예제 #5
0
파일: daw_metrics.py 프로젝트: RaaH/dawawin
 def change_takiir(self, *a):
     takiir= daw_customs.value_active(self.takiir)
     model = self.sabab.get_model()
     ls = []
     for a in model:
         ls.append(a)
     idx = daw_tools.get_index(ls, takiir)
     if idx == None: return
     self.sabab.set_active(idx) 
     self.zihaf_info_bfr.set_text(daw_scan.Zihafat_ta3rif[takiir][1]) 
예제 #6
0
파일: daw_metrics.py 프로젝트: RaaH/dawawin
 def change_taf3ila(self, *a):
     if self.taf3ila.get_active() == -1: return
     model1 = self.takiir.get_model()
     model2 = self.sabab.get_model()
     model1.clear()
     model2.clear()
     taf3ila = daw_customs.value_active(self.taf3ila)
     for a in daw_scan.Changes[taf3ila].keys():
         if a in daw_scan.Zihafat_ta3rif.keys():
             model1.append([a, daw_scan.Changes[taf3ila][a]])
             model2.append([a, daw_scan.Zihafat_ta3rif[a][0]])
예제 #7
0
파일: daw_add.py 프로젝트: RaaH/dawawin
 def adding_one(self, *a):
     text = daw_tools.right_space(self.nasse_bfr.get_text(self.nasse_bfr.get_start_iter(),
                                                     self.nasse_bfr.get_end_iter(), False)).decode('utf8')
     if text == '': daw_customs.erro(self.parent, 'ضع القصيدة أولا'); return
     nam = self.name_poem.get_text().decode('utf8')
     if nam == '' : daw_customs.erro(self.parent, 'ضع اسما للقصيدة\nأو أول شطر منها'); return
     naw3 = daw_customs.value_active(self.naw3)
     if naw3 == None : daw_customs.erro(self.parent, 'حدد نوع القصيدة'); return
     if naw3 == 1:
         baher = daw_customs.value_active(self.baher)
         if baher == None : daw_customs.erro(self.parent, 'حدد بحر القصيدة'); return
         rawi = daw_customs.value_active(self.rawi)
         if rawi == None : daw_customs.erro(self.parent, 'حدد روي القصيدة'); return
         kafia = daw_customs.value_active(self.kafia)
         if kafia == None : daw_customs.erro(self.parent, 'حدد قافية القصيدة'); return
         arodh = daw_customs.value_active(self.arodh)
         if arodh == None : daw_customs.erro(self.parent, 'حدد عروض القصيدة'); return
     elif naw3 == 2:
         baher = daw_customs.value_active(self.baher)
         if baher == None : daw_customs.erro(self.parent, 'حدد بحر القصيدة'); return
         rawi = 0
         kafia = 0
         arodh = 0
     else:
         baher = 0
         rawi = 0
         kafia = 0
         arodh = 0
     gharadh = daw_customs.value_active(self.gharadh)
     if gharadh == None : daw_customs.erro(self.parent, 'حدد غرض القصيدة'); return
     poet, sex, balad, age = self.add_poet()
     if poet == 'none': return
     charh = self.charh_bfr.get_text(self.charh_bfr.get_start_iter(),
                                     self.charh_bfr.get_end_iter(), False).decode('utf8')
     sabab = self.sabab_bfr.get_text(self.sabab_bfr.get_start_iter(),
                                     self.sabab_bfr.get_end_iter(), False).decode('utf8')
     label = Gtk.Label()
     label.override_font(Pango.FontDescription('KacstOne 15'))
     if naw3 != 5:
         if daw_tools.is_machtor(text):
             longer_half, n_abiat = daw_tools.longer_half(text, label, 1)
         else:
             longer_half, n_abiat = daw_tools.longer_half(text, label, 0)
     else: 
         longer_half = 0
         n_abiat = len(text.splitlines(1))
     check = self.parent.db.add_poem(nam, text, sabab, charh, poet, sex, balad, age, 
                              n_abiat, baher, rawi, kafia, arodh, gharadh, naw3, longer_half)
     self.parent.dawawinpage.refresh_poets()
     self.parent.dawawinpage.search_cb()
     self.parent.organizepage.refresh_poets()
     self.parent.organizepage.search_cb()
     if check == None: daw_customs.info(self.parent, 'تم إضافة القصيدة بنجاح'); return
예제 #8
0
파일: daw_filter.py 프로젝트: RaaH/dawawin
 def a3aridh_elbaher(self, *a):
     #self.refresh(self.select_page, 9)
     model = self.arodh.get_model()
     model.clear()
     baher = daw_customs.value_active(self.baher)
     model.append([0, 'الكل'])
     if baher == 0:
         for a in daw_tools.ela3aridh:
             model.append(a)
         self.arodh.set_active(0)
         return
     a3aridh = daw_tools.ela3aridh_in_behor[baher]
     for a in a3aridh:
         nm = daw_tools.get_name(daw_tools.ela3aridh, a)
         model.append([a, nm])
     self.arodh.set_active(0)
예제 #9
0
 def modify_data(self, *a):
     model, i = self.sel_poem.get_selected()
     id_poem = model.get_value(i,0)
     text = daw_tools.right_space(self.view_nasse_bfr.get_text(self.view_nasse_bfr.get_start_iter(),
                                                     self.view_nasse_bfr.get_end_iter(), False)).decode('utf8')
     if text == '': daw_customs.erro(self.parent, 'لقد تم مسح القصيدة'); return
     nam = self.nm_poem.get_text().decode('utf8')
     if nam == '' : daw_customs.erro(self.parent, 'ضع اسما للقصيدة\nأو أول شطر منها'); return
     naw3 = daw_customs.value_active(self.naw3)
     if naw3 == None : daw_customs.erro(self.parent, 'حدد نوع القصيدة'); return
     if naw3 == 1:
         baher = daw_customs.value_active(self.baher)
         if baher == None : 
             if self.active_baher.get_active() == False:
                 baher = 0
             else: daw_customs.erro(self.parent, 'حدد بحر القصيدة'); return
         rawi = daw_customs.value_active(self.rawi)
         if rawi == None : 
             if self.active_rawi.get_active() == False:
                 rawi = 0
             else:  daw_customs.erro(self.parent, 'حدد روي القصيدة'); return
         kafia = daw_customs.value_active(self.kafia)
         if kafia == None : 
             if self.active_kafia.get_active() == False:
                 kafia = 0
             else:  daw_customs.erro(self.parent, 'حدد قافية القصيدة'); return
         arodh = daw_customs.value_active(self.arodh)
         if arodh == None : 
             if self.active_arodh.get_active() == False:
                 arodh = 0
             else:  daw_customs.erro(self.parent, 'حدد عروض القصيدة'); return
     elif naw3 == 2:
         baher = daw_customs.value_active(self.baher)
         if baher == None : 
             if self.active_baher.get_active() == False:
                 baher = 0
             else:  daw_customs.erro(self.parent, 'حدد بحر القصيدة'); return
         rawi = 0
         kafia = 0
         arodh = 0
     else:
         baher = 0
         rawi = 0
         kafia = 0
         arodh = 0
     gharadh = daw_customs.value_active(self.gharadh)
     if gharadh == None : 
             if self.active_gharadh.get_active() == False:
                 gharadh = 0
             else:  daw_customs.erro(self.parent, 'حدد غرض القصيدة'); return
     charh = self.view_charh_bfr.get_text(self.view_charh_bfr.get_start_iter(),
                                          self.view_charh_bfr.get_end_iter(), False).decode('utf8')
     sabab = self.view_sabab_bfr.get_text(self.view_sabab_bfr.get_start_iter(),
                                          self.view_sabab_bfr.get_end_iter(), False).decode('utf8')
     label = Gtk.Label()
     label.override_font(Pango.FontDescription('KacstOne 15'))
     if naw3 != 5:
         if arodh in [26, 27, 37, 39, 40]:
             longer_half, n_abiat = daw_tools.longer_half(text, label, 1)
         else:
             longer_half, n_abiat = daw_tools.longer_half(text, label, 0)
     else: longer_half = 0
     msg = daw_customs.sure(self.parent, '''
         هل أنت متأكد بأنك 
         تريد تعديل البيانات ؟
         ''' )
     if msg == Gtk.ResponseType.NO:
         return
     check = self.parent.db.modify_poem(id_poem, nam, text, sabab, charh, n_abiat, 
                                        baher, rawi, kafia, arodh, gharadh, naw3, longer_half)
     if check == None: daw_customs.info(self.parent, 'تم تعديل البيانات بنجاح'); return
예제 #10
0
 def select_age(self, *a):
     if daw_customs.value_active(self.ages) == 8: self.lands.set_sensitive(True)
     else:
         self.lands.set_active(-1)
         self.lands.set_sensitive(False)
예제 #11
0
파일: daw_dict.py 프로젝트: RaaH/dawawin
 def select_dict(self, *a):
     mdict = daw_customs.value_active(self.btn_dicts)
     if self.btn_letters.get_active() != -1: 
         letter = daw_customs.text_active(self.btn_letters).decode('utf-8')
         f_letter = letter[0]
         self.show_index(f_letter, mdict)
예제 #12
0
파일: daw_dict.py 프로젝트: RaaH/dawawin
 def select_letter(self, *a):
     letter = daw_customs.text_active(self.btn_letters).decode('utf-8')
     f_letter = letter[0]
     mdict = daw_customs.value_active(self.btn_dicts)
     self.show_index(f_letter, mdict)
예제 #13
0
파일: daw_dawawin.py 프로젝트: RaaH/dawawin
 def search_cb(self, *a):
     self.theword = [[self.search_poets.get_text().decode('utf8'), 
     daw_customs.value_active(self.sexs),daw_customs.value_active(self.lands),  daw_customs.value_active(self.ages)]]
     self.modelfilter.refilter()