[Debian-islamic-commits] [monajat] 07/10: Imported Upstream version 4.1

أحمد المحمودي (Ahmed El-Mahmoudy) aelmahmoudy at users.sourceforge.net
Wed Oct 18 02:39:54 UTC 2017


This is an automated email from the git hooks/post-receive script.

aelmahmoudy-guest pushed a commit to branch master
in repository monajat.

commit c3eb249e32643be258d5adefde837d662115f5c0
Author: أحمد المحمودي (Ahmed El-Mahmoudy) <aelmahmoudy at users.sourceforge.net>
Date:   Wed Oct 18 02:36:03 2017 +0200

    Imported Upstream version 4.1
---
 Makefile                               |   2 +-
 NEWS                                   |  14 ++
 TODO                                   |   2 +-
 gen-db.py                              |   5 +-
 monajat-applet                         |   2 +-
 monajat-mod                            |   4 +-
 monajat.spec                           | 172 +++++++++------
 monajat/applet.py                      | 386 +++++++++++++++++++++++++--------
 monajat/itl.py                         |   8 +-
 monajat/monajat.py                     |   9 +-
 monajat/sqlGenerator.py                |  14 +-
 monajat/utils.py                       |  65 +++---
 po/ar.po                               |  17 ++
 po/en_GB.po                            |  16 ++
 screenlets/Monajat/MonajatScreenlet.py |  18 +-
 setup.py                               |   2 +-
 16 files changed, 507 insertions(+), 229 deletions(-)

diff --git a/Makefile b/Makefile
index 18c8b01..37e643a 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ TARGETS = ${SOURCES:.in=}
 
 ECHO := echo
 NAKE := make
-PYTHON := python2
+PYTHON := python3
 INSTALL := install
 INTLTOOL_MERGE := intltool-merge
 RM := $(shell which rm | egrep '/' | sed  's/\s//g')
diff --git a/NEWS b/NEWS
index fe2a7d9..fe24f7c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+2.6.4:
+* Use notify object per notification
+* Fix unicode
+* Cities search fix
+* Speed up search cities
+* Port SoundPlayer to Gst
+* Port to gtk3
+
+2.6.0:
+* Play Athan audio file
+
+2.5.0:
+* Prayer time support
+
 2.3.1:
 * save/load user preferences like language
 
diff --git a/TODO b/TODO
index b7e102d..d1e68f0 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-
+- fix unicode when running different desktop environments (I tested mate)
 - rewrite monajat screenlets ( may use gtk3 + css )
 
 - display which city
diff --git a/gen-db.py b/gen-db.py
index 896a357..96cb14b 100755
--- a/gen-db.py
+++ b/gen-db.py
@@ -1,5 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 import monajat.sqlGenerator
-monajat.sqlGenerator.generate('monajat-data')
-
+monajat.sqlGenerator.generate('monajat-data')
\ No newline at end of file
diff --git a/monajat-applet b/monajat-applet
index cc51457..bcfedcc 100755
--- a/monajat-applet
+++ b/monajat-applet
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 import sys, os, os.path
 fn=os.path.expanduser('~/.monajat-applet-skip-auto')
diff --git a/monajat-mod b/monajat-mod
index 95a0ac2..a3e1199 100755
--- a/monajat-mod
+++ b/monajat-mod
@@ -1,8 +1,8 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 import os, os.path
 from monajat.monajat import Monajat
 
 m=Monajat()
-print m.get()['text']
+print (m.get()['text'])
 
diff --git a/monajat.spec b/monajat.spec
index c245ba8..ea9aa00 100644
--- a/monajat.spec
+++ b/monajat.spec
@@ -1,120 +1,121 @@
 %global owner ojuba-org
-%global commit #Write commit number here
-
-Name:		monajat
-Summary:	Monajat Islamic Supplications
-URL:		http://ojuba.org
-Version:	2.6.5
-Release:	2%{?dist}
-Source:		https://github.com/%{owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
-License:	WAQFv2 and GPLv2
-Group:		System Environment/Base
-BuildArch:	noarch
-Requires:	python, libitl
-Requires:	libitl
-Requires:	pygobject3 >= 3.0.2
-BuildRequires:	gettext
-BuildRequires:	python
-BuildRequires:	python-setuptools
-BuildRequires:	python2-devel
-
-# /usr/share/gnome-shell/extensions/Monajat at ojuba.org
+
+Name: monajat
+Summary: Monajat Islamic Supplications
+Summary(ar): منظومة أذكار إسلامية
+URL: http://ojuba.org
+Version: 4.1
+Release: 1%{?dist}
+Source: https://github.com/%{owner}/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
+License: WAQFv2 and GPLv2
+BuildArch: noarch
+Requires: python3
+Requires: libitl
+Requires: pygobject3 >= 3.0.2
+BuildRequires: ImageMagick
+BuildRequires: intltool
+BuildRequires: gettext
+BuildRequires: python3-setuptools
+BuildRequires: python3-devel
 
 %description
-Monajat Islamic Supplications
+Monajat Islamic Supplications.
+
+%description -l ar
+منظومة أذكار إسلامية.
 
 %package database
-Group:		System Environment/Base
-Summary:	Monajat Islamic Supplications database
-BuildArch:	noarch
+Summary: Monajat Database
+Summary(ar): قاعدة بيانات مناجاة
+BuildArch: noarch
 
 %description database
-Monajat Islamic Supplications
-
-This is the database used by monajat.
+This is the database used by Monajat.
 
+%description database -l ar
+قاعد البيانات المُستعملة بواسطة برنامج مُناجاة.
 
-%package -n python-monajat
-Group:		System Environment/Base
-Summary:	Monajat Islamic Supplications
-BuildArch:	noarch
-Requires:	python
-Requires:	%{name}-database
-Requires:	libitl
+%package -n python3-monajat
+Summary: Monajat python module
+Summary(ar): وحدة بيثون لمُناجاة
+BuildArch: noarch
+Requires: python3
+Requires: %{name}-database
+Requires: libitl
 
-%description -n python-monajat
-Monajat Islamic Supplications
+%description -n python3-monajat
+This is the python Monajat library needed by all monajat front ends.
 
-This is the python monajat library needed by all monajat front ends
+%description -n python3-monajat -l ar
+مكتبة بيثون لبرنامج مُناجاة و هي مطلوبة لكل واجهات البرنامج.
 
 %package applet
-Summary:	Monajat Islamic Supplications for Desktop Tray Applet
-Group:		System Environment/Base
-BuildArch:	noarch
-Requires:	python-monajat
+Summary: Monajat Tray Applet
+Summary(ar): بريمج مُناجاة لصينية النّظام
+BuildArch: noarch
+Requires: python3-monajat
 # TODO: is it better to say gnome-python2-extras ?
-Requires:	pygtk2
-Requires:	notify-python
-Requires:	desktop-notification-daemon
+Requires: pygtk2
+Requires: notify-python
+Requires: desktop-notification-daemon
 
 %description applet
-Monajat Islamic Supplications
+This package contains Monajat Desktop Tray Applet.
 
