Exemple #1
0
 def __init__(self, parent):
     self.parent = parent
     self.list_marks = eval(daw_config.getv('marks'))
     Gtk.Dialog.__init__(self, parent=self.parent)
     self.set_icon_name("Dawawin")
     area = self.get_content_area()
     area.set_spacing(6)
     self.set_title('المواضع المحفوظة')
     self.set_default_size(350, 300)
     box = Gtk.Box(spacing=6,orientation=Gtk.Orientation.VERTICAL)
     self.store_sav = Gtk.ListStore(int, str)
     map(self.store_sav.append, self.list_marks)
     self.tree_sav = daw_customs.TreeClass()
     self.tree_sav.connect("row-activated", self.ok_m)
     column = Gtk.TreeViewColumn('اسم الموضع',Gtk.CellRendererText(),text = 1)
     self.tree_sav.append_column(column)
     self.tree_sav.set_model(self.store_sav)
     scroll = Gtk.ScrolledWindow()
     scroll.set_shadow_type(Gtk.ShadowType.IN)
     scroll.add(self.tree_sav)
     remove = daw_customs.ButtonClass("حذف")
     remove.connect('clicked', self.remove_iter)
     hb = Gtk.Box(spacing=5,orientation=Gtk.Orientation.HORIZONTAL)
     hb.pack_start(remove, False, False, 0)
     remove_all = daw_customs.ButtonClass("مسح")
     remove_all.connect('clicked', self.remove_iters)
     hb.pack_start(remove_all, False, False, 0)
     clo = daw_customs.ButtonClass("إغلاق")
     clo.connect('clicked',lambda *a: self.destroy())
     hb.pack_end(clo, False, False, 0)
     box.pack_start(scroll, True, True, 0)
     box.pack_start(hb, False, False, 0)
     area.pack_start(box, True, True, 0)
     self.show_all()
Exemple #2
0
 def ch_font(self, btn):
     nconf = btn.get_name()
     dialog = Gtk.FontChooserDialog("اختر خطا")
     dialog.set_font(daw_config.getv(nconf))
     response = dialog.run()
     if response == Gtk.ResponseType.OK:
         font = dialog.get_font()
         daw_config.setv(nconf, font)
     dialog.destroy()
     self.parent.theme.refrech()
Exemple #3
0
 def ch_color(self, btn):
     nconf = btn.get_name()
     dialog = Gtk.ColorSelectionDialog("اختر لونا")
     colorsel = dialog.get_color_selection()
     colorsel.set_current_rgba(daw_customs.rgba(daw_config.getv(nconf)))
     response = dialog.run()
     if response == Gtk.ResponseType.OK:
         color = colorsel.get_current_color().to_string()
         daw_config.setv(nconf, color)
     dialog.destroy()
     self.parent.theme.refrech()
Exemple #4
0
 def export_html(self, *a):    
     template = self.make_html()
     dir_save = self.dlg_dest()
     if dir_save == None: return
     if not exists(join(dir_save, self.name_poem.encode('utf-8'))):
         try:  mkdir(join(dir_save, self.name_poem))
         except: raise
     file_save = open(join(dir_save, self.name_poem, self.name_poem+'.html'), 'w')
     file_save.write(template)
     file_save.close()
     if daw_config.getv('ornament') == '1':
         copyfile(join(daw_customs.ORNAMENT,self.background_image), join(dir_save, self.name_poem, self.background_image))
Exemple #5
0
 def save_ta3lim(self, *a):
     if self.view_poem_bfr.get_has_selection():
         sel = self.view_poem_bfr.get_selection_bounds()
         sel_text = self.view_poem_bfr.get_text(sel[0], sel[1],True)
         text = daw_tools.one_half(sel_text.decode('utf8'))
         list_marks = eval(daw_config.getv('marks'))
         list_marks.append([self.id_poem, text])
         marks = repr(list_marks)
         daw_config.setv('marks', marks)
         daw_customs.info(self.parent, u'تم تعليم الموضع')
     else:
         daw_customs.erro(self.parent, u'حدد شطرا واحدا من البيت الذي تريد الرجوع إليه')
