コード例 #1
0
ファイル: asm_preference.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.parent = parent
     self.db = listDB()
     Gtk.Dialog.__init__(self, parent=self.parent)
     
     hb_bar = Gtk.HeaderBar()
     hb_bar.set_show_close_button(True)
     hb_bar.set_title('صيانة وإصلاح المكتبة')
     self.set_titlebar(hb_bar)
     
     Box = self.vbox
     Box.set_spacing(5)
     self.set_border_width(3)
     self.set_size_request(420, 350)
     self.progress_repair = Gtk.ProgressBar()
     self.store_repair = Gtk.ListStore(str)
     self.tree_repair = Gtk.TreeView()
     sah1 = Gtk.TreeViewColumn('نتائج الفحص',Gtk.CellRendererText(),text = 0)
     self.tree_repair.append_column(sah1)
     self.tree_repair.set_model(self.store_repair)
     scroll = Gtk.ScrolledWindow()
     scroll.add(self.tree_repair)
     Box.pack_start(scroll, True, True, 0)
     Box.pack_start(self.progress_repair, False, False, 0)
     siana = Gtk.Button("صيانة")
     siana.connect('clicked', self.star_siana)
     hb_bar.pack_start(siana)
     self.show_all()
     
コード例 #2
0
ファイル: asm_organize.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.parent = parent
     self.db = listDB()
     self.mycount = Count()
     self.size_font = int(self.parent.theme.font_nass[-2:])
     self.list_modifieds = []
     self.build()
コード例 #3
0
ファイル: asm_import_bok.py プロジェクト: wahaproject/asmaa
 def __init__(self, ifile, nm_group, id_group):
     self.cols = []
     self.nm_group = nm_group
     self.id_group = id_group
     self.table_list = []
     self.list_book = listDB()
     self.ifile = ifile
     self.creat_newDB()
コード例 #4
0
ファイル: asm_import_bok.py プロジェクト: wahaproject/asmaa
def DB_from_doc(nm_book, id_group, nm_group, list_page, list_title):
    db = join(asm_path.BOOK_DIR_rw, nm_group, nm_book+'.asm')
    if exists(db): os.unlink(db)
    con = sqlite3.connect(db, isolation_level=None)
    cur = con.cursor() 
    for tb in asm_customs.schema.keys():
        cur.execute('CREATE TABLE IF NOT EXISTS {} ({})'.format(tb, asm_customs.schema[tb]))
    cur.execute("BEGIN;")
    cur.execute('INSERT INTO main VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', 
                (nm_book,'', 0, nm_book, nm_book, 0, 0, 0, 0, 0, 0.1))
    for pg in list_page:
        cur.execute('INSERT INTO pages VALUES (?, ?, ?, ?, ?, ?, ?, ?)', (pg[0], pg[1], pg[2], 
                        pg[3], 0, 0, 0, 0))
    for ti in list_title:
        cur.execute('INSERT INTO titles VALUES (?, ?, ?, ?)', (ti[0], ti[1], ti[2], ti[3]))
    con.commit()
    listDB().add_book(nm_book, id_group, 0)
コード例 #5
0
ファイル: asm_edit_book.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     Gtk.VBox.__init__(self, False, 3)
     self.set_border_width(5)
     self.parent = parent
     self.othman = Othman()
     self.db_list = listDB()
     self.db = None
     self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
     self.build()
コード例 #6
0
ファイル: asm_search.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.db = None
     self.db_list = listDB()
     self.ls_term = []
     self.parent = parent
     self.cursive = False
     self.results_books = []
     self.stop_n = 1
     self.build()
コード例 #7
0
ファイル: asm_search.py プロジェクト: wahaproject/asmaa
 def add_all_list(self,*a):
     for w in range(len(self.store_fields)):
         if self.store_fields[w][0] == True:
             nm_field = self.store_fields[w][1]
             if nm_field == u"المفضلة":
                 list_fav = listDB().favorite_books()
                 for a in list_fav:
                     if a not in self.selected_books:
                         nm_book = a[1]
                         id_book = a[0]
                         nm_group = listDB().group_book(a[0])
                         self.selected_books.append([nm_book, nm_group, id_book])
             else:
                 store = pickle.load(open(join(asm_path.LIBRARY_DIR_rw, u'fields-search', nm_field+u'.pkl'), "rb"))
                 for a in store:
                     if a not in self.selected_books:
                         nm_book = a[0]
                         nm_group = a[1]
                         id_book = a[2]
                         self.selected_books.append([nm_book, nm_group, id_book])
