예제 #1
0
 def del_history(self, *a):
     self.list_terms = []
     output = open(join(asm_path.DATA_DIR_rw, u'last-terms.pkl'), 'wb')
     pickle.dump(self.list_terms, output)
     output.close()
     self.list_ts.clear()
     asm_customs.info(self.parent, "تمّ مسح الكلمات المبحوث عنها سابقاً")
예제 #2
0
 def add_to_favory(self, *a):
     if self.notebook.get_current_page() == 1:
         n = self.viewerbook.get_current_page()
         ch = self.viewerbook.get_nth_page(n)
         check = ch.db_list.to_favorite(ch.id_book)
         if check == None: asm_customs.info(self, u'تم إضافة كتاب "{}" للمفضلة'.format(ch.nm_book,))
         self.list_books.load_fav()
예제 #3
0
 def site_in_book(self, *a):
     list_marks = eval(asm_config.getv('marks'))
     if self.notebook.get_current_page() == 1:
         n = self.viewerbook.get_current_page()
         ch =self.viewerbook.get_nth_page(n)
         list_marks.append([ch.all_in_page[1], ch.nm_book, ch.id_book])
         marks = repr(list_marks)
         asm_config.setv('marks', marks)
         asm_customs.info(self, u'تم تعليم هذا الموضع')
예제 #4
0
 def add_to_favory(self, *a):
     model, i = self.sel_book.get_selected()
     if i:
         id_book = model.get_value(i, 0)
         nm_book = model.get_value(i, 1)
         check = self.db.to_favorite(id_book)
         if check == None: 
             asm_customs.info(self.parent, u'تم إضافة كتاب "{}" للمفضلة'.format(nm_book,))
         self.parent.list_books.load_fav()
예제 #5
0
 def save_cb(self, *a):
     txt_bitaka = self.view_bitaka_bfr.get_text(self.view_bitaka_bfr.get_start_iter(),
                         self.view_bitaka_bfr.get_end_iter(), False)
     txt_info = self.view_info_bfr.get_text(self.view_info_bfr.get_start_iter(),
                         self.view_info_bfr.get_end_iter(), False)
     name = self.ent_name.get_text()
     short_name = self.ent_name_sh.get_text()
     if self.has_shorts.get_active(): is_short = 1
     else: is_short = 0
     self.db.save_info(self.book, name, short_name, txt_bitaka, txt_info, is_short)
     asm_customs.info(self.parent, 'تم حفظ المعلومات الجديدة')
예제 #6
0
 def out_tafsir(self, *a):
     model, i = self.sel_tafsir_no_added.get_selected()
     if i:
         nm = model.get_value(i, 1)
         msg = asm_customs.sure(self.parent, 'هل تريد إزالة {} من القائمة؟'.format(nm, ))
         if msg == Gtk.ResponseType.YES:
             id_tafsir = model.get_value(i, 0)
             tafsir = self.db.file_book(id_tafsir)
             self.db.out_tafsir(tafsir, id_tafsir)
             model.remove(i)
     else:
         asm_customs.info(self.parent, "يجب تعليم التفسير في قائمة التفاسير المهملة\n ليتم إزالته منها")
예제 #7
0
 def copy_to_home_cb(self, *a):
     groups = self.db.all_parts()
     for g in groups:
         if not exists(join(asm_path.BOOK_DIR_rw, g[1])):
             os.mkdir(join(asm_path.BOOK_DIR_rw, g[1]))
         books = self.db.books_part(g[0])
         for b in books:
             book_old = self.db.file_book(b[0])
             self.db.mode_write(b[0])
             book_new = self.db.file_book(b[0])
             if not exists(book_new):
                 copyfile(book_old, book_new)
     asm_customs.info(self.parent, 'تمت عملية النسخ بنجاح')
     self.copy_to_home.set_sensitive(False)