-This package contains the Desktop Tray Applet
+%description applet -l ar
+بريمج مُناجاة لصينية النّظام.
 
 %package mod
-Summary:	Monajat Islamic Supplications for console
-Group:		System Environment/Base
-BuildArch:	noarch
-Requires:	python-monajat
+Summary: Monajat for console
+Summary(ar): مُناجاة للطّرفية
+BuildArch: noarch
+Requires: python3-monajat
 
 %description mod
-Monajat Islamic Supplications
+Monajat in terminal.
 
-This package contains a console application that can be used in issue message
-or in the profile
+%description mod -l ar
+مُناجاة في الطّرفية.
 
 %package screenlets
-Summary:	Monajat Islamic Supplications for Screenlets
-Group:		System Environment/Base
-BuildArch:	noarch
-Requires:	screenlets
-Requires:	python-monajat
+Summary: Monajat for Screenlets
+Summary(ar): مُناجاة لسكرينلت
+BuildArch: noarch
+Requires: screenlets
+Requires: python3-monajat
 
 %description screenlets
-Monajat Islamic Supplications
+Monajat in Screenlets.
 
-This package contains screenlets version
+%description screenlets -l ar
+مُناجاة كسكرينلت.
 
 %prep
-%setup -q -n %{name}-%{commit}
+%autosetup -n %{name}-%{version}
 
 %build
 make %{?_smp_mflags}
 
 %install
-%makeinstall DESTDIR=$RPM_BUILD_ROOT
+%make_install
 
 %files database
 %{_datadir}/%{name}/data.db
 