コード例 #8
0
ファイル: asm_viewer.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent, book, id_book):
     Gtk.VBox.__init__(self, False, 3)
     self.db_list = listDB()
     self.parent = parent
     self.othman = Othman()
     self.id_book = id_book
     self.book = book
     self.nm_book = basename(book)[:-4]
     self.db = bookDB(book, id_book)
     self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
     self.current_id = 1
     self.opened_new = []
     self.opened_old = []
     self.build()
コード例 #9
0
ファイル: asm_import_bok.py プロジェクト: wahaproject/asmaa
 def __init__(self, ifile, nm_group, info_list, comments, shorts, archive):
     # info_list = 0='BkId', 1='Bk', 2='Betaka', 3='Inf', 4='Auth', 5='TafseerNam', 6='IslamShort'
     #self.cols = []
     self.info_list = info_list
     self.comments = comments
     self.shorts = shorts
     self.archive = archive
     #self.table_list = []
     self.list_book = listDB()
     self.nm_group = nm_group
     self.id_group = self.list_book.add_part(self.nm_group)
     if not exists(join(asm_path.BOOK_DIR_rw, self.nm_group)):
         os.mkdir(join(asm_path.BOOK_DIR_rw, self.nm_group))
     self.ifile = ifile
     self.creat_newDB()
コード例 #10
0
ファイル: asm_marks.py プロジェクト: wahaproject/asmaa
 def ok_m(self, *a):
     (model, i) = self.tree_sav.get_selection().get_selected()
     if i:
         self.destroy()
         id_page = model.get_value(i, 0)
         id_book = model.get_value(i, 2)
         book = listDB().file_book(id_book)
         nm_book = model.get_value(i, 1)
         n = self.parent.viewerbook.get_n_pages()
         for s in range(n):
             ch = self.parent.viewerbook.get_nth_page(s)
             if self.parent.viewerbook.get_tab_label(ch).nm == nm_book:
                 self.parent.viewerbook.set_current_page(s)
                 self.parent.notebook.set_current_page(1)
                 return
         sr = OpenBook(self.parent, book, id_book)
         sr.show_page(id_page)
         self.parent.viewerbook.append_page(sr, TabLabel(sr, nm_book))
         self.parent.viewerbook.set_current_page(-1)
         self.parent.notebook.set_current_page(1)
         sr.set_index()
コード例 #11
0
ファイル: asm_window.py プロジェクト: wahaproject/asmaa
 def __init__(self,*a):
     self.full = 0
     self.opened = [0]
     self.db = listDB()
     self.entry_search = Gtk.SearchEntry()
     Gtk.Window.__init__(self)
     self.axl = Gtk.AccelGroup()
     self.add_accel_group(self.axl)
     self.theme = MyTheme()
     self.search_win = Searcher(self)
     self.list_books = ListBooks(self)
     self.viewerbook = ViewerBooks(self)
     self.tafsirpage = Tafsir(self)
     self.warakapage = Warakat(self)
     self.editbook = EditBook(self)
     self.help_book = OpenBook(self, asm_path.DALIL_DB, -1)
     self.winspage = OtherWins(self)
     self.help_book.set_border_width(3)
     self.help_book.comment_btn.set_sensitive(False)
     self.help_book.set_index()
     self.moshafpage = ViewerMoshaf(self)
     self.organize = Organize(self)
     #-------------------------------
     self.build()
