示例#1
0
文件: daw_add.py 项目: RaaH/dawawin
    def __init__(self, parent):
        self.parent = parent
        self.list_modifieds = []
        self.size_font = int(self.parent.theme.fontch[-2:])
        Gtk.Box.__init__(self,spacing=7, orientation=Gtk.Orientation.VERTICAL)
        self.nbk = Gtk.Notebook()
        
        self.nasse = daw_customs.ViewEdit()
        self.nasse_bfr = self.nasse.get_buffer()
        self.nasse_bfr.connect('changed', self.change_text)
        self.nasse.connect_after("populate-popup", self.populate_popup)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.nasse)
        vb = Gtk.VBox(False, 0)
        hb = Gtk.HBox(False, 0)
        hb.set_border_width(3)
        lab = Gtk.Label('التشكيل :   ')
        lab.set_alignment(0,0.5)
        hb.pack_start(lab, False, False, 0)
        shadda = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'shadda.png'), 'الشدة', self.tashkeel_cb, daw_araby.SHADDA)
        hb.pack_start(shadda, False, False, 0)
        skon = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'skon.png'), 'السكون',self.tashkeel_cb, daw_araby.SUKUN)
        hb.pack_start(skon, False, False, 0)
        fatha = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'fatha.png'), 'الفتحة',self.tashkeel_cb, daw_araby.FATHA)
        hb.pack_start(fatha, False, False, 0)
        damma = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'damma.png'), 'الضمة',self.tashkeel_cb, daw_araby.DAMMA)
        hb.pack_start(damma, False, False, 0)
        kasra = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'kasra.png'), 'الكسرة',self.tashkeel_cb, daw_araby.KASRA)
        hb.pack_start(kasra, False, False, 0)
        fatha2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'fatha2.png'), 'الفتحتين',self.tashkeel_cb, daw_araby.FATHATAN)
        hb.pack_start(fatha2, False, False, 0)
        damma2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'damma2.png'), 'الضمتين',self.tashkeel_cb, daw_araby.DAMMATAN)
        hb.pack_start(damma2, False, False, 0)
        kasra2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'kasra2.png'), 'الكسرتين',self.tashkeel_cb, daw_araby.KASRATAN)
        hb.pack_start(kasra2, False, False, 0)
        
        self.replace = Gtk.ToolButton(stock_id=Gtk.STOCK_FIND_AND_REPLACE)
        hb.pack_end(self.replace, False, False, 3)
        self.replace.connect('clicked', self.replace_all)
        self.ent_replace2 = Gtk.Entry()
        self.ent_replace2.set_placeholder_text('المُستبدَل به')
        hb.pack_end(self.ent_replace2, False, False, 3)
        self.ent_replace1 = Gtk.Entry()
        self.ent_replace1.set_placeholder_text('المُستبدَل')
        hb.pack_end(self.ent_replace1, False, False, 3)
        
        self.reg_exp = Gtk.CheckButton('استعمل "re"')
        hb.pack_end(self.reg_exp, False, False, 0)
        
        self.redo = Gtk.ToolButton(stock_id=Gtk.STOCK_REDO)
        self.redo.set_sensitive(False)
        hb.pack_end(self.redo, False, False, 3)
        self.redo.connect('clicked', self.redo_text)
        
        vb.pack_start(scroll, True, True, 0)
        vb.pack_start(hb, False, False, 0)
        self.nbk.append_page(vb, Gtk.Label('نص القصيدة'))
        
        self.vb_info = Gtk.VBox(False, 6)
        self.vb_info.set_border_width(6)
        hb = Gtk.HBox(False, 7)
        la0 = Gtk.Label('اسم القصيدة')
        la0.set_alignment(0,0.5)
        hb.pack_start(la0, False, False, 0)
        self.name_poem = Gtk.Entry()
        self.name_poem.set_placeholder_text('إن لم يكن لها اسم ، اكتب صدر أول بيت بدلا من ذلك')
        hb.pack_start(self.name_poem, True, True, 0)
        self.vb_info.pack_start(hb, False, False, 0)
        
        hb, self.naw3 = daw_customs.combo(daw_tools.elnaw3, u'النوع', 0)
        self.vb_info.pack_start(hb, False, False, 0)
        self.naw3.connect('changed', self.change_naw3)
        
        hb, self.gharadh = daw_customs.combo(daw_tools.elgharadh, u'الغرض', 0)
        self.vb_info.pack_start(hb, False, False, 0)
        
        hb, self.baher = daw_customs.combo(daw_tools.elbehor, u'البحر', 0)
        self.baher.connect('changed', self.a3aridh_elbaher)
        self.vb_info.pack_start(hb, False, False, 0)
        
        hb, self.rawi = daw_customs.combo(daw_tools.elrawi, u'الروي', 0)
        self.vb_info.pack_start(hb, False, False, 0)
        
        hb, self.kafia = daw_customs.combo(daw_tools.elkawafi, u'القافية', 0)
        self.vb_info.pack_start(hb, False, False, 0)
        
        hb, self.arodh = daw_customs.combo(daw_tools.ela3aridh, u'العروض وضربها', 0)
        self.vb_info.pack_start(hb, False, False, 0)
        
        la1 = Gtk.Label('سبب النظم')
        la1.set_alignment(0,1)
        self.vb_info.pack_start(la1, False, False, 0)
        
        self.sabab = daw_customs.ViewEdit()
        self.sabab_bfr = self.sabab.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.sabab)
        self.vb_info.pack_start(scroll, True, True, 0)
        self.nbk.append_page(self.vb_info, Gtk.Label('معلومات القصيدة'))
        
        self.charh = daw_customs.ViewEdit()
        self.charh_bfr = self.charh.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.charh)
        self.nbk.append_page(scroll, Gtk.Label('شرح القصيدة'))
        
        vbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
        
        hbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
        hbox.set_border_width(6)
        self.outsider = Gtk.RadioButton.new_with_label_from_widget(None,'لا يعرف قائله')
        self.outsider.connect('toggled',self.is_poet,'1')
        hbox.pack_start(self.outsider, False, False, 0)
        vbox.pack_start(hbox, False, False, 0)
        
        hbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
        hbox.set_border_width(6)
        self.present = Gtk.RadioButton.new_with_label_from_widget(self.outsider,'موجود في قاعدة البيانات')
        self.present.connect('toggled',self.is_poet,'2')
        self.poets = Gtk.Entry()
        self.poets.set_placeholder_text('اكتب حرفا لتحصل على التكملة')
        self.poets.set_sensitive(False)
        self.completion03 = Gtk.EntryCompletion()
        self.completion03.set_model(self.parent.dawawinpage.store_poet)
        self.completion03.set_text_column(1)
        self.poets.set_completion(self.completion03)
        hbox.pack_start(self.present, False, False, 0)
        hbox.pack_start(self.poets, True, True, 0)
        vbox.pack_start(hbox, False, False, 0)
        
        hbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
        hbox.set_border_width(6)
        self.nopresent = Gtk.RadioButton.new_with_label_from_widget(self.outsider,'غير موجود في قاعدة البيانات')
        self.nopresent.connect('toggled',self.is_poet,'3')
        hbox.pack_start(self.nopresent, False, False, 0)
        vbox.pack_start(hbox, False, False, 0)
        self.grd = Gtk.Grid()
        self.grd.set_border_width(6)
        self.grd.set_column_spacing(6)
        self.grd.set_row_spacing(6)
        self.grd.set_sensitive(False)
        vbox.pack_start(self.grd, False, False, 0)
        
        self.grd.attach(Gtk.Label('الاسم المشتهر'), 1, 1, 1, 1)
        self.lak_poet = Gtk.Entry()
        self.lak_poet.set_placeholder_text('الفرزدق')
        self.grd.attach(self.lak_poet, 2, 1, 2, 1)
        
        self.grd.attach(Gtk.Label('الاسم الحقيقي'), 4, 1, 1, 1)
        self.nm_poet = Gtk.Entry()
        self.nm_poet.set_placeholder_text('همام بن غالب بن صعصعة التميمي')
        self.grd.attach(self.nm_poet, 5, 1, 4, 1)
        
        hb, self.ages = daw_customs.combo(daw_tools.age_poet, u'العصر', 0)
        self.ages.connect('changed', self.select_age)
        self.grd.attach(hb, 1, 2, 2, 1)
        
        hb, self.lands = daw_customs.combo(daw_tools.elbalad, u'البلد', 0)
        self.grd.attach(hb, 3, 2, 2, 1)
        
        hb, self.sexs = daw_customs.combo(daw_tools.sex_poet, u'الجنس', 0)
        self.grd.attach(hb, 5, 2, 2, 1)
        
        self.death = Gtk.CheckButton('الوفاة (هـ)')
        def is_dh(widget, *a):
            if self.death.get_active():
                self.dh_poet.set_sensitive(True)
            else:
                self.dh_poet.set_sensitive(False)
        self.death.connect('toggled', is_dh)
        self.grd.attach(self.death, 7, 2, 1, 1)
        adj = Gtk.Adjustment(1434, -300, 1434, 1, 5.0, 0.0)
        self.dh_poet = Gtk.SpinButton()
        self.dh_poet.set_sensitive(False)
        self.dh_poet.set_adjustment(adj)
        self.dh_poet.set_wrap(True)
        self.grd.attach(self.dh_poet, 8, 2, 1, 1)
        
        self.tarjama = daw_customs.ViewEdit()
        self.tarjama_bfr = self.tarjama.get_buffer()
        self.tarjama_bfr.set_text('ترجمة الشاعر')
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tarjama)
        vbox.pack_start(scroll, True, True, 0)
        self.tarjama.set_sensitive(False)
        self.nbk.append_page(vbox, Gtk.Label('الشاعر'))
        
        hbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
        self.accept = daw_customs.ButtonClass('إضافة القصيدة')
        self.accept.connect('clicked',self.adding)
        hbox.pack_start(self.accept, False, False, 0)
        
        self.all_poems = Gtk.CheckButton('نمط إضافة عدة قصائد')
        def all_poems_cb(widget, *a):
            if self.all_poems.get_active():
                self.vb_info.set_sensitive(False)
            else:
                self.vb_info.set_sensitive(True)
        self.all_poems.connect('toggled', all_poems_cb)
        hbox.pack_start(self.all_poems, False, False, 0)

        self.pack_start(self.nbk, True, True, 0)
        self.pack_start(hbox, False, False, 0)
        
        self.show_all()
        
