def show_side(self, *a): if asm_config.getn('show_side') == 0: self.list_books.vbox_side.hide() asm_config.setv('show_side', 1) else: self.list_books.vbox_side.show_all() asm_config.setv('show_side', 0)
def search(self, *a): self.add_all_list() text = self.entry_search.get_text() if text == u'': asm_customs.erro(self.parent, 'أدخل النص المراد البحث عنه') if self.stack.get_visible_child_name() == "n1": asm_config.setv('search', 0) if self.selected_books == []: asm_customs.erro(self.parent, 'أنت لم تحدد أين ستبحث') else: try: if len(self.list_terms) == 50: self.list_terms.pop(0) if text in self.list_terms: self.list_terms.remove(text) self.list_terms.append(text) output = open(join(asm_path.DATA_DIR_rw, u'last-terms.pkl'), 'wb') pickle.dump(self.list_terms, output) output.close() except: pass self.hide() self.parent.notebook.set_current_page(1) sr = ShowResult(self.parent) self.parent.viewerbook.append_page(sr,TabLabel(sr, u'بحث عن :'+text)) self.parent.viewerbook.set_current_page(-1) sr.search(text, self.dict_perf, self.dict_field, self.selected_books) else: asm_config.setv('search', 1)
def set_tashkil(self, *a): if asm_config.getn('tashkil') == 0: asm_config.setv('tashkil', 1) self.del_tashkil.set_label("حذف التّشكيل") else: asm_config.setv('tashkil', 0) self.del_tashkil.set_label("إعادة التّشكيل") self.viewerbook.set_tashkil()
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'تم تعليم هذا الموضع')
def change_view(self, *a): if self.list_books.nb.get_current_page() in [0, 1]: self.list_books.nb.set_current_page(2) asm_config.setv('view_books', 1) self.show_icons.set_label("عرض بالأيقونات") elif self.list_books.nb.get_current_page() in [2, 3]: self.list_books.nb.set_current_page(0) asm_config.setv('view_books', 0) self.show_icons.set_label("عرض بالقائمة") self.go_parts.hide()
def ch_color(self, btn): nconf = btn.get_name() dialog = Gtk.ColorChooserDialog("اختر لونا", self.parent) dialog.set_rgba(asm_customs.rgba(asm_config.getv(nconf))) response = dialog.run() if response == Gtk.ResponseType.OK: color = dialog.get_rgba().to_string() asm_config.setv(nconf, color) dialog.destroy() self.parent.theme.refresh()
def ch_font(self, btn): nconf = btn.get_name() dialog = Gtk.FontChooserDialog("اختر خطا", self.parent) dialog.set_font(asm_config.getv(nconf)) response = dialog.run() if response == Gtk.ResponseType.OK: font = dialog.get_font() asm_config.setv(nconf, font) dialog.destroy() self.parent.theme.refresh()
def save_list(self, *a): list_tafsir = eval(asm_config.getv('list_tafsir')) list_tafsir[2] = 1 list_tafsir[1] = [] list_tafsir[0] = self.col_btn.get_active() for a in self.store_tafsir_added: list_tafsir[1].append(a[0]) list_tafsir = repr(list_tafsir) asm_config.setv('list_tafsir', list_tafsir) self.parent.tafsirpage.refresh_list() self.destroy()
def remove_iter(self, *a): (model, i) = self.tree_sav.get_selection().get_selected() if i: id_poem = model.get_value(i, 0) for a in self.list_marks: if a[0] == id_poem: s = self.list_marks.index(a) self.list_marks.pop(s) model.remove(i) marks = repr(self.list_marks) asm_config.setv("marks", marks)
def delete_event_cb(self, *a): asm_config.setv('quran_pos', self.moshafpage.page_id) session = [] session.append(self.viewerbook.session) session.append(self.opened) saved = repr(session) asm_config.setv('start_session', saved) n = self.viewerbook.get_n_pages() for a in range(n): ch = self.viewerbook.get_nth_page(a) try: ch.db_list.set_last(ch.all_in_page[1], ch.id_book) except: pass Gtk.main_quit()
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()
def load_tafasir(self, *a): list_tafsir = eval(asm_config.getv('list_tafsir')) all_tafsir = self.parent.db.all_tafsir() if list_tafsir[2] == 0: for a in all_tafsir: self.store_tafsir_added.append(a) list_tafsir[1].append(a[0]) else: for a in list_tafsir[1]: self.store_tafsir_added.append(self.parent.db.tit_book(a)) for t in all_tafsir: if t[0] not in list_tafsir[1]: self.store_tafsir_no_added.append(t) self.col_btn.set_active(list_tafsir[0]) list_tafsir[2] = 1 list_tafsir = repr(list_tafsir) asm_config.setv('list_tafsir', list_tafsir)
def specified(self, cbox): if cbox.get_active() == 0: self.frame.set_sensitive(False) asm_config.setv('theme', 0) #asm_customs.info(self.parent, "سوف تحتاج إلى إعادة تشغيل المكتبة") elif cbox.get_active() == 1: self.frame.set_sensitive(False) asm_config.setv('theme', 1) elif cbox.get_active() == 2: self.frame.set_sensitive(False) asm_config.setv('theme', 2) else: self.frame.set_sensitive(True) asm_config.setv('theme', 3) self.parent.theme.refresh() self.refresh()
def active_mouse_browse_cb(self, *a): if self.active_mouse_browse.get_active(): asm_config.setv('mouse_browse', 1) else: asm_config.setv('mouse_browse', 0) self.parent.viewerbook.convert_browse()
def auto_browse_cb(self, btn): v = btn.get_active_text() asm_config.setv('auto_browse', int(v)) self.parent.viewerbook.convert_browse()
def time_browse_cb(self, btn): v = btn.get_active() asm_config.setv('time_browse', v) self.parent.viewerbook.convert_browse()
def numbers_cb(self, *a): if self.numbers.get_active(): asm_config.setv('nmbrs', 1) else: asm_config.setv('nmbrs', 0)
def saved_session_cb(self, *a): if self.saved_session.get_active(): asm_config.setv('saved_session', 1) else: asm_config.setv('saved_session', 0)
def remove_iters(self, *a): asm_config.setv("marks", "[]") self.list_marks = [] self.store_sav.clear()
def change_vls(self, btn, nm): v = btn.get_active() asm_config.setv(nm, v)
if not exists(asm_config.getv('path')): res = sure_start() # a تحديد المسار-------------------------- if res == 2: open_dlg = Gtk.FileChooserDialog('تحديد مسار قاعدة البيانات', None, 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]) open_dlg.destroy() library_path = asm_config.getv('path') LIBRARY_DIR_rw = dirname(dirname(library_path)) else: open_dlg.destroy() quit() # a إلغاء التحديد------------------------- elif res == 1: my_return = 0 quit() # a مكتبة مفرغة-------------------------- elif res == 3: save_dlg = Gtk.FileChooserDialog('مسار قاعدة البيانات الجديدة', None,