コード例 #12
0
ファイル: asm_edit_tafsir.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent, id_book):
     self.parent = parent
     self.listdb = listDB()
     book = self.listdb.file_book(id_book)
     self.db = bookDB(book, id_book)
     self.othman = Othman()
     Gtk.Dialog.__init__(self, parent=self.parent)
     self.set_icon_name("asmaa")
     self.resize(750, 450)
     self.set_modal(True)
     self.set_title(u'تعديل تفسير : {}'.format(self.db.book_name,))
     self.connect('destroy', self.quit_dlg)
     box = self.vbox
     box.set_border_width(5)
     
     # a عارض النص-----------------------------------
     self.view_nasse = asm_customs.ViewClass()
     self.view_nasse_bfr = self.view_nasse.get_buffer()
     self.view_quran_tag = self.view_nasse_bfr.create_tag("quran")
     self.view_quran_tag.set_property('foreground', self.parent.theme.color_qrn)
     self.view_quran_tag.set_property("paragraph-background", self.parent.theme.color_bg_qrn)
     self.view_quran_tag.set_property('font', self.parent.theme.font_qrn)
     self.scroll_nasse = Gtk.ScrolledWindow()
     self.scroll_nasse.set_shadow_type(Gtk.ShadowType.IN)
     self.scroll_nasse.add(self.view_nasse)
     box.pack_start(self.scroll_nasse, True, True, 0)
     box.pack_start(Gtk.HSeparator(), False, False, 3)
     
     hb = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
     self.lab_id_pg = Gtk.Label('جزء 1 ، صفحة 1')
     hb.pack_start(self.lab_id_pg, False, False, 3)
     adj = Gtk.Adjustment(1, 1, len(self.db.list_pages), 1, 5.0, 0.0)
     self.id_pg = Gtk.SpinButton()
     self.id_pg.connect('changed', self.change_id_pg)
     self.id_pg.set_adjustment(adj)
     lab = Gtk.Label('معرف الصفحة')
     self.id_pg.set_wrap(True)
     self.id_pg.set_size_request(100, -1)
     hb.pack_end(self.id_pg, False, False, 0)
     hb.pack_end(lab, False, False, 0)
     box.pack_start(hb, False, False, 3)
     
     box.pack_start(Gtk.HSeparator(), False, False, 3)
     
     hb = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
     sura_list = self.othman.get_suras_names()
     hb0, self.suras = asm_customs.combo(sura_list, u'السورة')
     hb.pack_start(hb0, False, False, 3)
     self.suras.set_active(-1)
     
     adj = Gtk.Adjustment(0, 0, 0, 1, 5.0, 0.0)
     self.n_ayas = Gtk.SpinButton()
     self.n_ayas.set_adjustment(adj)
     lab = Gtk.Label('عدد الآيات')
     self.n_ayas.set_wrap(True)
     self.n_ayas.set_size_request(100, -1)
     hb.pack_end(self.n_ayas, False, False, 0)
     hb.pack_end(lab, False, False, 0)
     
     adj = Gtk.Adjustment(0, 0, 0, 1, 5.0, 0.0)
     self.ayas = Gtk.SpinButton()
     self.ayas.set_adjustment(adj)
     lab = Gtk.Label('أول آية')
     self.ayas.set_wrap(True)
     self.ayas.set_size_request(100, -1)
     hb.pack_end(self.ayas, False, False, 0)
     hb.pack_end(lab, False, False, 0)
     box.pack_start(hb, False, False, 3)
     
     hbox = Gtk.Box(spacing=5,orientation=Gtk.Orientation.HORIZONTAL)
     save_btn = asm_customs.ButtonClass("غيّر")
     save_btn.set_tooltip_text('ثبت السورة والآيات للصفحة الحالية')
     save_btn.connect('clicked', self.save_cb)
     hbox.pack_start(save_btn, False, False, 0)
     no_save_btn = asm_customs.ButtonClass("أخل")
     no_save_btn.set_tooltip_text('ألغ ربط الصفحة الحالية بالآيات')
     no_save_btn.connect('clicked', self.no_save_cb)
     hbox.pack_start(no_save_btn, False, False, 0)
     clo = asm_customs.ButtonClass("إغلاق")
     clo.connect('clicked', self.quit_dlg)
     hbox.pack_end(clo, False, False, 0)
     box.pack_end(hbox, False, False, 0)
     box.pack_end(Gtk.HSeparator(), False, False, 3)
     
     self.suras.connect('changed', self.select_sura)
     self.show_all()
コード例 #13
0
ファイル: asm_edit_tafsir.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.parent = parent
     self.db = listDB()
     self.build()