示例#2
0
    def build(self,*a): 
        Gtk.Box.__init__(self,spacing=7,orientation=Gtk.Orientation.VERTICAL)
        hp1 = Gtk.HPaned()
        self.pack_start(hp1, True, True, 0)
        self.tree_poet = daw_customs.TreeClass()
        self.sel_poet = self.tree_poet.get_selection()
        cell = Gtk.CellRendererText()
        cell.set_property("wrap-mode", Pango.WrapMode.WORD_CHAR)
        cell.set_property("wrap-width", 150)
        kal = Gtk.TreeViewColumn('دواوين الشعراء', cell, text=1)
        self.tree_poet.append_column(kal)
        self.store_poet = Gtk.ListStore(int, str, int, int, int)
        self.refresh_poets()
        self.tree_poet.connect("cursor-changed", self.ok_poet)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_poet)
        scroll.set_size_request(150, -1)
        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        vb = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
        try: self.search_poets = Gtk.SearchEntry()
        except: self.search_poets = Gtk.Entry()
        self.search_poets.set_placeholder_text('بحث عن شاعر')
        self.search_poets.connect('changed', self.search_cb)
        vb.pack_start(self.search_poets, False, False, 0)
        vb.pack_start(scroll, True, True, 0)
        hp1.pack1(vb, False, False)
        
        hp2 = Gtk.HPaned()
        hp1.pack2(hp2, True, True)
        self.store_poems = Gtk.ListStore(int, str)
        self.tree_poems = daw_customs.TreeClass()
        self.tree_poems.set_model(self.store_poems)
        self.sel_poem = self.tree_poems.get_selection()
        self.tree_poems.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
        self.tree_poems.connect("cursor-changed", self.ok_poem)
        poems = Gtk.TreeViewColumn('القصائد', Gtk.CellRendererText(), text=1)
        self.tree_poems.append_column(poems)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_poems)
        scroll.set_size_request(180, -1)
        hp2.pack1(scroll, False, False)
        
        self.notebk = Gtk.Notebook()
        hp2.pack2(self.notebk, True, True)
        self.notebk.set_show_tabs(False)
        self.nbk1 = Gtk.Notebook()
        self.nbk2 = Gtk.Notebook()
        self.view_nasse  = daw_customs.ViewEdit()
        self.view_nasse.set_justification(Gtk.Justification.CENTER)
        self.view_nasse_bfr = self.view_nasse.get_buffer()
        self.view_nasse_bfr.connect('changed', self.change_text)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.view_nasse)
        vb = Gtk.VBox(False, 0)
        hb = Gtk.HBox(False, 0)
        lab = Gtk.Label('التشكيل :   ')
        lab.set_alignment(0,0.5)
        hb.pack_start(lab, False, False, 0)
        shadda = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'shadda.png'), 'الشدة', self.tashkeel_cb, daw_araby.SHADDA)
        hb.pack_start(shadda, False, False, 0)
        skon = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'skon.png'), 'السكون',self.tashkeel_cb, daw_araby.SUKUN)
        hb.pack_start(skon, False, False, 0)
        fatha = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'fatha.png'), 'الفتحة',self.tashkeel_cb, daw_araby.FATHA)
        hb.pack_start(fatha, False, False, 0)
        damma = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'damma.png'), 'الضمة',self.tashkeel_cb, daw_araby.DAMMA)
        hb.pack_start(damma, False, False, 0)
        kasra = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'kasra.png'), 'الكسرة',self.tashkeel_cb, daw_araby.KASRA)
        hb.pack_start(kasra, False, False, 0)
        fatha2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'fatha2.png'), 'الفتحتين',self.tashkeel_cb, daw_araby.FATHATAN)
        hb.pack_start(fatha2, False, False, 0)
        damma2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'damma2.png'), 'الضمتين',self.tashkeel_cb, daw_araby.DAMMATAN)
        hb.pack_start(damma2, False, False, 0)
        kasra2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'kasra2.png'), 'الكسرتين',self.tashkeel_cb, daw_araby.KASRATAN)
        hb.pack_start(kasra2, False, False, 0)
        vb.pack_start(scroll, True, True, 0)
        
        self.redo = Gtk.ToolButton(stock_id=Gtk.STOCK_REDO)
        self.redo.set_sensitive(False)
        hb.pack_end(self.redo, False, False, 3)
        self.redo.connect('clicked', self.redo_text)
        vb.pack_start(hb, False, False, 0)
        self.nbk1.append_page(vb, Gtk.Label('القصيدة'))
        
        self.view_charh = daw_customs.ViewEdit()
        self.view_charh_bfr = self.view_charh.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.view_charh)
        self.nbk1.append_page(scroll, Gtk.Label('الشرح'))
        
        vb = Gtk.VBox(False, 7)
        vb.set_border_width(7)
        hb = Gtk.HBox(False, 7)
        la0 = Gtk.Label('اسم القصيدة')
        la0.set_alignment(0,0.5)
        hb.pack_start(la0, False, False, 0)
        self.nm_poem = Gtk.Entry()
        self.nm_poem.set_placeholder_text('إن لم يكن لها اسم ، اكتب صدر أول بيت بدلا من ذلك')
        hb.pack_start(self.nm_poem, True, True, 0)
        vb.pack_start(hb, False, False, 0)
  
        hb, self.naw3 = daw_customs.combo(daw_tools.elnaw3, u'النوع', 0)
        vb.pack_start(hb, False, False, 0)
        self.naw3.connect('changed', self.change_naw3)
        
        hb, self.gharadh = daw_customs.combo(daw_tools.elgharadh, u'الغرض', 0)
        vb.pack_start(hb, False, False, 0)
        self.active_gharadh = Gtk.CheckButton('')
        self.active_gharadh.set_active(True)
        def active_gharadh_cb(widget, *a):
            if self.active_gharadh.get_active():
                self.gharadh.set_sensitive(True)
            else:
                self.gharadh.set_sensitive(False)
                self.gharadh.set_active(-1)
        self.active_gharadh.connect('toggled', active_gharadh_cb)
        hb.pack_start(self.active_gharadh, False, False, 0)

        self.baher_hb, self.baher = daw_customs.combo(daw_tools.elbehor, u'البحر', 0)
        self.baher.connect('changed', self.a3aridh_elbaher)
        vb.pack_start(self.baher_hb, False, False, 0)
        self.active_baher = Gtk.CheckButton('')
        self.active_baher.set_active(True)
        def active_baher_cb(widget, *a):
            if self.active_baher.get_active():
                self.baher.set_sensitive(True)
            else:
                self.baher.set_sensitive(False)
                self.baher.set_active(-1)
        self.active_baher.connect('toggled', active_baher_cb)
        self.baher_hb.pack_start(self.active_baher, False, False, 0)
        
        self.rawi_hb, self.rawi = daw_customs.combo(daw_tools.elrawi, u'الروي', 0)
        vb.pack_start(self.rawi_hb, False, False, 0)
        self.active_rawi = Gtk.CheckButton('')
        self.active_rawi.set_active(True)
        def active_rawi_cb(widget, *a):
            if self.active_rawi.get_active():
                self.rawi.set_sensitive(True)
            else:
                self.rawi.set_sensitive(False)
                self.rawi.set_active(-1)
        self.active_rawi.connect('toggled', active_rawi_cb)
        self.rawi_hb.pack_start(self.active_rawi, False, False, 0)
        
        self.kafia_hb, self.kafia = daw_customs.combo(daw_tools.elkawafi, u'القافية', 0)
        vb.pack_start(self.kafia_hb, False, False, 0)
        self.active_kafia = Gtk.CheckButton('')
        self.active_kafia.set_active(True)
        def active_kafia_cb(widget, *a):
            if self.active_kafia.get_active():
                self.kafia.set_sensitive(True)
            else:
                self.kafia.set_sensitive(False)
                self.kafia.set_active(-1)
        self.active_kafia.connect('toggled', active_kafia_cb)
        self.kafia_hb.pack_start(self.active_kafia, False, False, 0)
        
        self.arodh_hb, self.arodh = daw_customs.combo([], u'العروض وضربها', 0)
        vb.pack_start(self.arodh_hb, False, False, 0)
        self.active_arodh = Gtk.CheckButton('')
        self.active_arodh.set_active(True)
        def active_arodh_cb(widget, *a):
            if self.active_arodh.get_active():
                self.arodh.set_sensitive(True)
            else:
                self.arodh.set_sensitive(False)
                self.arodh.set_active(-1)
        self.active_arodh.connect('toggled', active_arodh_cb)
        self.arodh_hb.pack_start(self.active_arodh, False, False, 0)
        
        la1 = Gtk.Label('سبب النظم')
        la1.set_alignment(0,1)
        vb.pack_start(la1, False, False, 0)
        self.view_sabab = daw_customs.ViewEdit()
        self.view_sabab_bfr = self.view_sabab.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.view_sabab)
        vb.pack_start(scroll, True, True, 0)
        self.nbk1.append_page(vb, Gtk.Label('معلوماتها'))
        
        self.view_tarjama = daw_customs.ViewEdit()
        self.view_tarjama_bfr = self.view_tarjama.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.view_tarjama)
        self.nbk2.append_page(scroll, Gtk.Label('الترجمة'))
        
        self.grid_poet = Gtk.Grid()
        self.grid_poet.set_column_spacing(6)
        self.grid_poet.set_row_spacing(6)
        self.grid_poet.set_border_width(6)

        self.grid_poet.attach(Gtk.Label('الاسم المشتهر'), 1, 1, 1, 1)
        self.lak_poet = Gtk.Entry()
        self.grid_poet.attach(self.lak_poet, 2, 1, 3, 1)
        
        self.grid_poet.attach(Gtk.Label('الاسم الحقيقي'), 1, 2, 1, 1)
        self.nm_poet = Gtk.Entry()
        self.grid_poet.attach(self.nm_poet, 2, 2, 3, 1)
        
        hb, self.ages = daw_customs.combo(daw_tools.age_poet, u'العصر', 0)
        self.ages.connect('changed', self.select_age)
        self.grid_poet.attach(hb, 1, 3, 4, 1)
        
        hb, self.lands = daw_customs.combo(daw_tools.elbalad, u'البلد', 0)
        self.grid_poet.attach(hb, 1, 4, 4, 1)
        
        hb, self.sexs = daw_customs.combo(daw_tools.sex_poet, u'الجنس', 0)
        self.grid_poet.attach(hb, 1, 5, 4, 1)
        
        self.grid_poet.attach(Gtk.Label('الوفاة (هـ)'), 1, 6, 1, 1)
        adj = Gtk.Adjustment(1434, -300, 1434, 1, 5.0, 0.0)
        self.dh_poet = Gtk.SpinButton()
        self.dh_poet.set_adjustment(adj)
        self.dh_poet.set_wrap(True)
        self.grid_poet.attach(self.dh_poet, 2, 6, 1, 1)
        self.nbk2.append_page(self.grid_poet, Gtk.Label('معلومات الشاعر'))
        
        vb = Gtk.VBox(False, 7)
        vb.set_border_width(7)
        hb = Gtk.HBox(False, 7)
        move_poem = daw_customs.ButtonClass('نقل القصيدة الحالية إلى ديوان : ')
        move_poem.connect('clicked', self.move_poem_cb)
        hb.pack_start(move_poem, False, False, 0)
        self.poets_entry = Gtk.Entry()
        self.poets_entry.set_placeholder_text('اكتب حرفا لتحصل على التكملة')
        self.completion03 = Gtk.EntryCompletion()
        self.completion03.set_model(self.parent.dawawinpage.store_poet)
        self.completion03.set_text_column(1)
        self.poets_entry.set_completion(self.completion03)
        hb.pack_start(self.poets_entry, True, True, 0)
        vb.pack_start(hb, False, False, 0)
        
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.del_poem = daw_customs.ButtonClass('حذف قصيدة')
        self.del_poem.connect('clicked',self.remove_poem)
        hbox.pack_start(self.del_poem, False, False, 0)
        vb.pack_start(hbox, False, False, 0)
        self.nbk1.append_page(vb, Gtk.Label('متقدم'))
        
        vb = Gtk.VBox(False, 7)
        vb.set_border_width(7)
        hb = Gtk.HBox(False, 7)
        merge_poet = daw_customs.ButtonClass('دمج الشاعر الحالي مع الشاعر : ')
        merge_poet.connect('clicked', self.merge_poet_cb)
        hb.pack_start(merge_poet, False, False, 0)
        self.poets_entry1 = Gtk.Entry()
        self.poets_entry1.set_placeholder_text('اكتب حرفا لتحصل على التكملة')
        self.completion04 = Gtk.EntryCompletion()
        self.completion04.set_model(self.parent.dawawinpage.store_poet)
        self.completion04.set_text_column(1)
        self.poets_entry1.set_completion(self.completion04)
        hb.pack_start(self.poets_entry1, True, True, 0)
        vb.pack_start(hb, False, False, 0)
        
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.del_poet = daw_customs.ButtonClass('حذف ديوان')
        self.del_poet.connect('clicked',self.remove_poet)
        hbox.pack_start(self.del_poet, False, False, 0)
        vb.pack_start(hbox, False, False, 0)
        self.nbk2.append_page(vb, Gtk.Label('متقدم'))
        
        vb = Gtk.VBox(False, 7)
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.modif_poet = daw_customs.ButtonClass('تعديل الشاعر')
        self.modif_poet.connect('clicked',self.modify_poet_cb)
        vb.pack_start(self.nbk2, True, True, 0)
        vb.pack_start(hbox, False, False, 0)
        hbox.pack_start(self.modif_poet, False, False, 0)
        self.notebk.append_page(vb, Gtk.Label(''))
        
        vb = Gtk.VBox(False, 7)
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.modif_poem = daw_customs.ButtonClass('تعديل القصائد')
        self.modif_poem.connect('clicked',self.modify_data)
        vb.pack_start(self.nbk1, True, True, 0)
        vb.pack_start(hbox, False, False, 0)
        hbox.pack_start(self.modif_poem, False, False, 0)
        self.notebk.append_page(vb, Gtk.Label(''))

        self.show_all()
        