Exemple #6
0
 def make_html(self, *a):
     if daw_config.getv('ornament') == '1': background = 'background-image: url({});'.format(self.background_image,)
     else: background = 'background-color: {};'.format(self.colorb,)
             
     html_text = self.text_poem.replace('\n', '\n<br>').replace(' ', '&nbsp;')
     template = [
                 u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"', 
                 u'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', 
                 u'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">', 
                 u'<head>', 
                 u'<title>{}</title>'.format(self.name_poem,), 
                 u'<meta http-equiv="content-type" content="text/html; charset=utf-8" />', 
                 u'<style type="text/css">', 
                 u'body {', 
                 u'text-align: center; ', 
                 u'{}'.format(background,), 
                 u'}', 
                 u'span.speaker{', 
                 u'font-family: {};'.format(self.fontan_family,), 
                 u'font-size: {};'.format(self.fontan_size,), 
                 u'color: {};'.format(self.coloran,), 
                 u'}', 
                 u'span.nasse{', 
                 u'font-family: {};'.format(self.fontmp_family,), 
                 u'font-size: {};'.format(self.fontmp_size,), 
                 u'color: {};'.format(self.colormp,), 
                 u'}', 
                 u'</style>', 
                 u'</head>', 
                 u'<body dir="rtl">', 
                 u'<span class="speaker">{}</span><br>'.format(self.name_poet,), 
                 u'<span class="nasse">{}</span>'.format(html_text,), 
                 u'</body>', 
                 u'</html>']
     text =  '\n'.join(template)
     return text.encode('utf-8')
Exemple #7
0
 def __init__(self, parent, name_poem, name_poet, text_poem, font):
     self.parent = parent
     self.background_image = daw_config.getv('ornament-file')
     if daw_config.getv('tr') == '1':
         self.colorb = daw_customs.rgb(daw_config.getv('colorb'))
         self.colormp = daw_customs.rgb(daw_config.getv('colormp'))
         self.coloran = daw_customs.rgb(daw_config.getv('coloran'))
         self.fontan = daw_config.getv('fontan')
     else:
         self.colorb = daw_customs.rgb(colorb)
         self.colormp = daw_customs.rgb(colormp)
         self.coloran = daw_customs.rgb(coloran)
         self.fontan = fontan
         
     self.name_poem = name_poem
     self.name_poet = name_poet
     self.text_poem = text_poem
     fdmp = Pango.FontDescription(font)
     self.fontmp_family = fdmp.get_family()
     self.fontmp_size = font[-2:]+'px'
     fdan = Pango.FontDescription(self.fontan)
     self.fontan_family = fdan.get_family()
     self.fontan_size = self.fontan[-2:]+'px'