コード例 #14
0
ファイル: asm_add.py プロジェクト: wahaproject/asmaa
    def __init__(self, parent):
        self.no_all_book = 1
        self.parent = parent
        self.db_bok = None
        self.stop_n = 0
        self.db = listDB()
        vbox = Gtk.Box(spacing=5, orientation=Gtk.Orientation.VERTICAL)
        box = Gtk.Box(spacing=5, orientation=Gtk.Orientation.VERTICAL)
        Gtk.Dialog.__init__(self, parent=self.parent)
        self.resize(550, 450)
        area = self.get_content_area()
        area.set_spacing(3)
        self.set_position(Gtk.WindowPosition.CENTER)

        hb_bar = Gtk.HeaderBar()
        hb_bar.set_show_close_button(True)
        self.set_titlebar(hb_bar)
        self.stack = Gtk.Stack()
        self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
        self.stack.set_transition_duration(1000)
        stack_switcher = Gtk.StackSwitcher()
        stack_switcher.set_stack(self.stack)
        hb_bar.set_custom_title(stack_switcher)

        # a استيراد ملفات bok & asm----------------------------
        hb = Gtk.HBox(False, 3)
        self.btn_add = Gtk.Button("جديد")
        self.btn_add.connect("clicked", self.add_bok)
        hb.pack_start(self.btn_add, False, False, 0)
        hb.pack_start(Gtk.Label("«bok, asm»"), True, True, 0)
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        Gtk.StyleContext.add_class(hbox.get_style_context(), "linked")
        hb.pack_end(hbox, False, False, 0)
        self.btn_remove = Gtk.Button("حذف")
        self.btn_remove.connect("clicked", self.remove_iter)
        hbox.pack_start(self.btn_remove, False, False, 0)
        self.btn_clear = Gtk.Button("مسح")
        self.btn_clear.connect("clicked", lambda *a: self.store_add.clear())
        hbox.pack_start(self.btn_clear, False, False, 0)
        box.pack_start(hb, False, False, 0)
        self.store_add = Gtk.ListStore(str, str)
        self.tree_add = Gtk.TreeView()
        self.sel_add = self.tree_add.get_selection()
        column = Gtk.TreeViewColumn("الكتب", Gtk.CellRendererText(), text=1)
        self.tree_add.append_column(column)
        self.tree_add.set_model(self.store_add)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_add)
        box.pack_start(scroll, True, True, 0)
        ls = []
        for a in self.db.all_parts():
            ls.append([a[0], a[1]])
        hbox, self.groups = asm_customs.combo(ls, "ضع هذه الكتب في قسم :")
        box.pack_start(hbox, False, False, 0)
        box.set_border_width(5)
        self.stack.add_titled(box, "n1", "ملفات كتب")

        # a استيراد الملفات النصية----------------------------
        box = Gtk.Box(spacing=5, orientation=Gtk.Orientation.VERTICAL)
        box.set_border_width(5)
        hb = Gtk.HBox(False, 3)
        self.btn_add_doc = Gtk.Button("جديد")
        self.btn_add_doc.connect("clicked", self.add_doc)
        hb.pack_start(self.btn_add_doc, False, False, 0)
        hb.pack_start(Gtk.Label("«odt, docx, doc, rtf, txt, html»"), True, True, 0)
        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        Gtk.StyleContext.add_class(hbox.get_style_context(), "linked")
        hb.pack_end(hbox, False, False, 0)
        self.btn_remove_doc = Gtk.Button("حذف")
        self.btn_remove_doc.connect("clicked", self.remove_iter)
        hbox.pack_start(self.btn_remove_doc, False, False, 0)
        self.btn_clear_doc = Gtk.Button("مسح")
        self.btn_clear_doc.connect("clicked", lambda *a: self.store_add_doc.clear())
        hbox.pack_start(self.btn_clear_doc, False, False, 0)
        box.pack_start(hb, False, False, 0)
        self.store_add_doc = Gtk.ListStore(str, str)
        self.tree_add_doc = Gtk.TreeView()
        self.sel_add_doc = self.tree_add_doc.get_selection()
        column = Gtk.TreeViewColumn("الملفات", Gtk.CellRendererText(), text=1)
        self.tree_add_doc.append_column(column)
        self.tree_add_doc.set_model(self.store_add_doc)
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_add_doc)
        box.pack_start(scroll, True, True, 0)

        hbox = Gtk.Box(spacing=10, orientation=Gtk.Orientation.HORIZONTAL)
        self.is_book_radio = Gtk.RadioButton.new_with_label_from_widget(None, "كتاب")
        self.is_part_radio = Gtk.RadioButton.new_with_label_from_widget(self.is_book_radio, "جزء")
        self.is_page_radio = Gtk.RadioButton.new_with_label_from_widget(self.is_part_radio, "صفحة")
        self.is_book_radio.connect("toggled", self.specified, "0")
        self.is_part_radio.connect("toggled", self.specified, "1")
        self.is_page_radio.connect("toggled", self.specified, "2")
        hbox.pack_start(Gtk.Label("كل ملف يمثل : "), False, False, 0)
        hbox.pack_start(self.is_book_radio, False, False, 0)
        hbox.pack_start(self.is_part_radio, False, False, 0)
        hbox.pack_start(self.is_page_radio, False, False, 0)
        hbox.set_border_width(5)
        box.pack_start(hbox, False, False, 0)

        hb = Gtk.HBox(False, 7)
        hb.pack_start(Gtk.Label("اسم الكتاب : "), False, False, 0)
        self.name_book_entry = Gtk.Entry()
        self.name_book_entry.set_sensitive(False)
        hb.pack_start(self.name_book_entry, True, True, 0)
        box.pack_start(hb, False, False, 0)

        hb = Gtk.HBox(False, 7)
        self.letters = Gtk.CheckButton("عدد الأحرف في الصفحة")
        hb.pack_start(self.letters, False, False, 0)
        adj = Gtk.Adjustment(3000, 10, 100000, 1, 5.0, 0.0)
        self.n_letters = Gtk.SpinButton()
        self.n_letters.set_adjustment(adj)
        self.n_letters.set_wrap(True)
        self.n_letters.set_sensitive(False)
        hb.pack_start(self.n_letters, False, False, 0)
        box.pack_start(hb, False, False, 0)

        hb = Gtk.HBox(False, 7)
        self.fasil = Gtk.CheckButton("رمز فاصل بين الصفحات")
        hb.pack_start(self.fasil, False, False, 0)
        self.separative = Gtk.Entry()
        self.separative.set_placeholder_text("الفاصل يتم حذفه من الكتاب")
        self.separative.set_sensitive(False)
        hb.pack_start(self.separative, True, True, 0)
        box.pack_start(hb, False, False, 0)

        def letters_cb(widget, *a):
            if self.letters.get_active():
                self.n_letters.set_sensitive(True)
                self.fasil.set_active(False)
            else:
                self.n_letters.set_sensitive(False)

        self.letters.connect("toggled", letters_cb)

        def fasil_cb(widget, *a):
            if self.fasil.get_active():
                self.separative.set_sensitive(True)
                self.letters.set_active(False)
            else:
                self.separative.set_sensitive(False)

        self.fasil.connect("toggled", fasil_cb)

        box.pack_start(Gtk.HSeparator(), False, False, 0)

        hbox, self.groups_doc = asm_customs.combo(ls, "ضع هذه الكتب في قسم :")
        box.pack_start(hbox, False, False, 0)
        self.stack.add_titled(box, "n2", "ملفات نصية")

        # a استيراد الشاملة----------------------------
        box = Gtk.Box(spacing=3, orientation=Gtk.Orientation.VERTICAL)
        box.set_border_width(5)

        hbox = Gtk.Box(spacing=7, orientation=Gtk.Orientation.HORIZONTAL)
        self.entry_shamila = Gtk.Entry()
        b_shamila = Gtk.Button("...")
        b_shamila.connect("clicked", self.select_path)
        hbox.pack_start(Gtk.Label("مجلد الشاملة"), False, False, 0)
        hbox.pack_start(self.entry_shamila, True, True, 0)
        hbox.pack_start(b_shamila, False, False, 0)
        box.pack_start(hbox, False, False, 0)

        hbox = Gtk.Box(spacing=6, orientation=Gtk.Orientation.HORIZONTAL)
        b_show = Gtk.Button("أظهر قائمة الكتب")
        b_show.connect("clicked", self.show_books)
        hbox.pack_start(b_show, False, False, 0)
        box.pack_start(hbox, False, False, 0)

        # self.store_books = Gtk.TreeStore(GObject.TYPE_BOOLEAN, GObject.TYPE_STRING, GObject.TYPE_INT)
        self.store_books = Gtk.TreeStore(
            GObject.TYPE_BOOLEAN,
            GObject.TYPE_INT,
            GObject.TYPE_STRING,
            GObject.TYPE_INT,
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GObject.TYPE_STRING,
            GObject.TYPE_INT,
            GObject.TYPE_INT,
        )  ########
        self.tree_books = Gtk.TreeView()
        self.tree_books.set_model(self.store_books)
        self.sel_books = self.tree_books.get_selection()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.tree_books)
        scroll.set_size_request(200, -1)
        celltext = Gtk.CellRendererText()
        celltext.set_property("ellipsize", Pango.EllipsizeMode.END)
        celltoggle = Gtk.CellRendererToggle()
        celltoggle.set_property("activatable", True)
        columntoggle = Gtk.TreeViewColumn("اختر", celltoggle)
        columntext = Gtk.TreeViewColumn("الكتب", celltext, text=2)
        columntext.set_expand(True)
        columntoggle.add_attribute(celltoggle, "active", 0)
        celltoggle.connect("toggled", self.fixed_toggled, self.store_books)
        self.tree_books.append_column(columntoggle)
        self.tree_books.append_column(columntext)
        box.pack_start(scroll, True, True, 0)

        hbox = Gtk.Box(spacing=7, orientation=Gtk.Orientation.HORIZONTAL)
        self.all_books = Gtk.CheckButton("الكل")
        self.all_books.connect("toggled", self.select_all)
        hbox.pack_start(self.all_books, False, False, 0)
        self.lab_status = Gtk.Label("")
        self.lab_status.set_ellipsize(Pango.EllipsizeMode.END)
        hbox.pack_end(self.lab_status, False, False, 0)
        box.pack_end(hbox, False, False, 0)

        self.stack.add_titled(box, "n3", "قرص الشاملة")

        hbox = Gtk.Box(spacing=3, orientation=Gtk.Orientation.HORIZONTAL)
        hbox.set_border_width(5)
        self.btn_close = asm_customs.ButtonClass("إغلاق")
        self.btn_close.connect("clicked", lambda *a: self.destroy())
        hbox.pack_end(self.btn_close, False, False, 0)
        hb = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        Gtk.StyleContext.add_class(hb.get_style_context(), "linked")
        hbox.pack_start(hb, False, False, 0)
        self.btn_convert = Gtk.Button("تحويل")
        self.btn_convert.connect("clicked", self.start_convert)
        hb.pack_start(self.btn_convert, False, False, 0)
        self.btn_stop = Gtk.Button("إيقاف")
        self.btn_stop.connect("clicked", self.stop_operation)
        self.btn_stop.set_sensitive(False)
        hb.pack_start(self.btn_stop, False, False, 0)
        vbox.pack_start(self.stack, True, True, 0)
        self.progress = Gtk.ProgressBar()
        vbox.pack_start(self.progress, False, False, 0)
        vbox.pack_start(hbox, False, False, 0)
        area.pack_start(vbox, True, True, 0)
        self.show_all()
