def change_font(self, *a): ls = [self.tree_add, self.tree_add_doc] for a in ls: szfont, fmfont = asm_customs.split_font( self.parent.theme.font_lists_books) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; } #Tree:selected { color: ''' + asm_customs.rgb( self.parent.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_selected) + '''; } #Tree:hover { color: ''' + asm_customs.rgb(self.parent.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_hover) + '''; } #Tree { color: ''' + asm_customs.rgb( self.parent.theme.color_lists_books) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_lists_books ) + '''; }''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def __init__(self, parent): self.parent = parent self.db = TarajimDB() self.size_font = asm_customs.split_font( self.parent.theme.font_nasse_books)[0] self.all_term = [] Gtk.HPaned.__init__(self) self.set_border_width(3) self.tree_tarjama = Gtk.TreeView() self.tree_tarjama.set_name('Tree') self.sel_tarjama = self.tree_tarjama.get_selection() cell = Gtk.CellRendererText() cell.set_property("ellipsize", Pango.EllipsizeMode.END) kal = Gtk.TreeViewColumn('الرواة', cell, text=1) self.tree_tarjama.append_column(kal) self.store_tarjama = Gtk.TreeStore(int, str) self.tree_tarjama.set_model(self.store_tarjama) scroll = Gtk.ScrolledWindow() scroll.set_shadow_type(Gtk.ShadowType.IN) scroll.add(self.tree_tarjama) self.tree_tarjama.connect("cursor-changed", self.show_tarjama) self.pack1(scroll, True, True) self.view_tarjama = asm_customs.ViewClass() self.view_tarjama.set_name('View') self.view_tarjama_bfr = self.view_tarjama.get_buffer() self.view_tarjama_tag = self.view_tarjama_bfr.create_tag("tarjama") scroll = Gtk.ScrolledWindow() scroll.set_shadow_type(Gtk.ShadowType.IN) scroll.add(self.view_tarjama) self.pack2(scroll, True, True) self.set_position(250) self.show_all()
def __init__(self, parent): self.parent = parent self.db = listDB() self.mycount = Count() self.size_font = asm_customs.split_font( self.parent.theme.font_nasse_books)[0] self.list_modifieds = [] self.build()
def refresh(self, *a): self.apply_preference() szfont, fmfont = asm_customs.split_font(self.font_window) data = ''' * { font-family: "'''+fmfont+'''"; font-size: '''+szfont+'''px;}''' screen = self.parent.get_screen() css_provider = Gtk.CssProvider() context = self.parent.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def change_font(self, *a): ls0 = [self.tree_results] for a in ls0: szfont, fmfont = asm_customs.split_font( self.parent.theme.font_lists_titles) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; } #Tree:selected { color: ''' + asm_customs.rgb( self.parent.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_selected) + '''; } #Tree:hover { color: ''' + asm_customs.rgb(self.parent.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_hover) + '''; } #Tree { color: ''' + asm_customs.rgb( self.parent.theme.color_lists_titles) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_lists_titles ) + '''; }''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #--------------------------------------------------- ls1 = [self.view_nasse] for a in ls1: szfont, fmfont = asm_customs.split_font( self.parent.theme.font_nasse_books) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; color: ''' + asm_customs.rgb( self.parent.theme.color_nasse_books) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_nasse_books) + '''; } #View text selection, #View:selected { color: ''' + asm_customs.rgb( self.parent.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_selected) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #--------------------------------------------------- self.view_title_tag.set_property('foreground', self.parent.theme.color_anawin) self.view_quran_tag.set_property('foreground', self.parent.theme.color_quran) self.view_terms_tag.set_property('foreground', self.parent.theme.color_anawin) self.view_search_tag.set_property('foreground', self.parent.theme.color_searched) self.view_title_tag.set_property('font', self.parent.theme.font_anawin) self.view_quran_tag.set_property('font', self.parent.theme.font_quran) self.view_title_tag.set_property('background', self.parent.theme.background_anawin) self.view_quran_tag.set_property('paragraph-background', self.parent.theme.background_quran) self.view_terms_tag.set_property('background', self.parent.theme.background_anawin) self.view_search_tag.set_property( 'background', self.parent.theme.background_searched)
def change_font(self, *a): ls = [self.list_books.tree_parts, self.organize.tree_group] for a in ls: szfont, fmfont = asm_customs.split_font( self.theme.font_lists_parts) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; } #Tree:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } #Tree:hover { color: ''' + asm_customs.rgb(self.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_hover) + '''; } #Tree { color: ''' + asm_customs.rgb(self.theme.color_lists_parts) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_lists_parts) + '''; }''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls = [self.list_books.tree_books, self.organize.tree_books] for a in ls: szfont, fmfont = asm_customs.split_font( self.theme.font_lists_books) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; } #Tree:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } #Tree:hover { color: ''' + asm_customs.rgb(self.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_hover) + '''; } #Tree { color: ''' + asm_customs.rgb(self.theme.color_lists_books) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_lists_books) + '''; }''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls = [self.list_books.iconview_parts] for a in ls: szfont, fmfont = asm_customs.split_font( self.theme.font_lists_parts) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; color: ''' + asm_customs.rgb(self.theme.color_lists_parts) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_lists_parts) + '''; } #iconview:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } #iconview:hover { color: ''' + asm_customs.rgb(self.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_hover) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls = [self.list_books.iconview_books] for a in ls: szfont, fmfont = asm_customs.split_font( self.theme.font_lists_books) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; color: ''' + asm_customs.rgb(self.theme.color_lists_books) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_lists_books) + '''; } #iconview:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } #iconview:hover { color: ''' + asm_customs.rgb(self.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_hover) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls0 = [ self.list_books.tree_favorite, self.list_books.tree_last, self.winspage.authorpage.tree_author, self.warakapage.tree_waraka, self.winspage.dictpage.tree_dict, self.tafsirpage.tree_search, self.winspage.tarjamapage.tree_tarjama, self.moshafpage.tree_index ] for a in ls0: szfont, fmfont = asm_customs.split_font( self.theme.font_lists_titles) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; } #Tree:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } #Tree:hover { color: ''' + asm_customs.rgb(self.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_hover) + '''; } #Tree { color: ''' + asm_customs.rgb(self.theme.color_lists_titles) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_lists_titles) + '''; }''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls1 = [self.list_books.view_info] for a in ls1: szfont, fmfont = asm_customs.split_font( self.theme.font_nasse_others) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; color: ''' + asm_customs.rgb(self.theme.color_nasse_others) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_nasse_others) + '''; } #View text selection, #View:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls2 = [ self.winspage.authorpage.view_author, self.winspage.dictpage.view_dict, self.winspage.tarjamapage.view_tarjama, self.tafsirpage.view_tafsir ] for a in ls2: szfont, fmfont = asm_customs.split_font( self.theme.font_nasse_books) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; color: ''' + asm_customs.rgb(self.theme.color_nasse_books) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_nasse_books) + '''; } #View text selection, #View:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #----------------------------------------- ls3 = [] for a in ls3: szfont, fmfont = asm_customs.split_font(self.theme.font_lists_side) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; } #Tree:selected { color: ''' + asm_customs.rgb(self.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_selected) + '''; } #Tree:hover { color: ''' + asm_customs.rgb(self.theme.color_hover) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_hover) + '''; } #Tree { color: ''' + asm_customs.rgb(self.theme.color_lists_side) + '''; background-color: ''' + asm_customs.rgb( self.theme.background_lists_side) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) #---------------------------------------- self.winspage.authorpage.view_author_tag.set_property( 'foreground', self.theme.color_anawin) self.winspage.authorpage.view_author_tag.set_property( 'background', self.theme.background_anawin) self.winspage.authorpage.view_author_tag.set_property( 'font', self.theme.font_anawin) self.winspage.dictpage.search_tag.set_property( 'foreground', self.theme.color_searched) self.winspage.dictpage.search_tag.set_property( 'background', self.theme.background_searched) self.winspage.tarjamapage.view_tarjama_tag.set_property( 'foreground', self.theme.color_anawin) self.winspage.tarjamapage.view_tarjama_tag.set_property( 'background', self.theme.background_anawin) self.winspage.tarjamapage.view_tarjama_tag.set_property( 'font', self.theme.font_anawin)
def show_bitaka(self, *a): box = Gtk.Box(spacing=5, orientation=Gtk.Orientation.VERTICAL) bitaka_book = self.db.info_book()[3] info_book = self.db.info_book()[4] dlg = Gtk.Dialog(parent=self.parent) dlg.set_icon_name("asmaa") dlg.set_default_size(450, 300) area = dlg.get_content_area() area.set_spacing(6) hb_bar = Gtk.HeaderBar() hb_bar.set_show_close_button(True) dlg.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.view_info = asm_customs.ViewClass() self.view_info.set_name('View') self.view_info_bfr = self.view_info.get_buffer() scroll = Gtk.ScrolledWindow() scroll.set_shadow_type(Gtk.ShadowType.IN) scroll.add(self.view_info) stack.add_titled(scroll, 'n1', ' بطاقة') self.view_info_bfr.set_text(bitaka_book) self.view_info1 = asm_customs.ViewClass() self.view_info1.set_name('View') self.view_info_bfr1 = self.view_info1.get_buffer() scroll = Gtk.ScrolledWindow() scroll.set_shadow_type(Gtk.ShadowType.IN) scroll.add(self.view_info1) stack.add_titled(scroll, 'n2', 'نبذة') self.view_info_bfr1.set_text(info_book) #----------------------------------------- ls2 = [self.view_info, self.view_info1] for a in ls2: szfont, fmfont = asm_customs.split_font( self.parent.theme.font_nasse_others) data = ''' * { font-family: "''' + fmfont + '''"; font-size: ''' + szfont + '''px; color: ''' + asm_customs.rgb( self.parent.theme.color_nasse_others) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_nasse_others) + '''; } #View text selection, #View:selected { color: ''' + asm_customs.rgb( self.parent.theme.color_selected) + '''; background-color: ''' + asm_customs.rgb( self.parent.theme.background_selected) + '''; } ''' css_provider = Gtk.CssProvider() context = a.get_style_context() css_provider.load_from_data(data.encode('utf8')) context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) box.pack_start(stack, True, True, 0) area.pack_start(box, True, True, 0) dlg.show_all()