Exemple #8
0
 def refrech(self, *a):
     self.apply_preference()
     ornament = daw_config.getv('ornament-file')
     p = join(daw_customs.ORNAMENT, ornament)
     bg0 = join(daw_customs.ICON_DIR, 'bg1.png')
     bg1 = join(daw_customs.ICON_DIR, 'bg0.png')
     if daw_config.getv('ornament') == '1': background = 'background-image: url("{}");'.format(p,)
     else: background = 'background-color: {};'.format(daw_customs.rgb(self.colorb),)
     if not exists(p): background = 'background-color: {};'.format(daw_customs.rgb(self.colorb),)
     css_data = '''
         * {
         -GtkPaned-handle-size: 7;
         }
         View-editable:selected,
         View:selected,
         MyView:selected,
         Treepoem:selected,
         Tree:selected  {
         background-color: '''+daw_customs.rgb(self.colorbs)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colorfs)+''';
         }
         View-editable {
         background-color: '''+daw_customs.rgb(self.colorb)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colorch)+''';
         font: Simplified Naskh 15;
         }
         View {
         background-color: '''+daw_customs.rgb(self.colorb)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colorch)+''';
         font: '''+self.fontch+''';
         }
         Tree {
         background-color: '''+daw_customs.rgb(self.colorbp)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colortd)+''';
         font: '''+self.fonttd+''';
         }
         Treepoem {
         background-color: '''+daw_customs.rgb(self.colorb)+''';
         background-image: none;
         color: '''+daw_customs.rgb(self.colortp)+''';
         font: '''+self.fonttp+''';
         }
         Myscroll, MyView {
         color: '''+daw_customs.rgb(self.colormp)+''';
         font: '''+self.fontmp+''';
         }
         Myscroll, MyView {
         '''+background+'''
         } '''
         
     css_data1 = '''
         GtkToolbar {
         background-image: url("'''+bg1+'''");
         }
         GtkEventbox, GtkWindow, GtkNotebook,
         GtkPaned {
         background-image: url("'''+bg0+'''");
         }
         GtkNotebook tab {
         background-image: none;
         }
         Togglebutton {
         background-image: url("'''+bg1+'''");
         color: #ffffff;
         text-shadow: black 5px 5px 5px;
         border: 1px solid grey;
         }
         Togglebutton:active {
         background-color: grey;
         background-image: none;
         border: 2px solid #555555;
         }
         '''+css_data
         
     screen = Gdk.Screen.get_default()
     css_provider = Gtk.CssProvider()
     context = Gtk.StyleContext()
     try: 
         if daw_config.getv('theme') == '1': css_provider.load_from_data(css_data1)
         else: css_provider.load_from_data(css_data)
     except: css_provider.load_from_data(css_data)
     context.add_provider_for_screen(screen, css_provider,
                                      Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
Exemple #9
0
 def apply_preference(self, *a):
     if daw_config.getv('tr') == '1':
         self.fonttd = daw_config.getv('fonttd')
         self.fonttp = daw_config.getv('fonttp')
         self.fontmp = daw_config.getv('fontmp')
         self.fontch = daw_config.getv('fontch')
         self.fontan = daw_config.getv('fontan')
         self.colortd = daw_config.getv('colortd')
         self.colortp = daw_config.getv('colortp')
         self.colormp = daw_config.getv('colormp')
         self.colorch = daw_config.getv('colorch')
         self.coloran = daw_config.getv('coloran')
         self.colorb = daw_config.getv('colorb')
         self.colorfs = daw_config.getv('colorfs')
         self.colorbs = daw_config.getv('colorbs')
         self.colorss = daw_config.getv('colorss')
         self.colorbp = daw_config.getv('colorbp')
     else:
         self.fonttd = 'KacstOne 15'
         self.fonttp = 'KacstOne 13'
         self.fontmp = 'Simplified Naskh 22'
         self.fontch = 'Amiri 18'
         self.fontan = 'KacstOne 15'
         self.colortd = '#868609091515'
         self.colortp = '#202040400000'
         self.colormp = '#202040400000'
         self.colorch = '#202040400000'
         self.coloran = '#868609091515'
         self.colorb = '#fdfdfdfdd7d7'
         self.colorfs = '#ffffffffffff'
         self.colorbs = '#9e9ec1c17a7a'
         self.colorss = '#fe71fab0870b'
         self.colorbp = '#fcb2eb47aeb5'
Exemple #10
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)
Exemple #11
0
def tashkil(text):
    if daw_config.getv('tashkil') == '0': return daw_araby.stripTashkeel(text)
    else: return text
Exemple #12
0
        
        Filter = Gtk.FileFilter()
        Filter.set_name(u"قاعدة البيانات")
        Filter.add_pattern("Dawawin.db")
        open_dlg.add_filter(Filter)
        
        res = open_dlg.run()
        if res == Gtk.ResponseType.OK:
            daw_config.setv('path', open_dlg.get_filenames()[0])          
            open_dlg.destroy()
        else:
            open_dlg.destroy()
            quit()

#a------------------------------------------
if not exists(daw_config.getv('path')): 
    res = sure_start(None, '''
    لم يتمكن البرنامج من الاتصال بقاعدة البيانات،
    إذا كنت قد نزلتها بالفعل فربما لم تربطها بالبرنامج، 
    أو قد يكون القرص الموجود عليه القاعدة غير مضموم،
    هل تريد تحديد مسار قاعدة البيانات ؟''')
    if res == Gtk.ResponseType.YES:
        change_path_db()
        MY_DATA = daw_config.getv('path')
        MY_DIR = dirname(MY_DATA)
        MY_DICT = join(MY_DIR, 'Dict.db')
        MY_AWZAN = join(MY_DIR, 'Awzan.db')
        AUDIO_DIR = join(MY_DIR, 'Audio')
        ORNAMENT = join(MY_DIR, 'Ornament')
    elif res == Gtk.ResponseType.NO:
        my_return = 0