コード例 #15
0
ファイル: asm_edit_bitaka.py プロジェクト: wahaproject/asmaa
    def __init__(self, parent, id_book):
        self.parent = parent
        self.db = listDB()
        self.book = self.db.file_book(id_book)
        Gtk.Dialog.__init__(self, parent=self.parent)
        self.set_icon_name("asmaa")
        self.connect('destroy', self.quit_dlg)
        area = self.get_content_area()
        area.set_spacing(5)
        self.set_border_width(5)
        
        hb_bar = Gtk.HeaderBar()
        hb_bar.set_show_close_button(True)
        self.set_titlebar(hb_bar)
        stack = Gtk.Stack()
        stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
        stack.set_transition_duration(1000)
        stack_switcher = Gtk.StackSwitcher()
        stack_switcher.set_stack(stack)
        hb_bar.set_custom_title(stack_switcher)

        self.set_default_size(600, 450)
        box = Gtk.Box(spacing=6,orientation=Gtk.Orientation.VERTICAL)

        box1 = Gtk.Box(spacing=6,orientation=Gtk.Orientation.VERTICAL)
        box2 = Gtk.Box(spacing=6,orientation=Gtk.Orientation.VERTICAL)
        
        hbox = Gtk.HBox(False, 3)
        self.n_n = Gtk.Label('اسم الكتاب')
        hbox.pack_start(self.n_n, False, False, 0) 
        self.ent_name = Gtk.Entry()
        self.ent_name.set_text(self.db.info_book(self.book)[0])
        hbox.pack_start(self.ent_name, True, True, 0)
        box1.pack_start(hbox, False, False, 0)
        
        hbox = Gtk.HBox(False, 3)
        self.n_ns = Gtk.Label('اسم مختصر')
        hbox.pack_start(self.n_ns, False, False, 0) 
        self.ent_name_sh = Gtk.Entry()
        self.ent_name_sh.set_text(self.db.info_book(self.book)[1])
        hbox.pack_start(self.ent_name_sh, True, True, 0)
        box1.pack_start(hbox, False, False, 0)
        
        box1.pack_start(Gtk.HSeparator(), False, False, 0)
        
        self.view_bitaka = Gtk.TextView()
        self.view_bitaka.set_wrap_mode(Gtk.WrapMode.WORD)
        self.view_bitaka.set_right_margin(5)
        self.view_bitaka.set_left_margin(5)
        self.view_bitaka_bfr = self.view_bitaka.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.view_bitaka)
        self.bitaka_book = self.db.info_book(self.book)[3]
        self.view_bitaka_bfr.set_text(self.bitaka_book)
        hbox = Gtk.HBox(False, 3)
        hbox.pack_start(Gtk.Label('بطاقة الكتاب'), False, False, 0)
        sample_btn = Gtk.ToggleButton("عينة")
        def sample_cb(w):
            if sample_btn.get_active():
                self.bitaka_book = self.view_bitaka_bfr.get_text(self.view_bitaka_bfr.get_start_iter(),
                            self.view_bitaka_bfr.get_end_iter(), False)
                self.view_bitaka_bfr.set_text('اسم الكتاب :\nالمؤلف :\nالناشر :\nالطبعة :\n\
التحقيق :\nعدد الأجزاء :\nمصدر الكتاب :\nترقيم الكتاب :')
            else:
                self.view_bitaka_bfr.set_text(self.bitaka_book)
        sample_btn.connect('toggled', sample_cb)
        hbox.pack_end(sample_btn, False, False, 0)
        box1.pack_start(hbox, False, False, 0)
        box1.pack_start(scroll, True, True, 0)
        
        self.view_info = Gtk.TextView()
        self.view_info.set_wrap_mode(Gtk.WrapMode.WORD)
        self.view_info.set_right_margin(5)
        self.view_info.set_left_margin(5)
        self.view_info_bfr = self.view_info.get_buffer()
        scroll = Gtk.ScrolledWindow()
        scroll.set_shadow_type(Gtk.ShadowType.IN)
        scroll.add(self.view_info)
        self.info_book = self.db.info_book(self.book)[4]
        self.view_info_bfr.set_text(self.info_book)
        hbox = Gtk.HBox(False, 3)
        hbox.pack_start(Gtk.Label('نبذة عن الكتاب'), False, False, 0)
        sample_btn1 = Gtk.ToggleButton("عينة")
        def sample_cb1(w):
            if sample_btn1.get_active():
                self.info_book = self.view_info_bfr.get_text(self.view_info_bfr.get_start_iter(),
                            self.view_info_bfr.get_end_iter(), False)
                self.view_info_bfr.set_text('موضوع الكتاب\nسبب التأليف\nمكانة الكتاب العلمية\nكلام العلماء في تقريضه')
            else:
                self.view_info_bfr.set_text(self.info_book)
        sample_btn1.connect('toggled', sample_cb1)
        hbox.pack_end(sample_btn1, False, False, 0)
        box1.pack_start(hbox, False, False, 0)
        box1.pack_start(scroll, True, True, 0)
        stack.add_titled(box1, 'n1', "بطاقة ونبذة")
        
        hbox = Gtk.HBox(False, 3)
        self.has_shorts = Gtk.CheckButton('هل به اختصارات قياسية')
        self.has_shorts.set_tooltip_text("'A'='صلى الله عليه وسلم', 'B'='رضي الله عن', 'C'='رحمه الله',\n'D'='عز وجل', 'E'='عليه الصلاة و السلام', 'Y'=':'")
        hbox.pack_start(self.has_shorts, False, False, 0) 
        if self.db.info_book(self.book)[7] == 1: self.has_shorts.set_active(True)
        box2.pack_start(hbox, False, False, 0)
        stack.add_titled(box2, 'n1', "معلومات أخرى")

        save_btn = Gtk.Button("حفظ")
        save_btn.connect('clicked', self.save_cb)
        hb_bar.pack_start(save_btn)
        
        box.pack_start(stack, True, True, 0)
        
        area.pack_start(box, True, True, 0)
        self.show_all()