-%files -n python-monajat
-%doc README COPYING TODO NEWS
+%files -n python3-monajat
+%license COPYING
+%doc README TODO NEWS
 %{_defaultdocdir}/%{name}-%{version}/*
-%{python2_sitelib}/%{name}/*.py*
-%{python2_sitelib}/*.egg-info
+%{python3_sitelib}/%{name}/*.py*
+%{python3_sitelib}/*.egg-info
 %{_datadir}/locale/*/*/*.mo
 
 %files applet
-#%{python2_sitelib}/%{name}/applet.py*
-#%{python2_sitelib}/%{name}/utils.py*
 %{_bindir}/%{name}-applet
 %{_datadir}/%{name}/cities.db
 %{_datadir}/%{name}/athan.ogg
 %{_datadir}/%{name}/%{name}.svg
-
 %{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
-#%{_datadir}/icons/hicolor/*/apps/%{name}.png
 /etc/xdg/autostart/*
 
 %files mod
@@ -124,6 +125,37 @@ make %{?_smp_mflags}
 %{_datadir}/screenlets/*
 
 %changelog
+* Mon Feb 27 2017 Mosaab Alzoubi <moceap#hotmail.com> - 4.1-1
+- Fix issues
+
+* Sat Feb 25 2017 Mosaab Alzoubi <moceap#hotmail.com> - 4.0-1
+- Port to Python 3 by Mejlad AlSubaie
+- Native Wayland support by Mejlad AlSubaie
+- Update to 4.0
+
+* Wed Feb 8 2017 Mosaab Alzoubi <moceap#hotmail.com> - 3.1-1
+- Enable run on Wayland
+
+* Wed Feb 8 2017 Mosaab Alzoubi <moceap#hotmail.com> - 3.0-1
+- Update to 3.0
+- New way to Github
+
+* Mon Jul 27 2015 Mosaab Alzoubi <moceap#hotmail.com> - 2.6.6-1
+- Update to 2.6.6
+- Use %%make_install and %%license
+- Add Arabic Summaries and Descriptions
+- General Revision
+
+* Wed Jul 30 2014 Ehab El-Gedawy <ehabsas at gmail.com> - 2.6.5-3
+- New options in the settings for the prayer times
+- Update en_GB.po
+- Update ar.po
+- Add more options in the settings for prayer times.
+- Add previous releases in NEWS file
+- relpace glib with GObject, to prevent (Segmentation fault)
+- fix notification actions
+- fix Gst player 
+
 * Sun Feb 16 2014 Mosaab Alzoubi <moceap at hotmail.com> - 2.6.5-2
 - General Revision.
 
diff --git a/monajat/applet.py b/monajat/applet.py
index 2c49b6d..8000b67 100644
--- a/monajat/applet.py
+++ b/monajat/applet.py
@@ -1,18 +1,43 @@
 # -*- coding: utf-8 -*-
 # -*- Mode: Python; py-indent-offset: 4 -*-
+
+import gi
+gi.require_version('Notify', '0.7')
+gi.require_version('Gtk', '3.0')
+gi.require_version('Notify', '0.7')
+gi.require_version('Gst', '1.0')
+from gi.repository import Gtk, Gdk, Notify, Gst, GObject
+
 import os, os.path
-import itl
-from monajat import Monajat
-from utils import init_dbus
+from monajat import itl
+from monajat.monajat import Monajat
+from monajat.utils import setup_dbus
 import locale, gettext
 import re
 
-from gi.repository import Gtk, Gdk, Notify, Gst, GObject
-import cgi
+import html
 import math
 import json
 import time
 
+from threading import Timer, Thread, Event
+
+def MainTimer(sec):
+    def decorator(function):
+        def wrapper(*args, **kwargs):
+            stopped = Event()
+
+            def loop(): 
+                while not stopped.wait(sec): 
+                    function(*args, **kwargs)
+
+            t = Thread(target=loop)
+            t.daemon = True
+            t.start()
+            return stopped
+        return wrapper
+    return decorator
+
 # in gnome3 ['actions', 'action-icons', 'body', 'body-markup', 'icon-static', 'persistence']
 # in gnome2 ['actions', 'body', 'body-hyperlinks', 'body-markup', 'icon-static', 'sound']
 # "resident"
@@ -47,7 +72,7 @@ class SoundPlayer(object):
         
     def on_message(self, bus, message):
         if message:
-            print message
+            print (message)
         self.gst_player.set_state(Gst.State.NULL)
 
 normalize_tb = {
@@ -61,7 +86,7 @@ def to_uincode(Str):
         Str = str(Str)
     except UnicodeEncodeError:
         pass
-    if type(Str) == unicode:
+    if type(Str) == str:
         return Str.translate(normalize_tb)
     else:
         return Str.decode('utf-8').translate(normalize_tb)
@@ -76,23 +101,41 @@ class ConfigDlg(Gtk.Dialog):
         self.set_resizable(False) # FIXME: reconsider this
         self.connect('delete-event', lambda w,*a: w.hide() or True)
         self.connect('response', lambda w,*a: w.hide() or True)
-        self.set_title(_('Monajat Configuration'))
-        self.add_button(_('Cancel'), Gtk.ResponseType.CANCEL)
-        self.add_button(_('Save'), Gtk.ResponseType.OK)
+        self.set_title(('Monajat Configuration'))
+        self.add_button(('Cancel'), Gtk.ResponseType.CANCEL)
+        self.add_button(('Save'), Gtk.ResponseType.OK)
         tabs = Gtk.Notebook()
         tabs.set_size_request(-1,350)
         self.get_content_area().add(tabs)
         vb = Gtk.VBox(False, 2)
-        tabs.append_page(vb, Gtk.Label(_('Generic')))
-        self.auto_start = b = Gtk.CheckButton(_("Auto start"))
+        tabs.append_page(vb, Gtk.Label(('Generic')))
+        self.auto_start = b = Gtk.CheckButton(("Auto start"))
         self.auto_start.set_active(not os.path.exists(self.applet.skip_auto_fn))
         vb.pack_start(b, False, False, 2)
-        self.show_merits = b = Gtk.CheckButton(_("Show merits"))
+        self.show_merits = b = Gtk.CheckButton(("Show merits"))
         self.show_merits.set_active(self.applet.conf['show_merits'])
         vb.pack_start(b, False, False, 2)
+        self.daylight_savings_time = b = Gtk.CheckButton(("daylight_savings_time"))
+        self.daylight_savings_time.set_active(self.applet.conf['daylight_savings_time'])
+        vb.pack_start(b, False, False, 2)        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(('method:')), False, False, 2)
+        self.pt_method = b = Gtk.ComboBoxText.new()
+        hb.pack_end(b, False, False, 2)
+        b.append_text("none. Set to default")
+        b.append_text("Egyptian General Authority of Survey")
+        b.append_text("University of Islamic Sciences, Karachi (Shaf'i)")
+        b.append_text("University of Islamic Sciences, Karachi (Hanafi)")
+        b.append_text("Islamic Society of North America")
+        b.append_text("Muslim World League (MWL)")
+        b.append_text("Umm Al-Qurra, Saudi Arabia")
+        b.append_text("Fixed Ishaa Interval (always 90)")
+        b.append_text("Egyptian General Authority of Survey (Egypt)")
+        b.set_active(self.applet.conf['pt_method'])      
         hb = Gtk.HBox()
         vb.pack_start(hb, False, False, 2)
-        hb.pack_start(Gtk.Label(_('Language:')), False, False, 2)
+        hb.pack_start(Gtk.Label(('Language:')), False, False, 2)
         self.lang = b = Gtk.ComboBoxText.new()
         hb.pack_end(b, False, False, 2)
         selected = 0
@@ -104,20 +147,20 @@ class ConfigDlg(Gtk.Dialog):
         
         hb = Gtk.HBox()
         vb.pack_start(hb, False, False, 2)
-        hb.pack_start(Gtk.Label(_('Time:')), False, False, 2)
+        hb.pack_start(Gtk.Label(('Time:')), False, False, 2)
         hb.pack_start(Gtk.HBox(), True, True, 2)
         adj = Gtk.Adjustment(5, 0, 90, 5, 5)
         self.timeout = b = Gtk.SpinButton()
         b.set_adjustment(adj)
         b.set_value(self.applet.conf['minutes'])
         hb.pack_start(b, False, False, 2)
-        hb.pack_start(Gtk.Label(_('minutes')), False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
 
         vb = Gtk.VBox(False, 2)
-        tabs.append_page(vb, Gtk.Label(_('Location')))
+        tabs.append_page(vb, Gtk.Label(('Location')))
         
         hb = Gtk.HBox()
-        hb.pack_start(Gtk.Label(_('Current city:')), False, False, 2)
+        hb.pack_start(Gtk.Label(('Current city:')), False, False, 2)
         vb.pack_start(hb, False, False, 6)
         hb = Gtk.HBox()
         vb.pack_start(hb, False, False, 2)
@@ -128,7 +171,7 @@ class ConfigDlg(Gtk.Dialog):
             self.user_city = c['name']
         else:
             c = {}
-            c['country'] = _('Please, Secify your city')
+            c['country'] = ('Please, Secify your city')
             c['state'] = ''
             c['name'] = ''
             c['locale_name'] = ''
@@ -142,7 +185,7 @@ class ConfigDlg(Gtk.Dialog):
         hb.pack_start(l, True, True, 2)
         
         hb = Gtk.HBox()
-        hb.pack_start(Gtk.Label(_('Change city:')), False, False, 2)
+        hb.pack_start(Gtk.Label(('Change city:')), False, False, 2)
         vb.pack_start(hb, False, False, 8)
         self.Search_e = e = Gtk.Entry()
         e.connect('activate', self._city_search_cb)
@@ -164,32 +207,112 @@ class ConfigDlg(Gtk.Dialog):
         vb.pack_start(scroll, True, True, 2)
         self.sound_player = SoundPlayer(self.applet.conf['athan_media_file'],
                                         self.change_play_status)
+
         vb = Gtk.VBox(False, 2)
-        tabs.append_page(vb, Gtk.Label(_('Notification')))
+        tabs.append_page(vb, Gtk.Label(('Edit_pt')))
+        
+        self.Edit_pt = b = Gtk.CheckButton(("Edit_pt"))
+        self.Edit_pt.set_active(self.applet.conf['Edit_pt'])
+        vb.pack_start(b, False, False, 2)
+
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(('Fajr')), False, False, 2)
+        hb.pack_start(Gtk.HBox(), True, True, 2)
+        adj = Gtk.Adjustment(5, -60, 60, 1, 5)
+        self.Fajr_min = b = Gtk.SpinButton()
+        b.set_adjustment(adj)
+        b.set_value(self.applet.conf['Fajr_minutes'])
+        hb.pack_start(b, False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
+        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(('Sunrise')), False, False, 2)
+        hb.pack_start(Gtk.HBox(), True, True, 2)
+        adj = Gtk.Adjustment(5, -60, 60, 1, 5)
+        self.Shrooq_min = b = Gtk.SpinButton()
+        b.set_adjustment(adj)
+        b.set_value(self.applet.conf['Shrooq_minutes'])
+        hb.pack_start(b, False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
+        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(('Dhuhr')), False, False, 2)
+        hb.pack_start(Gtk.HBox(), True, True, 2)
+        adj = Gtk.Adjustment(5, -60, 60, 1, 5)
+        self.Zuhr_min = b = Gtk.SpinButton()
+        b.set_adjustment(adj)
+        b.set_value(self.applet.conf['Zuhr_minutes'])
+        hb.pack_start(b, False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
+        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(('Asr')), False, False, 2)
+        hb.pack_start(Gtk.HBox(), True, True, 2)
+        adj = Gtk.Adjustment(5, -60, 60, 1, 5)
+        self.Asr_min = b = Gtk.SpinButton()
+        b.set_adjustment(adj)
+        b.set_value(self.applet.conf['Asr_minutes'])
+        hb.pack_start(b, False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
+        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(('Maghrib')), False, False, 2)
+        hb.pack_start(Gtk.HBox(), True, True, 2)
+        adj = Gtk.Adjustment(5, -60, 60, 1, 5)
+        self.Maghrib_min = b = Gtk.SpinButton()
+        b.set_adjustment(adj)
+        b.set_value(self.applet.conf['Maghrib_minutes'])
+        hb.pack_start(b, False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
+        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        hb.pack_start(Gtk.Label(("Isha'a")), False, False, 2)
+        hb.pack_start(Gtk.HBox(), True, True, 2)
+        adj = Gtk.Adjustment(5, -60, 60, 1, 5)
+        self.Ishaa_min = b = Gtk.SpinButton()
+        b.set_adjustment(adj)
+        b.set_value(self.applet.conf['Ishaa_minutes'])
+        hb.pack_start(b, False, False, 2)
+        hb.pack_start(Gtk.Label(('minutes')), False, False, 2)
+        
+        hb = Gtk.HBox()
+        vb.pack_start(hb, False, False, 2)
+        self.clear = cb = Gtk.Button(('Clear'))
+        cb.connect('clicked', self.clear_pt_changes)
+        hb.pack_end(cb, False, False, 2)
+
+        vb = Gtk.VBox(False, 2)
+        tabs.append_page(vb, Gtk.Label(('Notification')))
         hb = Gtk.HBox()
         vb.pack_start(hb, False, True, 3)
-        hb.pack_start(Gtk.Label(_('Sound:')), False, True, 2)
-        self.sound_file = b = Gtk.FileChooserButton(_('Choose Athan media file'))
+        hb.pack_start(Gtk.Label(('Sound:')), False, True, 2)
+        self.sound_file = b = Gtk.FileChooserButton(('Choose Athan media file'))
         
         if os.path.isfile(self.applet.conf['athan_media_file']):
             self.sound_file.set_filename(self.applet.conf['athan_media_file'])
         ff = Gtk.FileFilter()
-        ff.set_name(_('Sound Files'))
+        ff.set_name(('Sound Files'))
         ff.add_pattern('*.ogg')
         ff.add_pattern('*.mp3')
         b.add_filter(ff)
         ff = Gtk.FileFilter()
-        ff.set_name(_('All files'))
+        ff.set_name(('All files'))
         ff.add_pattern('*')
         b.add_filter(ff)
-        self.play_b = pb = Gtk.Button(_('Play'))
+        self.play_b = pb = Gtk.Button(('Play'))
         pb.connect('clicked', self.play_cb)
         hb.pack_end(pb, False, False, 2)
         hb.pack_end(b, True, True, 5)
         
         hb = Gtk.HBox()
         vb.pack_start(hb, False, False, 3)
-        self.notify_before_b = b = Gtk.CheckButton(_("Notify before"))
+        self.notify_before_b = b = Gtk.CheckButton(("Notify before"))
         adj = Gtk.Adjustment(5, 5, 20, 5, 5)
         self.notify_before_t = t = Gtk.SpinButton()
         t.set_adjustment(adj)
@@ -197,25 +320,33 @@ class ConfigDlg(Gtk.Dialog):
         t.set_value(self.applet.conf['notify_before_min'])
         hb.pack_start(b,True,True,2)
         hb.pack_start(t,False,False,2)
-        hb.pack_start(Gtk.Label(_('minutes')),False,False,2)
+        hb.pack_start(Gtk.Label(('minutes')),False,False,2)
         self._city_search_cb(self.Search_e, self.user_city)
         #self._fill_cities()
 
+    def clear_pt_changes(self, b):
+        self.Fajr_min.set_value(0)
+        self.Shrooq_min.set_value(0)
+        self.Zuhr_min.set_value(0)
+        self.Asr_min.set_value(0)
+        self.Maghrib_min.set_value(0)
+        self.Ishaa_min.set_value(0)           
+        
     def change_play_status(self, status = None):
         if status == None:
             status = self.sound_player.gst_player.get_state()
         if status == Gst.State.PLAYING:
             self.sound_file.set_sensitive(False)
-            self.play_b.set_property('label', _('Stop'))
+            self.play_b.set_property('label', ('Stop'))
         else:
             self.sound_file.set_sensitive(True)
-            self.play_b.set_property('label', _('Play'))
+            self.play_b.set_property('label', ('Play'))
 
     def play_cb(self, b):
         fn = self.sound_file.get_filename()
         if not fn:
             fn = ''
-        if b.get_label() == _('Play'):
+        if b.get_label() == ('Play'):
             if not os.path.isfile(fn):
                 return
             self.change_play_status(Gst.State.PLAYING)
@@ -287,7 +418,7 @@ class ConfigDlg(Gtk.Dialog):
         # FIXME: if same as last successful search text don't update first_match_path
         # FIXME: and if self.city_found same as first_match_path highlight in red
         # we can use self.search_last_path to fix search
-        if type(txt) == unicode:
+        if type(txt) == bytes:
             txt = txt.encode('utf-8')
         e = self.Search_e
         e.modify_fg(Gtk.StateType.NORMAL, None)
@@ -397,15 +528,21 @@ class applet(object):
         self.prayer_items = []
         kw = self.conf_to_prayer_args()
         self.prayer = itl.PrayerTimes(**kw)
+        
+        self.prayer.method.extreme=int(self.conf['pt_method'])
+        self.prayer.method.offset=self.conf['Edit_pt']
+        if self.conf['Edit_pt'] == 1:
+            self.prayer.method.offList[0]=self.conf['Fajr_minutes']
+            self.prayer.method.offList[1]=self.conf['Shrooq_minutes']
+            self.prayer.method.offList[2]=self.conf['Zuhr_minutes']
+            self.prayer.method.offList[3]=self.conf['Asr_minutes']
+            self.prayer.method.offList[4]=self.conf['Maghrib_minutes']
+            self.prayer.method.offList[5]=self.conf['Ishaa_minutes']
+
         self._init_locale(self.m.lang)
         ld = os.path.join(self.m.get_prefix(), '..', 'locale')
-        gettext.install('monajat', ld, unicode=0)
-        self.ptnames = [_("Fajr"),
-                        _("Sunrise"),
-                        _("Dhuhr"),
-                        _("Asr"),
-                        _("Maghrib"),
-                        _("Isha'a")]
+        gettext.install('monajat', ld)
+        self.ptnames = [("Fajr"),("Sunrise"),("Dhuhr"),("Asr"),("Maghrib"),("Isha'a")]
         self.clip1 = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
         self.clip2 = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
         self.init_menu()
@@ -414,12 +551,12 @@ class applet(object):
         self.statusicon = Gtk.StatusIcon ()
         self.statusicon.connect('popup-menu',self.popup_cb)
         self.statusicon.connect('activate',self.next_cb)
-        self.statusicon.set_title(_("Monajat"))
+        self.statusicon.set_title(("Monajat"))
         self.statusicon.set_from_file(os.path.join(self.m.get_prefix(),'monajat.svg'))
         
-        Notify.init(_("Monajat"))
+        Notify.init(("Monajat"))
         self.init_notify_cb()
-        print self.notifycaps
+        print (self.notifycaps)
         
         self.notif_last_athan = -1
         self.next_athan_delta = -1
@@ -428,17 +565,18 @@ class applet(object):
         self.last_time = 0
         self.first_notif_done = False
         self.start_time = time.time()
-        GObject.timeout_add(1, self.timer_cb)
+        #GObject.timeout_add(1, self.timer_cb)
+        self.timer_cb()
 
     def init_notify_cb(self):
         self.notifycaps = Notify.get_server_caps ()
         self.notify = Notify.Notification()
         self.notify.set_property('icon-name', os.path.join(self.m.get_prefix(),'monajat.svg'))
-        self.notify.set_property('summary', _("Monajat") )
+        self.notify.set_property('summary', ("Monajat") )
         if 'actions' in self.notifycaps:
-            self.notify.add_action("previous", _("Back"), self.notify_cb, None)
-            self.notify.add_action("next", _("Forward"), self.notify_cb, None)
-            self.notify.add_action("copy", _("copy"), self.notify_cb, None)
+            self.notify.add_action("previous", ("Back"), self.notify_cb, None)
+            self.notify.add_action("next", ("Forward"), self.notify_cb, None)
+            self.notify.add_action("copy", ("copy"), self.notify_cb, None)
         
     def show_notify_cb(self, body, *args):
         self.notify.set_property('body', body )
@@ -456,15 +594,24 @@ class applet(object):
     def default_conf(self):
         self.conf = {}
         self.conf['show_merits'] = '1'
+        self.conf['daylight_savings_time']='1'
+        self.conf['pt_method']='6'
+        self.conf['Edit_pt']='0'
+        self.conf['Fajr_minutes']='0'
+        self.conf['Shrooq_minutes']='0'
+        self.conf['Zuhr_minutes']='0'
+        self.conf['Asr_minutes']='0'
+        self.conf['Maghrib_minutes']='0'
+        self.conf['Ishaa_minutes']='0'
         self.conf['lang'] = self.m.lang
         self.conf['minutes'] = '10'
         self.conf['athan_media_file'] = os.path.join(self.m.prefix, 'athan.ogg')
-        print self.conf['athan_media_file']
+        print (self.conf['athan_media_file'])
         self.conf['notify_before_min'] = '10'
 
     def conf_to_prayer_args(self):
         kw = {}
-        if not self.conf.has_key('city_id'): return kw
+        if 'city_id' not in self.conf: return kw
         c = self.m.cities_c
         try:
             c_id = int(self.conf['city_id'])
@@ -482,7 +629,8 @@ class applet(object):
             kw["alt"] = 0.0
         kw["tz"] = kw["utc"]
         # NOTE: get DST from machine local setting
-        kw["dst"] = time.localtime().tm_isdst
+        #kw["dst"] = time.localtime().tm_isdst
+        kw["dst"] = self.conf['daylight_savings_time']
         # FIXME: dst should have the following 3 options
         # a. auto from system, b. auto from algorithm, c. specified to 0/1 by user
         #dst=kw["dst_id"]
@@ -490,17 +638,17 @@ class applet(object):
         #else:
         #    # FIXME: add DST logic here
         #    kw["dst"]=1
-        print kw
+        print (kw)
         #lat=21.43, lon=39.77, tz=3.0, dst=0, alt=0, pressure=1010, temp=10
         return kw
 
 
     def parse_conf(self, s):
         self.default_conf()
-        l1 = map(lambda k: k.split('=',1),
+        l1 = list(map(lambda k: k.split('=',1),
                  filter(lambda j: j,
-                 map(lambda i: i.strip(),s.splitlines())) )
-        l2 = map(lambda a: (a[0].strip(),a[1].strip()),filter(lambda j: len(j)==2,l1))
+                 map(lambda i: i.strip(),s.splitlines())) ))
+        l2 = list(map(lambda a: (a[0].strip(),a[1].strip()),filter(lambda j: len(j)==2,l1)))
         r = dict(l2)
         self.conf.update(dict(l2))
         return len(l1) == len(l2)
@@ -514,9 +662,9 @@ class applet(object):
             except OSError:
                 pass
         self.parse_conf(s)
-        if self.conf.has_key('city_id'):
+        if 'city_id' in self.conf:
             # make sure city_id is set using the same db
-            if not self.conf.has_key('cities_db_ver') \
+            if 'cities_db_ver' not in self.conf \
                or self.conf['cities_db_ver'] != self.m.cities_db_ver:
                    del self.conf['city_id']
             # make sure it's integer
@@ -543,6 +691,42 @@ class applet(object):
         except ValueError:
             self.conf['show_merits'] = 1
         try:
+            self.conf['daylight_savings_time'] = int(self.conf['daylight_savings_time']) 
+        except ValueError:
+            self.conf['daylight_savings_time'] = 1            
+        try:
+            self.conf['pt_method'] = int(self.conf['pt_method']) 
+        except ValueError:
+            self.conf['pt_method'] = 6        
+        try:
+            self.conf['Edit_pt'] = int(self.conf['Edit_pt']) 
+        except ValueError:
+            self.conf['Edit_pt'] = 0            
+        try:
+            self.conf['Fajr_minutes'] = int(self.conf['Fajr_minutes']) 
+        except ValueError:
+            self.conf['Fajr_minutes'] = 0            
+        try:
+            self.conf['Shrooq_minutes'] = int(self.conf['Shrooq_minutes']) 
+        except ValueError:
+            self.conf['Shrooq_minutes'] = 0            
+        try:
+            self.conf['Zuhr_minutes'] = int(self.conf['Zuhr_minutes']) 
+        except ValueError:
+            self.conf['Zuhr_minutes'] = 0            
+        try:
+            self.conf['Asr_minutes'] = int(self.conf['Asr_minutes']) 
+        except ValueError:
+            self.conf['Asr_minutes'] = 0            
+        try:
+            self.conf['Maghrib_minutes'] = int(self.conf['Maghrib_minutes']) 
+        except ValueError:
+            self.conf['Maghrib_minutes'] = 0             
+        try:
+            self.conf['Ishaa_minutes'] = int(self.conf['Ishaa_minutes']) 
+        except ValueError:
+            self.conf['Ishaa_minutes'] = 0    
+        try:
             self.conf['notify_before_min'] = int(float(self.conf['notify_before_min']))
         except ValueError:
             self.conf['notify_before_min'] = 10
@@ -552,15 +736,36 @@ class applet(object):
     def apply_conf(self):
         kw = self.conf_to_prayer_args()
         self.prayer = itl.PrayerTimes(**kw)
+
+        self.prayer.method.extreme=int(self.conf['pt_method'])
+        self.prayer.method.offset=self.conf['Edit_pt']
+        if self.conf['Edit_pt'] == 1:
+            self.prayer.method.offList[0]=self.conf['Fajr_minutes']
+            self.prayer.method.offList[1]=self.conf['Shrooq_minutes']
+            self.prayer.method.offList[2]=self.conf['Zuhr_minutes']
+            self.prayer.method.offList[3]=self.conf['Asr_minutes']
+            self.prayer.method.offList[4]=self.conf['Maghrib_minutes']
+            self.prayer.method.offList[5]=self.conf['Ishaa_minutes']
+
         self.update_prayer()
         self.sound_player.set_filename(self.conf['athan_media_file'])
         self.m.clear()
         self.m.set_lang(self.conf['lang'])
         self.render_body(self.m.go_forward())
+        self.last_time = time.time()
 
     def save_conf(self):
         self.conf['cities_db_ver'] = self.m.cities_db_ver
         self.conf['show_merits'] = int(self.conf_dlg.show_merits.get_active())
+        self.conf['daylight_savings_time'] = int(self.conf_dlg.daylight_savings_time.get_active())
+        self.conf['pt_method'] = int(self.conf_dlg.pt_method.get_active())
+        self.conf['Edit_pt']=int(self.conf_dlg.Edit_pt.get_active())
+        self.conf['Fajr_minutes']=int(self.conf_dlg.Fajr_min.get_value())
+        self.conf['Shrooq_minutes']=int(self.conf_dlg.Shrooq_min.get_value())
+        self.conf['Zuhr_minutes']=int(self.conf_dlg.Zuhr_min.get_value())
+        self.conf['Asr_minutes']=int(self.conf_dlg.Asr_min.get_value())
+        self.conf['Maghrib_minutes']=int(self.conf_dlg.Maghrib_min.get_value())
+        self.conf['Ishaa_minutes']=int(self.conf_dlg.Ishaa_min.get_value())
         self.conf['lang'] = self.conf_dlg.lang.get_active_text()
         self.conf['minutes'] = int(self.conf_dlg.timeout.get_value())
         self.conf['athan_media_file'] = self.conf_dlg.sound_file.get_filename()
@@ -571,7 +776,7 @@ class applet(object):
             city_id = m[p[0]][2]
             if city_id:
                 self.conf['city_id'] = city_id
-        print "** saving conf", self.conf
+        print ("** saving conf", self.conf)
         fn = os.path.expanduser('~/.monajat-applet.rc')
         s = '\n'.join(map(lambda k: "%s=%s" % (k,str(self.conf[k])), self.conf.keys()))
         try:
@@ -584,7 +789,7 @@ class applet(object):
         self.last_time = time.time()
         self.first_notif_done = True
         s = self.ptnames[self.last_athan]
-        self.show_notify_cb(_('''It's now time for %s prayer''') % s)
+        self.show_notify_cb(('''It's now time for %s prayer''') % s)
         return True
 
     def athan_notif_cb(self):
@@ -596,17 +801,17 @@ class applet(object):
         self.next_athan_delta = dt
         self.next_athan_i = i
         if dt < 30 and i != self.last_athan:
-            print "it's time for prayer number:", i
+            print ("it's time for prayer number:", i)
             self.last_athan = i
             self.sound_player.play()
             self.athan_show_notif()
             return True
         return False
-
+    @MainTimer(0.5)
     def timer_cb(self, *args):
         if not 'actions' in self.notifycaps:
             self.init_notify_cb()
-            print self.notifycaps
+            print (self.notifycaps)
         dt = int(time.time()-self.last_time)
         if self.prayer.update():
             self.update_prayer()
@@ -620,8 +825,8 @@ class applet(object):
            and self.next_athan_i != self.notif_last_athan:
                self.notif_last_athan = self.next_athan_i
                self.next_cb()
-        elif self.conf['minutes'] and dt >= self.conf['minutes']*60:
-               self.next_cb()
+        elif self.conf['minutes'] and dt >= (self.conf['minutes']*60):
+            self.next_cb()
         return True
 
     def fuzzy_delta(self):
@@ -634,19 +839,19 @@ class applet(object):
         d['minutes'] = t/60
         if d["hours"]:
             if d["minutes"] < 5:
-                r = _("""%(hours)d hours till %(prayer)s prayer""") % d
+                r = ("""%(hours)d hours till %(prayer)s prayer""") % d
             else:
-                r = _("""%(hours)d hours and %(minutes)d minutes till %(prayer)s prayer""") % d
+                r = ("""%(hours)d hours and %(minutes)d minutes till %(prayer)s prayer""") % d
         elif d["minutes"] >= 2:
-            r = _("""less than %(minutes)d minutes till %(prayer)s prayer""") % d
+            r = ("""less than %(minutes)d minutes till %(prayer)s prayer""") % d
         else:
-            r = _("""less than a minute till %(prayer)s prayer""") % d
+            r = ("""less than a minute till %(prayer)s prayer""") % d
         if "body-markup" in self.notifycaps:
-            return "<b>%s</b>\n\n" % cgi.escape(r)
+            return "<b>%s</b>\n\n" % html.escape(r)
         return "%s\n\n" % r
 
     def body_to_str(self, body):
-        if type(body) == unicode:
+        if type(body) == bytes:
             return body.encode('utf-8')
         return body
         
@@ -655,30 +860,26 @@ class applet(object):
         if not self.conf['show_merits']:
             merits = None
         if "body-markup" in self.notifycaps:
-            body = cgi.escape(m['text'])
+            body = html.escape(m['text'])
             if merits:
-                body = """{}\n\n<b>{}</b>: {}""".format(self.body_to_str(body),
-                                                        _("Its Merits"),
-                                                        self.body_to_str(cgi.escape(merits)))
+                body = """{}\n\n<b>{}</b>: {}""".format(self.body_to_str(body),("Its Merits"),self.body_to_str(html.escape(merits)))
         else:
             body = m['text']
             if merits:
-                body = """{}\n\n** {} **: {}""".format(self.body_to_str(body),
-                                                       _("Its Merits"),
-                                                       self.body_to_str(merits))
-        if type(body) == unicode:
+                body = """{}\n\n** {} **: {}""".format(self.body_to_str(body),("Its Merits"),self.body_to_str(merits))
+        if type(body) == bytes:
                 body = body.encode('utf-8')
         if "body-hyperlinks" in self.notifycaps:
             L = []
             links = m.get('links',u'').split(u'\n')
             for l in links:
                 ll = l.split(u'\t',1)
-                url = cgi.escape(ll[0])
+                url = html.escape(ll[0])
                 if len(ll) > 1:
-                    t = cgi.escape(ll[1])
+                    t = html.escape(ll[1])
                 else:
                     t = url
-                print url, t
+                print (url, t)
                 L.append(u"""<a href='{}'>{}</a>""".format(url,t))
             l = u"\n\n".join(L)
             body += self.body_to_str("\n\n" + l)
@@ -719,15 +920,17 @@ class applet(object):
         # FIXME: please add more the authors
         dlg = Gtk.AboutDialog()
         dlg.set_default_response(Gtk.ResponseType.CLOSE)
-        dlg.set_icon_from_file(os.path.join(self.m.get_prefix(),'monajat.svg'))
+        
+        dlg.set_logo_icon_name('monajat')
         try:
             dlg.set_program_name("Monajat")
         except:
             pass
-        dlg.set_name(_("Monajat"))
+        dlg.set_name(("Monajat"))
         #dlg.set_version(version)
-        dlg.set_copyright("Copyright © 2009 sabily.org")
-        dlg.set_comments(_("Monajat supplications"))
+        dlg.set_copyright("""Copyright © 2009 sabily.org
+        Copyright © 2010-2017 Sabily, Ojuba Team""")
+        dlg.set_comments(("Monajat supplications"))
         dlg.set_license("""\
         This program is free software; you can redistribute it and/or modify
         it under the terms of the GNU General Public License as published by
@@ -765,7 +968,8 @@ class applet(object):
         pt = self.prayer.get_prayers()
         j = 0
         ptn = list(self.ptnames)
-        ptn[1] = ''
+        #if you want to disable sunrise time showing from the popup menu use the commands in line 952 and 980
+        #ptn[1] = ''
         for p,t in zip(ptn, pt):
             if not p: continue
             i = Gtk.MenuItem
@@ -792,7 +996,9 @@ class applet(object):
         self.menu.add(Gtk.SeparatorMenuItem.new())
 
         self.prayer_items = []
-        for j in range(5):
+        #for disabling sunerise time from the popup menu
+        #for j in range(5):
+        for j in range(6):
             i = Gtk.MenuItem("-")
             self.prayer_items.append(i)
             self.menu.add(i)
@@ -800,7 +1006,7 @@ class applet(object):
 
         self.menu.add(Gtk.SeparatorMenuItem.new())
         
-        i = Gtk.MenuItem(_("Configure"))
+        i = Gtk.MenuItem(("Configure"))
         i.connect('activate', self.config_cb)
         self.menu.add(i)
         
@@ -850,10 +1056,10 @@ class applet(object):
 
 def applet_main():
     Gtk.Window.set_default_icon_name('monajat')
-    a = applet()
-    init_dbus(a.dbus_cb)
+    #a = applet
+    setup_dbus(applet)
     Gtk.main()
+    
 
 if __name__ == "__main__":
     applet_main()
-
diff --git a/monajat/itl.py b/monajat/itl.py
index 6770298..7418faa 100644
--- a/monajat/itl.py
+++ b/monajat/itl.py
@@ -214,7 +214,7 @@ class PrayerTimes:
         self.location.degreeLat=lat
         self.location.gmtDiff=tz
         self.location.dst=dst
-        print tz,dst
+        print (tz,dst)
         self.location.seaLevel = alt
         self.location.pressure = pressure
         self.location.temperature= temp
@@ -250,7 +250,7 @@ class PrayerTimes:
         t=int(time.time())
         d=time.localtime()
         t-=d.tm_hour*3600+d.tm_min*60+d.tm_sec
-        self.stamps=map(lambda p: t+p.hour*3600+p.minute*60+p.second, self.get_prayers(cache))
+        self.stamps=list(map(lambda p: t+p.hour*3600+p.minute*60+p.second, self.get_prayers(cache)))
         self.stamps.append(self.stamps[0]+86400)
         return self.stamps
 
@@ -274,7 +274,7 @@ if __name__ == "__main__":
         # high level examples for Mecca
         pt=PrayerTimes()
         for i in pt.get_prayers():
-            print i.hour, i.minute, i.second
+            print (i.hour, i.minute, i.second)
         # low level examples for Abu Dhabi
         loc=Location()
         date=Date()
@@ -294,6 +294,6 @@ if __name__ == "__main__":
         method.round = 0
         ptList=getPrayerTimes(loc, method, date)
         for i in ptList:
-            print i.hour, i.minute, i.second
+            print (i.hour, i.minute, i.second)
 
 
diff --git a/monajat/monajat.py b/monajat/monajat.py
index 83b4273..93b804b 100644
--- a/monajat/monajat.py
+++ b/monajat/monajat.py
@@ -68,9 +68,11 @@ class Monajat (object):
 
         self.prefix=self.guess_prefix()
         self.db=os.path.join(self.prefix,'data.db')
-        self.cn=sqlite3.connect(self.db)
+        #self.db='/home/mjlad/PycharmProjects/monajat-master/monajat-data/data.db'
+        print(self.db)
+        self.cn=sqlite3.connect(self.db, check_same_thread = False)
         self.c=self.cn.cursor()
-        self.langs=map(lambda a: a[0],self.c.execute(SQL_GET_LANGS).fetchall())
+        self.langs=list(map(lambda a: a[0],self.c.execute(SQL_GET_LANGS).fetchall()))
         self.lang_boundary={}
         for l in self.langs:
             i=self.c.execute(SQL_GET_LANG_START, (l,)).fetchone()[0]
@@ -81,11 +83,12 @@ class Monajat (object):
         self.fallback_lang='ar'
         self.set_lang()
         self.cities_db=os.path.join(self.prefix,'cities.db')
+        #self.cities_db = '/home/mjlad/PycharmProjects/monajat-master/monajat-data/cities.db'
         self.cities_cn=sqlite3.connect(self.cities_db)
         self.cities_cn.row_factory=sqlite3.Row
         self.cities_c=self.cities_cn.cursor()
         r=self.cities_c.execute('select v from params where k=?', ('ver',)).fetchone()
-        print dict(r)
+        print (dict(r))
         if r: self.cities_db_ver=r['v']
         else: self.cities_db_ver='0'
 
diff --git a/monajat/sqlGenerator.py b/monajat/sqlGenerator.py
index 8772435..7bd6288 100755
--- a/monajat/sqlGenerator.py
+++ b/monajat/sqlGenerator.py
@@ -28,19 +28,19 @@ SQL_ADD_ROW="""INSERT INTO monajat (lang, ref, id, text, merits, links, media) V
 
 def parse(f):
     parsed=clear_record.copy()
-    a=map(lambda l: l.decode('utf-8').rstrip(),open(f,"rt").readlines())
+    a=map(lambda l: l.rstrip(),open(f,"r",encoding='utf-8').readlines())
     key=None
     for n,l in enumerate(a):
-        if l.startswith(u'@'):
-            if key: parsed[key]=u'\n'.join(values)
-            kv=l[1:].split(u'=',1)
+        if l.startswith('@'):
+            if key: parsed[key]='\n'.join(values)
+            kv=l[1:].split('=',1)
             key=kv[0].strip()
             if len(kv)==2: values=[kv[1]]
             else: values=[]
         else:
-            if not key: raise SyntaxError, "error parsing file [%s] at line [%d]" % (f,n+1)
+            if not key: raise SyntaxError("error parsing file [%s] at line [%d]" % (f,n+1))
             values.append(l.strip())
-    if key: parsed[key]=u'\n'.join(values)
+    if key: parsed[key]='\n'.join(values)
     return parsed
 
 def generate(prefix):
@@ -56,7 +56,7 @@ def generate(prefix):
     c.execute('BEGIN TRANSACTION')
     #for f in sys.argv[1:]:
     for f in files:
-        print "adding [%s]..." % f
+        print ("adding [%s]..." % f)
         c.execute(SQL_ADD_ROW, parse(f))
     c.execute('END TRANSACTION')
     cn.commit()
diff --git a/monajat/utils.py b/monajat/utils.py
index fcfdd40..a40ab9f 100644
--- a/monajat/utils.py
+++ b/monajat/utils.py
@@ -1,44 +1,35 @@
-# -*- coding: utf-8 -*-
 # -*- Mode: Python; py-indent-offset: 4 -*-
-import sys
-bus, bus_name, bus_object=None,None,None
-try:
-    import dbus
-    import dbus.service
-    from dbus.mainloop.glib import DBusGMainLoop
+# vim: tabstop=4 shiftwidth=4 expandtab
 
-    dbus_loop = DBusGMainLoop(set_as_default=True)
-    bus = dbus.SessionBus()
-except ImportError: pass
+import dbus
+import dbus.bus
+import dbus.service
+import dbus.mainloop.glib
 
-def init_dbus(cb, interface="org.ojuba.Monajat"):
-    global bus_name, bus_object
-    if not bus: return
-    class Manager(dbus.service.Object):
-        def __init__(self, cb, bus, path):
-                    dbus.service.Object.__init__(self,bus,path)
-                    self.cb=cb
+bus_interface="org.ojuba.Monajat"
 
-        @dbus.service.method(interface, in_signature='as', out_signature='i')
-        def call(self,a):
-            return self.cb()
+    
+class OjDBus(dbus.service.Object):
+    def __init__(self, app, bus, path='/', bus_interface="org.ojuba.Monajat"):
+        self.app = app()
+        dbus.service.Object.__init__ (self, bus, path, bus_interface)
+        self.running = True
+        
+    @dbus.service.method(bus_interface, in_signature='', out_signature='')
+    def start (self):
+        self.app.dbus_cb()
 
-    # values from /usr/include/dbus-1.0/dbus/dbus-shared.h
-    r=bus.request_name(interface, flags=0x4)
-    if r!=1:
-        print "Another process own this service, pass request to it: "
-        trials=0; appletbus=False
-        while(appletbus==False and trials<20):
-            print ".",
-            try:
-                appletbus=bus.get_object(interface,"/Manager"); break
-            except:
-                appletbus=False
-            time.sleep(1); trials+=1
-        print "*"
-        if appletbus: exit(appletbus.call(sys.argv[1:],dbus_interface=interface))
-        else: print "unable to connect"
+def setup_dbus(gtk_app, bus_interface="org.ojuba.Monajat"):
+    dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)
+    bus = dbus.SessionBus ()
+    request = bus.request_name (bus_interface, dbus.bus.NAME_FLAG_DO_NOT_QUEUE)
+    
+    if request != dbus.bus.REQUEST_NAME_REPLY_EXISTS:
+        app = OjDBus(gtk_app, bus, '/', bus_interface)
+    else:
+        print ("Exiting: Application already running...")
+        object = bus.get_object (bus_interface, "/")
+        app = dbus.Interface (object, bus_interface)
+        app.start()
         exit(-1)
-    bus_name = dbus.service.BusName(interface, bus)
-    bus_object = Manager(cb, bus, '/Manager')
 
diff --git a/po/ar.po b/po/ar.po
index 5ab7e3a..cb2ea08 100644
--- a/po/ar.po
+++ b/po/ar.po
@@ -187,3 +187,20 @@ msgstr "برنامج الأذكار مناجاة"
 #: ../monajat/applet.py:800
 msgid "Configure"
 msgstr "إعداد"
+
+
+#: ../monajat/applet.py:93
+msgid "daylight_savings_time"
+msgstr "مراعاة التوقيت الصيفي"
+
+#: ../monajat/applet.py:98
+msgid "method:"
+msgstr "طريقة حساب الأوقات"
+
+#: ../monajat/applet.py:187 ../monajat/applet.py:189
+msgid "Edit_pt"
+msgstr "تعديل الأوقات يدويا"
+
+#: ../monajat/applet.py:261
+msgid "Clear"
+msgstr "مسح"
diff --git a/po/en_GB.po b/po/en_GB.po
index ff588bb..9e80d81 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -191,3 +191,19 @@ msgstr "Monajat supplications"
 #: ../monajat/applet.py:800
 msgid "Configure"
 msgstr ""
+
+#: ../monajat/applet.py:93
+msgid "daylight_savings_time"
+msgstr "Daylight Savings time"
+
+#: ../monajat/applet.py:98
+msgid "method:"
+msgstr ""
+
+#: ../monajat/applet.py:187 ../monajat/applet.py:189
+msgid "Edit_pt"
+msgstr "Edit Prayer times"
+
+#: ../monajat/applet.py:261
+msgid "Clear"
+msgstr ""
diff --git a/screenlets/Monajat/MonajatScreenlet.py b/screenlets/Monajat/MonajatScreenlet.py
index 53fb223..9a3a0a6 100755
--- a/screenlets/Monajat/MonajatScreenlet.py
+++ b/screenlets/Monajat/MonajatScreenlet.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 # This application is released under the GNU General Public License 
 # v3 (or, at your option, any later version). You can find the full 
@@ -21,7 +21,7 @@ import sys
 import gtk
 import gobject
 import os
-import cgi
+import html
 
 is_manager = screenlets.utils.is_manager_running_me()
 try:
@@ -31,7 +31,7 @@ except:
         screenlets.show_message(None,"You don't have monajat installed!\nInstall monajat-python.")
         sys.exit()
     else:
-        print "You don't have monajat installed!\nInstall monajat-python."
+        print ("You don't have monajat installed!\nInstall monajat-python.")
         sys.exit()
 
 class MonajatScreenlet(screenlets.Screenlet):
@@ -110,8 +110,8 @@ class MonajatScreenlet(screenlets.Screenlet):
         for l in links:
             ll=l.split(u'\t',1)
             url=ll[0]
-            if len(ll)>1: t=cgi.escape(ll[1])
-            else: t=cgi.escape(url)
+            if len(ll)>1: t=html.escape(ll[1])
+            else: t=html.escape(url)
             i= gtk.MenuItem(t)
             i.connect("activate", self.net_menu_cb,url)
             i.show()
@@ -119,7 +119,7 @@ class MonajatScreenlet(screenlets.Screenlet):
         self.net_menu.set_submenu(mm)
 
     def on_init (self):
-        print "Screenlet has been initialized."
+        print ("Screenlet has been initialized.")
         # add default menuitems
         self.add_default_menuitems(screenlets.DefaultMenuItem.XML)
         self.net_menu=self.add_menuitem('internet', 'More from internet')
@@ -135,7 +135,7 @@ class MonajatScreenlet(screenlets.Screenlet):
             self.__m.clear()
             self.__m.set_lang(self.lang)
         ld=os.path.join(self.__m.get_prefix(),'..','locale')
-        gettext.install('monajat', ld, unicode=0)
+        gettext.install('monajat', ld)
         self.refresh_text()
 
     def menuitem_callback(self, widget, id):
@@ -218,7 +218,7 @@ class MonajatScreenlet(screenlets.Screenlet):
                 button_det = 4+int((x-9)/18)
             elif x >= 135 and x <= 187:
                 button_det = 1+int((x-135)/18)
-            print button_det
+            print (button_det)
 
         self.__button_pressed = button_det
         if button_det:
@@ -236,7 +236,7 @@ class MonajatScreenlet(screenlets.Screenlet):
             if self.theme_name == 'default':self.draw_rounded_rectangle(ctx,0,0,17,200,200)
             self.theme.render(ctx,'background')
         ctx.save()
-        try: name = _("Monajat")
+        try: name = ("Monajat")
         except NameError: return # gettext is not loaded yet
         self.bidi_dir=pango.ALIGN_CENTER
         #self.bidi_dir=pango.ALIGN_LEFT
diff --git a/setup.py b/setup.py
index 0d26a79..7b78bed 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 from distutils.core import setup
 from glob import *
 import os, sys

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-islamic/packages/monajat.git



More information about the Debian-islamic-commits mailing list