예제 #8
0
 def move_book_cb(self, *a):
     model0, i0 = self.sel_group.get_selected()
     old_group = model0.get_value(i0, 1)
     model, i = self.sel_book.get_selected()
     if i:
         msg = self.choose_part(self.parent, 'هل تريد نقل الكتاب المحدد إلى هذا القسم ؟')
         if msg == Gtk.ResponseType.YES:
             id_book = model.get_value(i, 0)
             nm_book = model.get_value(i, 1)
             self.db.change_group(id_book, self.received_part_id)
             copyfile(join(asm_path.BOOK_DIR_rw, old_group, nm_book+u'.asm'), 
                      join(asm_path.BOOK_DIR_rw, self.received_part_name, nm_book+u'.asm'))
             unlink(join(asm_path.BOOK_DIR_rw, old_group, nm_book+u'.asm'))
             asm_customs.info(self.parent, u'تم نقل الكتاب "{}" إلى قسم "{}"'.format(nm_book, self.received_part_name))
             self.ok_group()
예제 #9
0
 def change_path_db(self, *a):
     open_dlg = Gtk.FileChooserDialog(u'تغيير مسار قاعدة البيانات',
                                      self.parent, Gtk.FileChooserAction.OPEN,
                                     (Gtk.STOCK_OK, Gtk.ResponseType.OK,
                                      Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
     
     Filter = Gtk.FileFilter()
     Filter.set_name(u"قاعدة البيانات")
     Filter.add_pattern("Listbooks.db")
     open_dlg.add_filter(Filter)
     
     res = open_dlg.run()
     if res == Gtk.ResponseType.OK:
         asm_config.setv('path', open_dlg.get_filenames()[0])          
         asm_customs.info(self.parent, u'يرجى إعادة تشغيل المكتبة ليتغير المسار فعليا!')
     open_dlg.destroy()
예제 #10
0
 def empty_book_cb(self, *a):
     model, i = self.sel_group.get_selected()
     if i:
         nm_group = model.get_value(i, 1)
         id_part = model.get_value(i, 0)
         new_bk = self.entry_group.get_text()
         if new_bk == '' :
             asm_customs.erro(self.parent, 'أدخل اسم الكتاب أولا')
             return
         db = join(asm_path.BOOK_DIR_rw, nm_group, new_bk+u'.asm')
         if exists(db):
             asm_customs.erro(self.parent, 'يوجد كتاب بنفس الاسم في هذا القسم')
             return
         self.db.empty_book(db)
         self.db.add_book(new_bk, id_part)
         asm_customs.info(self.parent, 'تم إضافة كتاب فارغ')
예제 #11
0
 def start_indexation(self, *a):
     self.btn_index_start.set_sensitive(False)
     writer = self.creat_writer_index('my_index')
     s = 0
     for id_book in self.selected_books:
         s += 1
         self.progress.set_fraction(float(s)/float(len(self.selected_books)))
         filebook = self.db.file_book(id_book)
         db = bookDB(filebook, id_book)
         for a in db.all_page():
             title = "-".join(db.titles_page(a[0]))
             if title == "": title = "-"
             content = db.get_text_body(a[0])[2]
             page = str(a[0])  
             book = str(id_book)
             writer.add_document(book=book, title=title, content=content, page=page)
             print (s)
         self.db.add_indexed(id_book)
     writer.commit()
     asm_customs.info(self, "تمت عملية الفهرسة")
     self.destroy()
예제 #12
0
 def new_db(self,*a): 
     save_dlg = Gtk.FileChooserDialog(u'مسار قاعدة البيانات الجديدة', self.parent,
                                 Gtk.FileChooserAction.SELECT_FOLDER,
                                 (Gtk.STOCK_OK, Gtk.ResponseType.OK,
                                 Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
     res = save_dlg.run()
     if res == Gtk.ResponseType.OK:
         new_dir = join(save_dlg.get_filename(), u'مكتبة أسماء')
         if os.path.exists(join(new_dir, u'data', u'Listbooks.db')):
             asm_customs.erro(self.parent, u'يوجد مكتبة في هذا الدليل بالفعل')
         else: 
             if not os.path.exists(new_dir):
                 os.mkdir(new_dir)
             if not os.path.exists(join(new_dir, u'data')):
                 os.mkdir(join(new_dir, u'data'))
             if not os.path.exists(join(new_dir, u'books')):
                 os.mkdir(join(new_dir, u'books'))
             if not os.path.exists(join(new_dir, u'index')):
                 os.mkdir(join(new_dir, u'index'))
             self.db.new_db(join(new_dir, 'data', 'Listbooks.db'))
             asm_customs.info(self.parent, u'تم إضافة مكتبة مفرغة جديدة')
     save_dlg.destroy()
예제 #13
0
 def start_convert(self, *a):
     if self.stack.get_visible_child_name() == "n3":
         if len(self.store_books) == 0:
             asm_customs.erro(self, "يجب إظهار قائمة الكتب أولا!")
             return
         self.btn_convert.set_sensitive(False)
         self.btn_stop.set_sensitive(True)
         self.stop_n = 0
         self.no_book = 1
         self.no_add = u""
         self.btn_convert.set_sensitive(False)
         self.store_books.foreach(self.import_shamela, True)
         if self.no_add != u"":
             asm_customs.erro(self, u"الكتب التي لم يتم إضافتها {}".format(self.no_add))
         self.lab_status.set_text(" لقد انتهت عملية التحويل ")
         self.btn_convert.set_sensitive(True)
     elif self.stack.get_visible_child_name() == "n1":
         id_group = asm_customs.value_active(self.groups)
         if id_group == None:
             if len(self.db.all_parts()) > 0:
                 asm_customs.info(self, "اختر القسم المراد ضم الكتب إليه")
             else:
                 asm_customs.info(self, "اذهب إلى صفحة تنظيم المكتبة وأضف قسما لاستيراد الملفات إليه")
         else:
             self.btn_convert.set_sensitive(False)
             self.btn_stop.set_sensitive(True)
             self.stop_n = 0
             self.import_book()
     elif self.stack.get_visible_child_name() == "n2":
         id_group = asm_customs.value_active(self.groups_doc)
         if id_group == None:
             if len(self.db.all_parts()) > 0:
                 asm_customs.info(self, "اختر القسم المراد ضم الكتب إليه")
             else:
                 asm_customs.info(self, "اذهب إلى صفحة تنظيم المكتبة وأضف قسما لاستيراد الملفات إليه")
         else:
             self.btn_convert.set_sensitive(False)
             self.btn_stop.set_sensitive(True)
             self.stop_n = 0
             self.import_docs()
예제 #14
0
                     mkdir(join(new_dir, 'data'))
                 if not exists(join(new_dir, 'books')):
                     mkdir(join(new_dir, 'books'))
                 if not exists(join(new_dir, 'index')):
                     mkdir(join(new_dir, 'index'))
                 con = sqlite3.connect(join(new_dir, 'data', 'Listbooks.db'))
                 cur = con.cursor()
                 cur.execute('CREATE TABLE groups (id_group integer primary key, \
                 tit varchar(255), sub INTEGER, cat INTEGER)') 
                 cur.execute('CREATE TABLE books (id_book integer primary key, tit varchar(255), \
                 parent INTEGER, fav  INTEGER DEFAULT 0, last  INTEGER DEFAULT 1, cat  INTEGER DEFAULT 0,\
                 tafsir  INTEGER DEFAULT 0, indx INTEGER DEFAULT 0)')
                 asm_config.setv('path', join(new_dir, 'data', 'Listbooks.db'))
                 library_path  = asm_config.getv('path')
                 LIBRARY_DIR_rw = dirname(dirname(library_path))
                 asm_customs.info(None, 'تم إضافة مكتبة مفرغة جديدة')
         else:
             y_return = 0
             quit()
         save_dlg.destroy()
         
     # a المسار الافتراضي--------------------------
     elif res == 4:
         asm_config.setv('path', LISTBOOK_FILE_rw)
         
     # a إلغاء التحديد----------------------------    
     else:
         my_return = 0
         quit()
 else:
     library_path = asm_config.getv('path')
예제 #15
0
 def import_docs(self, *a):
     self.no_add = u""
     if len(self.store_add_doc) == 0:
         return
     id_group = asm_customs.value_active(self.groups_doc)
     nm_group = asm_customs.value_active(self.groups_doc, 1)
     self.progress.set_fraction(0.0)
     self.btn_clear_doc.set_sensitive(False)
     self.btn_convert.set_sensitive(False)
     self.btn_remove_doc.set_sensitive(False)
     self.btn_add_doc.set_sensitive(False)
     if not self.is_book_radio.get_active():
         new_book = self.name_book_entry.get_text()
         if new_book == u"":
             asm_customs.info(self, "ضع اسما للكتاب المراد استيراده")
             return
         list_page = []
         list_title = []
         id_page = 1
     n_docs = len(self.store_add_doc)
     f = 0
     self.no_add = u""
     while len(self.store_add_doc) > 0:
         f += 1
         self.progress.set_fraction(float(f) / float(n_docs))
         while Gtk.events_pending():
             Gtk.main_iteration()
         if self.is_book_radio.get_active():
             new_book = re.sub(u"\....?.?$", u"", self.store_add_doc[0][1])
             text_book = self.get_text_from_file(self.store_add_doc[0][0], self.store_add_doc[0][1])
             if text_book != None and len(text_book) != 0:
                 pages = self.split_text_to_pages(text_book)
                 list_page = []
                 for a in range(len(pages)):
                     list_page.append([a + 1, pages[a], 1, a + 1])
                 list_title = [[1, new_book, 1, 0]]
                 self.make_book(new_book, id_group, nm_group, list_page, list_title)
         elif self.is_part_radio.get_active():
             text_book = self.get_text_from_file(self.store_add_doc[0][0], self.store_add_doc[0][1])
             if text_book != None and len(text_book) != 0:
                 pages = self.split_text_to_pages(text_book)
                 for a in range(len(pages)):
                     list_page.append([id_page, pages[a], f, a + 1])
                     id_page += 1
                 list_title.append([id_page - len(pages), u"الجزء {}".format(f), 1, 0])
         else:
             text_book = self.get_text_from_file(self.store_add_doc[0][0], self.store_add_doc[0][1])
             if text_book != None and len(text_book) != 0:
                 list_page.append([f, text_book, 1, f])
         i = self.store_add_doc.get_iter_first()
         self.store_add_doc.remove(i)
     if not self.is_book_radio.get_active():
         if list_title == []:
             list_title = [[1, new_book, 1, 0]]
         if self.no_add != u"":
             msg = asm_customs.sure(
                 self,
                 u"""
             عدد الملفات التي لم يتمكن من إضافتها هو {}
             هل تريد الاستمرار في تكوين الكتاب ؟
             """.format(
                     len(self.no_add.split("\n"))
                 ),
             )
             if msg == Gtk.ResponseType.YES:
                 self.make_book(new_book, id_group, nm_group, list_page, list_title)
     self.progress.set_text("انتهى !!")
     self.progress.set_fraction(1.0)
     self.btn_clear_doc.set_sensitive(True)
     self.btn_convert.set_sensitive(True)
     self.btn_remove_doc.set_sensitive(True)
     self.btn_add_doc.set_sensitive(True)
     if self.no_add != u"":
         asm_customs.erro(self, u"الملفات التي لم يتم إضافتها {}".format(self.no_add))
예제 #16
0
 def modify_data(self, *a):
     asm_customs.info(self.parent, 'تم تعديل البيانات بنجاح'); return
예제 #17
0
 def count_cb(self, *a):
     n_group = len(self.db.all_parts())
     n_book = self.db.n_books()
     asm_customs.info(self.parent, 'عدد الأقسام : {}\nعدد الكتب : {}'.format(n_group,n_book))
예제 #18
0
    def build(self,*a):
        Gtk.Dialog.__init__(self, parent=self.parent)
        self.set_default_size(500, 400)
        vbox1 = self.vbox
        vbox = Gtk.Box(spacing=0,orientation=Gtk.Orientation.HORIZONTAL)
        hb_bar = Gtk.HeaderBar()
        hb_bar.set_show_close_button(True)
        self.set_titlebar(hb_bar)
        hb_bar.set_custom_title(vbox)
        Gtk.StyleContext.add_class(vbox.get_style_context(), "linked")
        vbox.set_border_width(3)
        self.notebook = Gtk.Notebook()
        self.notebook.set_show_tabs(False)
        
        box = Gtk.Box(spacing=5, orientation=Gtk.Orientation.VERTICAL)
        box1 = Gtk.Box(spacing=4, orientation=Gtk.Orientation.VERTICAL)
        box1.set_border_width(5)
        self.frame = Gtk.Frame()
        box.set_border_width(5)
        ls = [u'بدون', u'مقترح', u'متباين', u'مخصص']
        style_btn = Gtk.ComboBoxText()
        for a in ls:
            style_btn.append_text(a)
        style_btn.connect("changed", self.specified)
        style_btn.set_active(asm_config.getn('theme'))
        hb = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        hb.pack_start(Gtk.Label('النمط'), False, False, 0)
        hb.pack_end(style_btn, False, False, 0)
        box.pack_start(hb, False, False, 0)
        box.pack_start(self.frame, True, True, 0)
       
        list_w1 = [[u'قائمة الأقسام','_prts'], [u'قائمة الكتب','_bks'], [u'القوائم الجانبية','_idx'], [u'نصوص الكتاب','_nass'], 
                   [u'النص القرآني', '_qrn'], [u'نصوص أخرى','_oth'], [u'العناوين','_tit']]
        list_w2 = [[u'لون خلفية العرض','_bg'], [u'خلفية النص القرآني', '_bg_qrn'], [u'لون خلفية القوائم','_bgs', 
                   [u'لون خط التحديد','_sel'], [u'لون خلفية التحديد','_bg_sel'], [u'لون تحديد البحث','_fnd']]]
        
        for a in list_w1:
            hbox = Gtk.Box(spacing=3,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(Gtk.Label(a[0]), False, False, 0)
            hbox.pack_end(btn2, False, False, 0)
            hbox.pack_end(btn1, False, False, 0)
            box1.pack_start(hbox, False, False, 0)
            
        for a in list_w2:
            hbox = Gtk.Box(spacing=3,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(Gtk.Label(a[0]), False, False, 0)
            hbox.pack_end(btn, False, False, 0)
            box1.pack_start(hbox, False, False, 0)
            
        ref = Gtk.Button("تحديث الواجهة")
        ref.connect('clicked', lambda *a: self.parent.theme.refresh())
        ref.connect('clicked', self.refresh)
        box.pack_end(ref, False, False, 0)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(box1)
        self.frame.add(scroll)
        self.notebook.append_page(box, Gtk.Label('خط ولون'))
        
        box = Gtk.VBox(False, 6)
        box.set_border_width(6) 
        btn_win_organize = Gtk.Button('تعديل المكتبة')
        btn_win_organize.connect('clicked', lambda *a: self.parent.notebook.set_current_page(8))
        box.pack_start(btn_win_organize, False, False, 0)
        
        btn_win_siana = Gtk.Button('نافذة الصيانة')
        btn_win_siana.connect('clicked', lambda *a: SianaWin(self.parent))
        box.pack_start(btn_win_siana, False, False, 0)
        
        btn_win_add = Gtk.Button('نافذة الاستيراد')
        btn_win_add.connect('clicked', lambda *a: AddBooks(self.parent))
        box.pack_start(btn_win_add, False, False, 0)
        
        btn_win_export = Gtk.Button('نافذة التصدير')
        btn_win_export.set_sensitive(False)
        #btn_win_export.connect('clicked', lambda *a: AddBooks(self.parent))
        box.pack_start(btn_win_export, False, False, 0)
        
        btn_win_index = Gtk.Button('نافذة الفهرسة')
        #btn_win_index.set_sensitive(False)
        try:
            from Asmaa.asm_indexer import WinIndexer
            btn_win_index.connect('clicked', lambda *a: WinIndexer(self.parent))
        except: pass
        box.pack_start(btn_win_index, False, False, 0)
        self.notebook.append_page(box, Gtk.Label('النوافذ'))

        box = Gtk.VBox(False, 6)
        box.set_border_width(6) 
        self.add_db = Gtk.Button('إنشاء مكتبة مفرّغة')
        self.add_db.connect('clicked', self.new_db)
        box.pack_start(self.add_db, False, False, 0)
        
        self.b_dest = Gtk.Button('تغيير مسار المكتبة')
        self.b_dest.connect('clicked', self.change_path_db)  
        self.b_path = Gtk.Button('عرض المسار الحاليّ')
        self.b_path.connect('clicked', lambda *a: asm_customs.info(self.parent, asm_config.getv('path')))  
        box.pack_start(self.b_dest, False, False, 0)
        box.pack_start(self.b_path, False, False, 0)
        
        self.copy_to_home = Gtk.Button('نسخ المكتبة  إلى المنزل')
        self.copy_to_home.set_tooltip_text('هذا الخيار إذا كانت كتب المكتبة في الدليل :\n"/usr/share/asmaa/"')
        if self.db.check_books_library() == False:
            self.copy_to_home.set_sensitive(False) 
        self.copy_to_home.connect('clicked', self.copy_to_home_cb)
        box.pack_start(self.copy_to_home, False, False, 0)      
        self.notebook.append_page(box, Gtk.Label('المسار'))
        
        box = Gtk.VBox(False, 6)
        box.set_border_width(5)
        
        self.saved_session = Gtk.CheckButton('حفظ الجلسة عند الإغلاق')
        box.pack_start(self.saved_session, False, False, 0)
        if asm_config.getn('saved_session') == 1: self.saved_session.set_active(True)
        else: self.saved_session.set_active(False)
        self.saved_session.connect("toggled", self.saved_session_cb)
        
        self.active_mouse_browse = Gtk.CheckButton('التصفح بعجلة الفأرة')
        box.pack_start(self.active_mouse_browse, False, False, 0)
        if asm_config.getn('mouse_browse') == 1: self.active_mouse_browse.set_active(True)
        else: self.active_mouse_browse.set_active(  False)
        self.active_mouse_browse.connect("toggled", self.active_mouse_browse_cb)
        
        ls = [u'بدون', u'اختفاء وظهور', u'زحلقة أفقية', u'زحلقة عمودية']
        style_browse = Gtk.ComboBoxText()
        for a in ls:
            style_browse.append_text(a)
        style_browse.connect("changed", self.style_browse_cb)
        style_browse.set_active(asm_config.getn('style_browse'))
        hb = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        hb.pack_start(Gtk.Label('نمط التصفح'), False, False, 0)
        hb.pack_end(style_browse, False, False, 0)
        box.pack_start(hb, False, False, 0)
        
        ls = [u'0.1', u'0.2', u'0.5', u'1', u'1.5', u'2', u'3']
        time_browse = Gtk.ComboBoxText()
        for a in ls:
            time_browse.append_text(a)
        time_browse.connect("changed", self.time_browse_cb)
        time_browse.set_active(asm_config.getn('time_browse'))
        hb = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        hb.pack_start(Gtk.Label('زمن التصفح بالثواني'), False, False, 0)
        hb.pack_end(time_browse, False, False, 0)
        box.pack_start(hb, False, False, 0)
        
        ls = [u'1', u'2', u'3', u'4', u'5', u'10']
        auto_browse = Gtk.ComboBoxText()
        for a in ls:
            auto_browse.append_text(a)
        auto_browse.connect("changed", self.auto_browse_cb)
        idx = ls.index(str(asm_config.getv('auto_browse')), )
        auto_browse.set_active(idx)
        hb = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        hb.pack_start(Gtk.Label('سرعة الاستعراض الآلي'), False, False, 0)
        hb.pack_end(auto_browse, False, False, 0)
        box.pack_start(hb, False, False, 0)
        
        self.numbers = Gtk.CheckButton('استعمال أرقام المغاربة')
        box.pack_start(self.numbers, False, False, 0)
        if asm_config.getn('nmbrs') == 1: self.numbers.set_active(True)
        else: self.numbers.set_active(False)
        self.numbers.connect("toggled", self.numbers_cb)
        self.notebook.append_page(box, Gtk.Label('خيارات'))
                
        box = Gtk.VBox(False, 6)
        box.set_border_width(6)
        self.rv_index = Gtk.Button('حذف الفهارس')
        self.rv_index.connect('clicked', self.rv_index_cb)
        box.pack_start(self.rv_index, False, False, 0)
        self.notebook.append_page(box, Gtk.Label('العمليات'))
        
        box = Gtk.VBox(False, 6)
        box.set_border_width(6)
        self.n_books_parts = Gtk.Button('عدد الكتب')
        self.n_books_parts.connect('clicked', self.count_cb)
        box.pack_start(self.n_books_parts, False, False, 0)
        self.rapid_count = Gtk.Button('إحصاء سريع')
        self.rapid_count.connect('clicked', self.count_fast)
        self.detail_count = Gtk.Button('إحصاء مفصل')
        self.detail_count.connect('clicked', self.count_detail)
        box.pack_start(self.rapid_count, False, False, 0)
        box.pack_start(self.detail_count, False, False, 0)
        
        btn_about = Gtk.Button('حول المكتبة')
        btn_about.connect('clicked', lambda *a: About(self.parent))
        box.pack_start(btn_about, False, False, 0)
        
        btn_help = Gtk.Button('صفحة المساعدة')
        btn_help.connect('clicked', lambda *a: self.parent.notebook.set_current_page(5))
        box.pack_start(btn_help, False, False, 0)
        
        web_page = Gtk.LinkButton.new_with_label("http://sourceforge.net/projects/asmaalibrary/files/",
                                                'صفحة البرنامج على الشّبكة')
        box.pack_start(web_page, False, False, 0)
        
        db_void = Gtk.LinkButton.new_with_label("http://sourceforge.net/projects/asmaalibrary/files/AsmaaLibrary.tar.gz/download",
                                                'تنزيل قاعدة بيانات للتجربة')
        
        box.pack_start(db_void, False, False, 0)
        self.notebook.append_page(box, Gtk.Label('المعلومات'))
        
        vbox1.pack_start(self.notebook, True, True, 0)
        
        self.theme_btn = Gtk.ToggleButton()
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_SELECT_COLOR, Gtk.IconSize.LARGE_TOOLBAR)
        self.theme_btn.set_image(img)
        self.theme_btn.set_name('theme')
        self.theme_btn.set_active(True)
        self.theme_btn.connect("clicked", self.switch_page)
        vbox.pack_start(self.theme_btn, False, False, 0)
        
        self.wins_btn = Gtk.ToggleButton()
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_HOME, Gtk.IconSize.LARGE_TOOLBAR)
        self.wins_btn.set_image(img)
        self.wins_btn.set_name('wins')
        self.wins_btn.connect("clicked", self.switch_page)
        vbox.pack_start(self.wins_btn, False, False, 0)
        
        self.path_btn = Gtk.ToggleButton()
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_OPEN, Gtk.IconSize.LARGE_TOOLBAR)
        self.path_btn.set_image(img)
        self.path_btn.set_name('path')
        self.path_btn.connect("clicked", self.switch_page)
        vbox.pack_start(self.path_btn, False, False, 0)
        
        self.prop_btn = Gtk.ToggleButton()
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_PROPERTIES, Gtk.IconSize.LARGE_TOOLBAR)
        self.prop_btn.set_image(img)
        self.prop_btn.set_name('prop')
        self.prop_btn.connect("clicked", self.switch_page)
        vbox.pack_start(self.prop_btn, False, False, 0)
        
        self.modifie_btn = Gtk.ToggleButton()
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.LARGE_TOOLBAR)
        self.modifie_btn.set_image(img)
        self.modifie_btn.set_name('modifie')
        self.modifie_btn.connect("clicked", self.switch_page)
        vbox.pack_start(self.modifie_btn, False, False, 0)
        
        self.info_btn = Gtk.ToggleButton()
        img = Gtk.Image()
        img.set_from_stock(Gtk.STOCK_INFO, Gtk.IconSize.LARGE_TOOLBAR)
        self.info_btn.set_image(img)
        self.info_btn.set_name('info')
        self.info_btn.connect("clicked", self.switch_page)
        vbox.pack_start(self.info_btn, False, False, 0)
        
        self.show_all()
예제 #19
0
 def rv_index_cb(self, *a):
     check = self.db.remove_index()
     if check == None:
         rmtree(join(asm_path.INDEX_DIR_rw, 'my_index'))
     asm_customs.info(self.parent, 'تم مسح الفهرس .')