示例#3
0
文件: daw_dict.py 项目: RaaH/dawawin
 def __init__(self, parent):
     self.parent = parent
     self.mydict = DictDB()
     self.size_font = int(self.parent.theme.fontch[-2:])
     self.all_term = []
     Gtk.VBox.__init__(self, False, 7)
     self.hb = Gtk.HBox(False, 7)
     self.tree_dict = daw_customs.TreeClass()
     self.sel_dict = self.tree_dict.get_selection()
     cell = Gtk.CellRendererText()
     kal = Gtk.TreeViewColumn('الجذور المحتملة', cell, text=0)
     self.tree_dict.append_column(kal)
     self.store_dict = Gtk.TreeStore(str, str)
     self.tree_dict.set_model(self.store_dict)
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(self.tree_dict)
     self.tree_dict.connect("cursor-changed", lambda *a: self.search_on_page(u""))
     scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
     self.hb.pack_start(scroll, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     letters = [ 
         [1, u"ألف"], 
         [2, u"باء"], 
         [3, u'تاء' ], 
         [4, u'ثاء' ],
         [5, u'جيم' ], 
         [6, u'حاء' ], 
         [7, u'خاء' ], 
         [8, u'دال' ], 
         [9, u'ذال' ],
         [10, u'راء' ], 
         [11, u'زاي' ], 
         [12, u'سين' ], 
         [13, u'شين' ], 
         [14, u'صاد' ],
         [15, u'ضاد' ], 
         [16, u'طاء' ], 
         [17, u'ظاء' ], 
         [18, u'عين' ], 
         [19, u'غين' ],
         [20, u'فاء' ], 
         [21, u'قاف' ], 
         [22, u'كاف' ], 
         [23, u'لام' ], 
         [24, u'ميم' ],
         [25, u'نون' ], 
         [26, u'هاء' ], 
         [27, u'واو' ], 
         [28, u'ياء' ],
         ]
     hb, self.btn_letters = daw_customs.combo(letters, u'الحرف', 2)
     self.btn_letters.connect('changed', self.select_letter)
     hbox.pack_start(hb, False, False, 0)
     dicts = [
              [1, 'لسان العرب'], 
              [2, 'تاج العروس'], 
              [3, 'أساس البلاغة'], 
              [4, 'مختار الصحاح'] 
              ]
     hb, self.btn_dicts = daw_customs.combo(dicts, u'المعجم', 1)
     self.btn_dicts.connect('changed', self.select_dict)
     hbox.pack_start(hb, False, False, 0)
     self.btn_search = daw_customs.ButtonClass('بحث')
     try: self.entry_search = Gtk.SearchEntry()
     except: self.entry_search = Gtk.Entry()
     self.entry_search.set_placeholder_text('أدخل نصا للبحث عنه')
     self.entry_search.connect("activate", self.search) 
     #self.entry_search.connect("key-release-event", self.search_on_page) 
     self.btn_search.connect('clicked', self.search)
     hbox.pack_end(self.entry_search, False, False, 0)
     hbox.pack_end(self.btn_search, False, False, 0)
     self.pack_start(hbox, False, False, 0)
     
     self.view_dict = daw_customs.ViewClass()
     self.view_dict_bfr = self.view_dict.get_buffer()
     self.search_tag = self.view_dict_bfr.create_tag("search")
     self.search_tag.set_property('background', self.parent.theme.colorss) 
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(self.view_dict)
     self.hb.pack_start(scroll, True, True, 0)
     self.pack_start(self.hb, True, True, 0)
     
     self.show_all()
示例#4
0
 def __init__(self, parent):
     self.parent = parent
     self.poems_id = self.parent.db.all_poems_id()
     Gtk.HBox.__init__(self, False, 7)
     self.vbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
     self.vbox.set_border_width(6)
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add_with_viewport(self.vbox)
     scroll.set_size_request(220, -1)
     self.pack_start(scroll, False, False, 0)
     vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     
     lab = Gtk.Label('\nالتصفية بحسب :\n')
     lab.set_alignment(0,0.5)
     self.vbox.pack_start(lab, False, False, 0)
     
     hb, self.ages = daw_customs.combo(daw_tools.age_poet, u'العصر', 1)
     self.ages.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.lands = daw_customs.combo(daw_tools.elbalad, u'البلد', 1)
     self.lands.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.sexs = daw_customs.combo(daw_tools.sex_poet, u'الجنس', 1)
     self.sexs.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.baher = daw_customs.combo(daw_tools.elbehor, u'البحر', 1)
     self.baher.connect('changed', self.a3aridh_elbaher)
     self.baher.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.rawi = daw_customs.combo(daw_tools.elrawi, u'الروي', 1)
     self.rawi.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.kafia = daw_customs.combo(daw_tools.elkawafi, u'القافية', 1)
     self.kafia.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.arodh = daw_customs.combo(daw_tools.ela3aridh, u'العروض', 1)
     self.arodh.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.naw3 = daw_customs.combo(daw_tools.elnaw3, u'النوع', 1)
     self.naw3.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     hb, self.gharadh = daw_customs.combo(daw_tools.elgharadh, u'الغرض', 1)
     self.gharadh.connect('changed', self.change_filter)
     self.vbox.pack_start(hb, False, False, 0)
     
     self.poems_store = Gtk.ListStore(int,str,str,str,str,str,str,int)
     self.tree_poems = daw_customs.TreePoem()
     self.tree_poems.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
     self.tree_poems.connect("button-press-event", self.on_button_press)
     poems = Gtk.TreeViewColumn('القصيدة', Gtk.CellRendererText(), text=1)
     self.tree_poems.append_column(poems)
     poems.set_max_width(300)
     poets = Gtk.TreeViewColumn('الشاعر', Gtk.CellRendererText(), text=2)
     self.tree_poems.append_column(poets)
     poets.set_max_width(300)
     elnaw3 = Gtk.TreeViewColumn('النوع', Gtk.CellRendererText(), text=3)
     self.tree_poems.append_column(elnaw3)
     elnaw3.set_max_width(100)
     elbaher = Gtk.TreeViewColumn('البحر', Gtk.CellRendererText(), text=4)
     self.tree_poems.append_column(elbaher)
     elbaher.set_max_width(120)
     elgharadh = Gtk.TreeViewColumn('الغرض', Gtk.CellRendererText(), text=5)
     self.tree_poems.append_column(elgharadh)
     elgharadh.set_max_width(80)
     elrawi = Gtk.TreeViewColumn('الروي', Gtk.CellRendererText(), text=6)
     self.tree_poems.append_column(elrawi)
     elrawi.set_max_width(50)
     verses = Gtk.TreeViewColumn('عدد الأبيات', Gtk.CellRendererText(), text=7)
     self.tree_poems.append_column(verses)
     verses.set_max_width(50)
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(self.tree_poems)
     if len(self.parent.db.all_poems_id()) == 0: v = 0
     else: v = (len(self.parent.db.all_poems_id())/50)+1
     self.load_poems(0)
     self.btns_pages = Gtk.HBox(False, 3)
     self.refresh(v)
     self.btns_pages.set_border_width(2)
     vbox2.pack_start(self.btns_pages, False, False, 0)
     vbox2.pack_start(scroll, True, True, 0)
     self.pack_start(vbox2, True, True, 0)
     self.show_all()
     
     #--- Popup menu
     self.popup = Gtk.Menu()
     show_poem = Gtk.ImageMenuItem('اعرض القصيدة')
     show_poem.connect('activate', self.show_poem_cb)
     self.popup.append(show_poem)
     
     modify_poem = Gtk.ImageMenuItem('عدّل القصيدة')
     modify_poem.connect('activate', self.modify_poem_cb)
     self.popup.append(modify_poem)
     self.popup.show_all()
     
示例#5
0
 def build(self,*a):
     Gtk.Dialog.__init__(self, parent=self.parent)
     self.set_icon_name("Dawawin")
     self.set_title("التفضيلات")
     self.resize(500, 300)
     area = self.get_content_area()
     area.set_spacing(6)
     self.connect('delete-event', lambda w,*a: w.hide() or True)
     self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     lab_info = Gtk.Label('بعض الخيارات قد تحتاج إلى إعادة تشغيل البرنامج')
     lab_info.override_background_color(Gtk.StateFlags.NORMAL, daw_customs.rgba('#FFF14E'))
     lab_info.override_color(Gtk.StateFlags.NORMAL, daw_customs.rgba('#E90003'))
     lab_info.override_font(Pango.FontDescription("8"))
     
     self.notebook = Gtk.Notebook()
     self.box0 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     self.box00 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
     self.box1 = Gtk.Box(spacing=4, orientation=Gtk.Orientation.VERTICAL)
     self.box2 = Gtk.Box(spacing=4,orientation=Gtk.Orientation.VERTICAL)
     hbox = Gtk.Box(spacing=40,orientation=Gtk.Orientation.HORIZONTAL)
     hbox.pack_start(self.box1, False, False, 0)
     hbox.pack_start(self.box2, False, False, 0)
     self.frame = Gtk.Frame()
     self.frame.add(hbox)
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.dfo = Gtk.RadioButton.new_with_label_from_widget(None, 'افتراضي')
     self.cos = Gtk.RadioButton.new_with_label_from_widget(self.dfo,'مخصص')
     self.dfo.connect('toggled',self.specified,'0')
     self.cos.connect('toggled',self.specified,'1')
     hbox.pack_start(self.dfo, False, False, 0)
     hbox.pack_start(self.cos, False, False, 0)
     self.sel_theme = Gtk.CheckButton('تلوين النافذة')
     hbox.pack_end(self.sel_theme, False, False, 0)
     if daw_config.getv('theme') == '1': self.sel_theme.set_active(True)
     else: self.sel_theme.set_active(False)
     self.sel_theme.connect("toggled", self.has_mytheme)
     hbox.set_border_width(5)
     self.box0.pack_start(hbox, False, False, 0)
     self.box0.pack_start(self.frame, True, True, 0)
    
     list_w1 = [[u'القوائم الجانبية','td'], [u'قائمة القصائد','tp'], [u'متن القصيدة','mp'], 
                [u'الشرح والترجمة','ch'], [u'العناوين','an']]
     list_w2 = [[u'لون خلفية العرض','b'], [u'لون خط التحديد','fs'], [u'لون خلفية التحديد','bs'], 
                [u'لون تحديد البحث','ss'], [u'لون خلفية خاص','bp']]
     for a in list_w1:
         hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
         btn1 = Gtk.ToolButton(stock_id = Gtk.STOCK_SELECT_FONT)
         btn1.set_name('font'+a[1])
         btn1.connect('clicked',self.ch_font)
         btn2 = Gtk.ToolButton(stock_id = Gtk.STOCK_SELECT_COLOR)
         btn2.set_name('color'+a[1])
         btn2.connect('clicked',self.ch_color)
         hbox.pack_start(btn2, False, False, 0)
         hbox.pack_start(btn1, False, False, 0)
         hbox.pack_start(Gtk.Label(a[0]), False, False, 0)
         self.box1.pack_start(hbox, False, False, 0)
         
     for a in list_w2:
         hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
         btn = Gtk.ToolButton(stock_id = Gtk.STOCK_SELECT_COLOR)
         btn.set_name('color'+a[1])
         btn.connect('clicked',self.ch_color)
         hbox.pack_start(btn, False, False, 0)
         hbox.pack_start(Gtk.Label(a[0]), False, False, 0)
         self.box2.pack_start(hbox, False, False, 0)
     self.notebook.append_page(self.box0, Gtk.Label('خط ولون'))
     
     vb = Gtk.VBox(False, 6)
     vb.set_border_width(6)
     ls = [[0, u'ضيق'],
         [1, u'وسط'],
         [2, u'واسع']]
     hb, self.bayn_abiat = daw_customs.combo(ls, u'المسافة بين الأبيات', 3)
     self.bayn_abiat.set_active(daw_config.getn('b_abiat'))
     self.bayn_abiat.connect('changed', self.change_vls, u'b_abiat')
     vb.pack_start(hb, False, False, 0)
     
     ls = [[0, u'ضيق'],
         [1, u'وسط'],
         [2, u'واسع']]
     hb, self.bayn_shater = daw_customs.combo(ls, u'المسافة بين شطري البيت', 3)
     self.bayn_shater.set_active(daw_config.getn('b_half'))
     self.bayn_shater.connect('changed', self.change_vls, u'b_half')
     vb.pack_start(hb, False, False, 0)
     
     ls = [[0, u'دوما'],
         [1, u'للحاجة']]
     hb, self.tarakeb = daw_customs.combo(ls, u'تراكب شطري البيت', 3)
     self.tarakeb.set_active(daw_config.getn('tarakeb'))
     self.tarakeb.connect('changed', self.change_vls, u'tarakeb')
     vb.pack_start(hb, False, False, 0)
     
     ls = [[0, u'بالتطويلات'],
         [1, u'بالمسافات']]
     hb, self.tandhid = daw_customs.combo(ls, u'تعديل طول الشطر', 3)
     self.tandhid.set_active(daw_config.getn('tandhid'))
     self.tandhid.connect('changed', self.change_vls, u'tandhid')
     vb.pack_start(hb, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     lab = Gtk.Label('أدنى طول للشطر بالبكسلات')
     lab.set_alignment(0,0.5)
     hbox.pack_start(lab, False, False, 0)
     adj = Gtk.Adjustment(150, 100, 700, 1, 5, 0)
     self.min_long = Gtk.SpinButton()
     self.min_long.set_adjustment(adj)
     self.min_long.set_wrap(True)
     self.min_long.set_value(daw_config.getf('min_long'))
     def change_min(widget, *a):
         v = self.min_long.get_value()
         daw_config.setv('min_long', v)
     self.min_long.connect('value-changed', change_min)
     hbox.pack_start(self.min_long, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     lab = Gtk.Label('التراكب إذا تجاوز طول الشطر')
     lab.set_alignment(0,0.5)
     hbox.pack_start(lab, False, False, 0)
     adj = Gtk.Adjustment(350, 300, 1000, 1, 5, 0)
     self.max_long = Gtk.SpinButton()
     self.max_long.set_adjustment(adj)
     self.max_long.set_wrap(True)
     self.max_long.set_value(daw_config.getf('max_long'))
     def change_max(widget, *a):
         v = self.max_long.get_value()
         daw_config.setv('max_long', v)
     self.max_long.connect('value-changed', change_max)
     hbox.pack_start(self.max_long, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('تخطيط'))
     
     vb = Gtk.VBox(False, 6)
     vb.set_border_width(6)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.del_all = daw_customs.ButtonClass('مسح عام')
     self.del_all.connect('clicked', self.del_all_cb)
     hbox.pack_start(self.del_all, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.add_db = daw_customs.ButtonClass('أنشاء قاعدة بيانات جديدة')
     self.add_db.connect('clicked', self.new_db)
     hbox.pack_start(self.add_db, False, False, 0)
     if not exists(dirname(daw_config.getv('path'))): self.add_db.set_sensitive(False)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
     self.e_dest = Gtk.Entry()
     self.e_dest.set_text(daw_config.getv('path').decode('utf8'))
     self.b_dest = daw_customs.ButtonClass('تغيير المسار')
     self.b_dest.connect('clicked', self.change_path_db)  
     hbox.pack_start(self.b_dest, False, False, 0)
     hbox.pack_start(self.e_dest, True, True, 0)
     vb.pack_start(hbox, False, False, 0)
     
     hbox = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
     db_void = Gtk.LinkButton.new_with_label("http://sourceforge.net/projects/dawawin/files/",
                                             'صفحة البرنامج على النت')
     hbox.pack_start(db_void, False, False, 0)
     vb.pack_start(hbox, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('خيارات'))
     
     vb = Gtk.VBox(False, 6)
     vb.set_border_width(6)
     self.n_dawawin = Gtk.Label('عدد الدواوين : '+daw_config.getv('n_dawawin'))
     self.n_dawawin.set_alignment(0,0.5)
     vb.pack_start(self.n_dawawin, False, False, 0)
     self.n_poems = Gtk.Label('عدد القصائد : '+daw_config.getv('n_poems'))
     self.n_poems.set_alignment(0,0.5)
     vb.pack_start(self.n_poems, False, False, 0)
     self.n_verses = Gtk.Label('عدد الأبيات : '+daw_config.getv('n_verses'))
     self.n_verses.set_alignment(0,0.5)
     vb.pack_start(self.n_verses, False, False, 0)
     hbox = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
     self.rapid_count = daw_customs.ButtonClass('إحصاء سريع')
     self.rapid_count.connect('clicked', self.count_cb)
     self.detail_count = daw_customs.ButtonClass('إحصاء مفصل')
     self.detail_count.connect('clicked', self.show_count)
     self.web_count = daw_customs.ButtonClass('صفحة ويب')
     self.web_count.connect('clicked', lambda *a: self.parent.countpage.make_html())
     hbox.pack_start(self.rapid_count, False, False, 0)
     hbox.pack_start(self.detail_count, False, False, 0)
     hbox.pack_start(self.web_count, False, False, 0)
     vb.pack_end(hbox, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('إحصاء'))
     
     vbox = Gtk.Box(spacing=4, orientation=Gtk.Orientation.VERTICAL)
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     self.sel_ornament = Gtk.CheckButton('اعتمد زخرفة الخلفية')
     hbox.pack_start(self.sel_ornament, False, False, 0)
     if daw_config.getv('ornament') == '1': self.sel_ornament.set_active(True)
     else: self.sel_ornament.set_active(False)
     self.sel_ornament.connect("toggled", self.has_ornament)
     vbox.pack_start(hbox, False, False, 0)
     
     liststore = Gtk.ListStore(Pixbuf, str)
     iconview = Gtk.IconView.new()
     iconview.set_model(liststore)
     iconview.set_pixbuf_column(0)
     iconview.set_reorderable(True)
     list_icons = os.listdir(daw_customs.ORNAMENT)
     iconview.set_columns(6)
     iconview.connect('item-activated', self.sel_ORNAMENT)
     for a in list_icons:
         try:
             pixbuf = Pixbuf.new_from_file_at_size(join(daw_customs.ORNAMENT, a), 64, 64 )
             liststore.append([pixbuf, a])
         except: pass
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(iconview)
     scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
     vbox.pack_start(scroll, True, True, 0)
     self.notebook.append_page(vbox, Gtk.Label('الزخرفة'))
     
     self.box.pack_start(self.notebook, True, True, 0)
     self.box.pack_start(lab_info, False, False, 0)
     
     clo = daw_customs.ButtonClass("إغلاق")
     clo.connect('clicked',lambda *a: self.hide())
     ref = daw_customs.ButtonClass("تحديث الواجهة")
     ref.connect('clicked',lambda *a: self.parent.theme.refrech())
     ref.connect('clicked',lambda *a: self.parent.refrech())
     hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
     hbox.set_border_width(5)
     hbox.pack_start(ref, False, False, 0)
     hbox.pack_end(clo, False, False, 0)
     self.box.pack_start(hbox, False, False, 0)
     if daw_config.getv('tr') == '1':
         self.cos.set_active(True)
     else:
         self.frame.set_sensitive(False)
         self.dfo.set_active(True)
     area.pack_start(self.box, True, True, 0)
示例#6
0
    def __init__(self, parent):
        self.parent = parent
        self.db = MyDB()
        self.size_font = int(self.parent.theme.fontch[-2:])
        Gtk.HPaned.__init__(self)
        
        self.vbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
        
        hb, self.ages = daw_customs.combo(daw_tools.age_poet, u'العصر', 1)
        self.vbox.pack_start(hb, False, False, 0)
        self.ages.connect('changed', self.search_cb)
        self.ages.connect('changed', self.select_age)
        
        hb, self.lands = daw_customs.combo(daw_tools.elbalad, u'البلد', 1)
        self.lands.set_sensitive(False)
        self.vbox.pack_start(hb, False, False, 0)
        self.lands.connect('changed', self.search_cb)
        
        hb, self.sexs = daw_customs.combo(daw_tools.sex_poet, u'الجنس', 1)
        self.vbox.pack_start(hb, False, False, 0)
        self.sexs.connect('changed', self.search_cb)
        
        try: self.search_poets = Gtk.SearchEntry()
        except: self.search_poets = Gtk.Entry()
        self.search_poets.set_placeholder_text('بحث عن شاعر')
        self.search_poets.connect('changed', self.search_cb)
        hbox = Gtk.HBox(False, 2)
#        self.btn_refresh = Gtk.ToolButton(Gtk.STOCK_REFRESH)
#        self.btn_refresh.set_tooltip_text('تحديث قائمة الدواوين')
#        self.btn_refresh.connect('clicked', self.refresh_poets)
#        hbox.pack_start(self.btn_refresh, False, False, 0)
        hbox.pack_start(self.search_poets, True, True, 0)
        self.vbox.pack_start(hbox, False, False, 0)
        
        self.tree_poet = daw_customs.TreeClass()
        cell = Gtk.CellRendererText()
        cell.set_property("wrap-mode", Pango.WrapMode.WORD_CHAR)
        cell.set_property("wrap-width", 200)
        kal = Gtk.TreeViewColumn('دواوين الشعراء', cell, text=1)
        self.tree_poet.append_column(kal)
        self.store_poet = Gtk.ListStore(int, str, int, int, int)
        self.refresh_poets()
#        self.store_poet.clear()
#        ls = self.db.all_poets()
#        ls.append([0, u'ما لا يعرف قائله', 0, 22, 9])
#        self.names_list = []
#        for a in ls:
#            s_list = []
#            self.store_poet.append(a)
#            s_list.append(a[1])
#            s_list.append(a[2])
#            s_list.append(a[3])
#            s_list.append(a[4])
#            self.names_list.append(s_list)
#        self.theword = self.names_list[:]
#        self.modelfilter.set_visible_func(self.visible_cb, self.theword) 
#        self.tree_poet.set_model(self.modelfilter)
        self.sel_poet = self.tree_poet.get_selection()
        self.tree_poet.connect("cursor-changed", self.ok_poet)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_poet)
        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.vbox.pack_start(scroll, True, True, 0)
        #self.tree_poet.scroll_to_cell(0, kal, False, 1.0, 1.0)
        
        vbox2 = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        self.tarjama = daw_customs.ViewClass()
        self.tarjama_bfr = self.tarjama.get_buffer()
        self.tarjama_tag = self.tarjama_bfr.create_tag("title")
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tarjama)
        self.notebook.append_page(scroll, Gtk.Label("الترجمة"))
        self.notebook.set_current_page(-1)
        
        self.poems_store = Gtk.ListStore(int,int,str,str,str,str,str,int)
        
        self.tree_poems = daw_customs.TreePoem()
        
        vbox = Gtk.VBox(False, 2)
        self.lab_count = Gtk.Label('  .:   :.    عدد القصائد :   ، عدد الأبيات :  ')
        self.lab_count.set_alignment(0, 0.5)
        vbox.pack_start(self.lab_count, False, False, 0)
        self.tree_poems.set_grid_lines(Gtk.TreeViewGridLines.HORIZONTAL)
        self.tree_poems.connect("button-press-event", self.on_button_press)
        raq = Gtk.TreeViewColumn('الرقم', Gtk.CellRendererText(), text=1)
        raq.set_max_width(30)
        self.tree_poems.append_column(raq)
        poems = Gtk.TreeViewColumn('القصيدة', Gtk.CellRendererText(), text=2)
        self.tree_poems.append_column(poems)
        poems.set_max_width(300)
        elnaw3 = Gtk.TreeViewColumn('النوع', Gtk.CellRendererText(), text=3)
        self.tree_poems.append_column(elnaw3)
        elnaw3.set_max_width(100)
        elbaher = Gtk.TreeViewColumn('البحر', Gtk.CellRendererText(), text=4)
        self.tree_poems.append_column(elbaher)
        elbaher.set_max_width(120)
        elgharadh = Gtk.TreeViewColumn('الغرض', Gtk.CellRendererText(), text=5)
        self.tree_poems.append_column(elgharadh)
        elgharadh.set_max_width(80)
        elrawi = Gtk.TreeViewColumn('الروي', Gtk.CellRendererText(), text=6)
        self.tree_poems.append_column(elrawi)
        elrawi.set_max_width(50)
        verses = Gtk.TreeViewColumn('عدد الأبيات', Gtk.CellRendererText(), text=7)
        self.tree_poems.append_column(verses)
        verses.set_max_width(50)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_poems)
        vbox.pack_start(scroll, True, True, 0)
        self.notebook.append_page(vbox, Gtk.Label("القصائد"))
        self.notebook.set_current_page(-1)
        
        def switch(widget, *a):
            n = self.notebook.get_current_page()
            daw_config.setv('open', n)
        self.notebook.connect('set-focus-child', switch)
        
        vbox2.pack_start(self.notebook, True, True, 0)
        self.pack1(self.vbox, False, False)
        self.pack2(vbox2, True, False)
        self.show_all()
        self.change_font()
        self.notebook.set_current_page(daw_config.getn('open'))
        
        #--- Popup menu
        self.popup = Gtk.Menu()
        show_poem = Gtk.ImageMenuItem('اعرض القصيدة')
        show_poem.connect('activate', self.show_poem_cb)
        self.popup.append(show_poem)
        
        modify_poem = Gtk.ImageMenuItem('عدّل القصيدة')
        modify_poem.connect('activate', self.modify_poem_cb)
        self.popup.append(modify_poem)
        self.popup.show_all()
示例#7
0
    def build(self, *a):
        
        #a صفحة تقطيع الأبيات الشعرية--------------------------------------------
        vb3 = Gtk.VBox(False, 3)
        info = '''
        - يجب تشكيل البيت شكلا تاما
        - الحرف العاري عن التشكيل يعتبر ساكنا
        - يجب حذف جميع الرموز والأعداد
        - الكتابة العروضية هي كتابة الأحرف الملفوظة
        - الحرف إن كان ملفوظا ولم يكن في الكتابة العروضية
           فهو خطأ قديكون بسبب عدم تشكيله إن كان متحركا
           أوعدم تشكيل الحرف الذي يليه إن كان ساكنا 
        - قد يشبع البرنامج ما لا يستحق الإشباع لذلك ينصح
           باختيار الإشباع يدويا وتقوم بزيادة حرف المد
           إلى ما يستحق الإشباع دون غيره
        '''
        hb = Gtk.HBox(False, 10)
        vbox = Gtk.VBox(False, 1)
        self.verse_dictation = daw_customs.ViewEdit()
        self.verse_dictation_bfr = self.verse_dictation.get_buffer()
        self.verse_dictation.override_font(Pango.FontDescription('Simplified Naskh 22'))
        self.verse_dictation.set_size_request(-1, 64)
        hb.pack_start(self.verse_dictation, True, True, 0)
        scan_btn = daw_customs.ButtonClass('تقطيع البيت')
        scan_btn.connect('clicked', self.scan_cb)
        vbox.pack_start(scan_btn, False, False, 0)
        info_btn = daw_customs.ButtonClass('إرشادات')
        info_btn.connect('clicked', lambda *a: self.view_scan_bfr.set_text(info))
        vbox.pack_start(info_btn, False, False, 0)
        hb.pack_start(vbox, False, False, 0)
        vb3.pack_start(hb, False, False, 3)
        
        hb = Gtk.HBox(False, 0)
        lab = Gtk.Label('التشكيل :   ')
        lab.set_alignment(0,0.5)
        hb.pack_start(lab, False, False, 0)
        shadda = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'shadda.png'), 'الشدة', self.tashkeel_cb, daw_araby.SHADDA)
        hb.pack_start(shadda, False, False, 0)
        skon = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'skon.png'), 'السكون',self.tashkeel_cb, daw_araby.SUKUN)
        hb.pack_start(skon, False, False, 0)
        fatha = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'fatha.png'), 'الفتحة',self.tashkeel_cb, daw_araby.FATHA)
        hb.pack_start(fatha, False, False, 0)
        damma = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'damma.png'), 'الضمة',self.tashkeel_cb, daw_araby.DAMMA)
        hb.pack_start(damma, False, False, 0)
        kasra = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'kasra.png'), 'الكسرة',self.tashkeel_cb, daw_araby.KASRA)
        hb.pack_start(kasra, False, False, 0)
        fatha2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'fatha2.png'), 'الفتحتين',self.tashkeel_cb, daw_araby.FATHATAN)
        hb.pack_start(fatha2, False, False, 0)
        damma2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'damma2.png'), 'الضمتين',self.tashkeel_cb, daw_araby.DAMMATAN)
        hb.pack_start(damma2, False, False, 0)
        kasra2 = daw_customs.tool_button(join(daw_customs.ICON_DIR, 'kasra2.png'), 'الكسرتين',self.tashkeel_cb, daw_araby.KASRATAN)
        hb.pack_start(kasra2, False, False, 0)
        
        self.ishbaa_m = Gtk.CheckButton('معالجة إشباع ميم وهاء الضمير يدويا')
        hb.pack_start(self.ishbaa_m, False, False, 15)
        vb3.pack_start(hb, False, False, 3)
        
        self.view_scan = daw_customs.ViewClass()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add_with_viewport(self.view_scan)
        self.view_scan_bfr = self.view_scan.get_buffer()
        self.view_scan_bfr.set_text(info)
        self.title_tag2 = self.view_scan_bfr.create_tag("title")
        self.title_tag2.set_property('foreground', self.parent.theme.coloran) 
        vb3.pack_start(scroll, True, True, 0)
        self.append_page(vb3, Gtk.Label("تقطيع الأبيات"))
        
        #a صفحة المقدمات العروضية--------------------------------------
        self.store_mekaddima = Gtk.ListStore(str, int)
        mekadimat = self.myhelp.titles_mekadimat()
        for a in mekadimat:
            self.store_mekaddima.append([a[1], a[0]])
        hp0 = Gtk.HPaned()
        self.tree_mekaddima = daw_customs.TreeClass()
        self.sel_mekaddima = self.tree_mekaddima.get_selection()
        cell = Gtk.CellRendererText()
        kal = Gtk.TreeViewColumn('الفهرس', cell, text=0)
        self.tree_mekaddima.append_column(kal)
        self.tree_mekaddima.set_model(self.store_mekaddima)
        scroll = Gtk.ScrolledWindow()
        scroll.set_size_request(200, -1)
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add_with_viewport(self.tree_mekaddima)
        self.tree_mekaddima.connect("cursor-changed", self.show_page_mekadimat)
        hp0.pack1(scroll, False, False)
        self.prescript = daw_customs.ViewClass()
        self.prescript_bfr = self.prescript.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.prescript)
        hp0.pack2(scroll, True, True)
        self.append_page(hp0, Gtk.Label("مقدمات مهمة"))
        
        #a صفحة البحور الشعرية--------------------------------------------
        hb1 = Gtk.Box(spacing=6,orientation=Gtk.Orientation.HORIZONTAL)
        self.tree_behor = daw_customs.TreeClass()
        self.sel_behor = self.tree_behor.get_selection()
        cell = Gtk.CellRendererText()
        kal = Gtk.TreeViewColumn('البحور', cell, text=0)
        self.tree_behor.append_column(kal)
        self.store_behor = Gtk.ListStore(str, int)
        behor = self.myhelp.titles_behor()
        for a in behor:
            self.store_behor.append([a[1], a[0]])
        self.tree_behor.set_model(self.store_behor)
        scroll = Gtk.ScrolledWindow()
        scroll.set_size_request(150, -1)
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add_with_viewport(self.tree_behor)
        self.tree_behor.connect("cursor-changed", self.show_page_behor)
        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        hb1.pack_start(scroll, False, False, 0)
        self.view_info = daw_customs.ViewClass()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add_with_viewport(self.view_info)
        self.view_info_bfr = self.view_info.get_buffer()
        hb1.pack_start(scroll, True, True, 0)
        self.append_page(hb1, Gtk.Label("بحور الشعر"))
        
        #a صفحة الزحافات والعلل--------------------------------------------
        vb4 = Gtk.VBox(False, 0)    
        hbox = Gtk.HBox(False, 12)
        ls = [] 
        for a in [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]:
            ls.append([a, daw_scan.Taf3ilat[a]])
        hb, self.taf3ila = daw_customs.combo(ls, u'التفعيلة', 0)
        hbox.pack_start(hb, False, False, 0)
        self.taf3ila.connect('changed', self.change_taf3ila)

        self.ls_takiir = [] 
        hb, self.takiir = daw_customs.combo(self.ls_takiir, u'التغيير', 0)
        hbox.pack_start(hb, False, False, 0)
        self.takiir.connect('changed', self.change_takiir)

        self.ls_sabab = [] 
        hb, self.sabab = daw_customs.combo(self.ls_sabab, u'السبب', 0)
        hbox.pack_start(hb, False, False, 0)
        self.sabab.connect('changed', self.change_sabab)
        
        self.zihaf_info = daw_customs.ViewClass()
        self.zihaf_info_bfr = self.zihaf_info.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.zihaf_info)
        vb4.pack_start(hbox, False, False, 7)
        vb4.pack_start(scroll, True, True, 0)
        self.append_page(vb4, Gtk.Label("الزحافات والعلل"))
        
        self.show_all()