コード例 #16
0
ファイル: asm_listbook.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.parent = parent
     self.db = listDB()
     try: self.last_books = pickle.load(open((join(asm_path.DATA_DIR_rw, u'last-books.pkl')), "rb"))
     except: self.last_books = []
     self.build()
コード例 #17
0
ファイル: asm_count.py プロジェクト: wahaproject/asmaa
 def __init__(self, *a):
     self.db = listDB()
コード例 #18
0
ファイル: asm_search.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.parent = parent
     self.db = listDB()
     self.selected_books = []
     self.build()
コード例 #19
0
ファイル: asm_tafsir.py プロジェクト: wahaproject/asmaa
 def __init__(self, parent):
     self.db = None
     self.current_id = 1
     self.part_now = 1
     self.page_now = 1
     self.nm_book = 'التفسير الميسر'
     self.parent = parent
     self.othman = Othman()
     self.listbook = listDB()
     sura_list = self.othman.get_suras_names()
     self.opened_new = []
     self.opened_old = []
     Gtk.HBox.__init__(self, False, 0)
     vbox = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
     
     self.notebook = Gtk.Notebook()
     self.notebook.set_show_tabs(False)
     vb = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
     vb.set_border_width(5)
     self.load_list()
     self.tafsirs = asm_customs.combo(self.store_tafasir, 'التفسير')
     self.tafsirs.set_wrap_width(self.n_warp)
     vb.pack_start(self.tafsirs, False, False, 0)
     self.tafsirs.set_active(0)
     
     adj = Gtk.Adjustment(1, 1, 7, 1, 5.0, 0.0)
     self.ayas = Gtk.SpinButton()
     self.ayas.set_adjustment(adj)
     self.ayas.set_value(1.0)
     self.ayas.connect('activate', self.select_aya)
     
     hb, self.suras = asm_customs.combo(sura_list, 'السورة')
     self.suras.set_wrap_width(10)
     vb.pack_start(hb, False, False, 0)
     self.suras.set_active(0)
     
     hb = Gtk.Box(spacing=7,orientation=Gtk.Orientation.HORIZONTAL)
     lab = Gtk.Label('الآيــــة')
     self.ayas.set_wrap(True)
     self.ayas.set_size_request(140, -1)
     hb.pack_start(lab, False, False, 0)
     hb.pack_end(self.ayas, False, False, 0)
     vb.pack_start(hb, False, False, 0)
     
     show_search = Gtk.Button('أظهر البحث')
     def show_search_cb(w):
         self.notebook.set_current_page(1)
         self.ok_result()
     show_search.connect('clicked', show_search_cb)
     vb.pack_end(show_search, False, False, 0)
     modif_list_tafsir = Gtk.Button('تعديل قائمة التفاسير')
     modif_list_tafsir.connect('clicked', self.show_modif_list_tafsir)
     vb.pack_end(modif_list_tafsir, False, False, 0)
     self.notebook.append_page(vb, Gtk.Label('تصفح'))
     
     vb = Gtk.Box(spacing=7,orientation=Gtk.Orientation.VERTICAL)
     vb.set_border_width(5)
     
     self.tafsirs1 = asm_customs.combo(self.store_tafasir, 'التفسير')
     self.tafsirs1.set_wrap_width(self.n_warp)
     vb.pack_start(self.tafsirs1, False, False, 0)
     self.tafsirs1.set_active(0)
     
     self.search_entry = Gtk.SearchEntry()
     self.search_entry.set_placeholder_text('بحث في القرآن')
     self.search_entry.connect('activate', self.search_on_quran)
     hbox = Gtk.HBox(False, 2)
     hbox.pack_start(self.search_entry, True, True, 0)
     vb.pack_start(hbox, False, False, 0)
     
     self.store_search = Gtk.TreeStore(int, int, str)
     self.tree_search = asm_customs.TreeIndex()
     self.tree_search.set_model(self.store_search)
     cell = Gtk.CellRendererText()
     column = Gtk.TreeViewColumn('السورة', cell, text=2)
     self.tree_search.append_column(column)
     cell = Gtk.CellRendererText()
     column = Gtk.TreeViewColumn('الآية', cell, text=1)
     self.tree_search.append_column(column)
     self.sel_search = self.tree_search.get_selection()
     self.tree_search.connect("cursor-changed", self.ok_result)
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(self.tree_search)
     
     show_browse = Gtk.Button('أظهر التصفح')
     def show_browse_cb(w):
         self.notebook.set_current_page(0)
         self.select_tafsir()
     show_browse.connect('clicked', show_browse_cb)
     vb.pack_end(show_browse, False, False, 0)
     
     scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
     vb.pack_start(scroll, True, True, 0)
     self.notebook.append_page(vb, Gtk.Label('بحث'))
     vbox.pack_start(self.notebook, True, True, 0)
     self.pack_start(vbox, False, False, 0)
     
     self.view_tafsir = asm_customs.ViewClass()
     self.view_tafsir_bfr = self.view_tafsir.get_buffer()
     self.view_tafsir.connect_after("populate-popup", asm_popup.populate_popup, self.parent)
     self.view_quran_tag = self.view_tafsir_bfr.create_tag("quran")
     self.view_search_tag = self.view_tafsir_bfr.create_tag("search")
     self.change_font()
     self.scroll_nasse = Gtk.ScrolledWindow()
     self.scroll_nasse.set_shadow_type(Gtk.ShadowType.IN)
     self.scroll_nasse.add(self.view_tafsir)
     self.pack_start(self.scroll_nasse, True, True, 0)
     
     self.tafsirs.connect('changed', self.select_tafsir)
     self.tafsirs1.connect('changed', self.ok_result)
     self.change_sura = self.suras.connect('changed', self.select_sura)
     self.change_aya = self.ayas.connect('value-changed', self.select_aya)
     self.show_all()
     self.select_aya(self.ayas)