From f0da7465e86fc177acb8c187268d0eee21edd957 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 19:13:21 +0100 Subject: [PATCH 001/108] initial changes --- openlp.py | 8 -------- openlp/__init__.py | 4 ++-- openlp/core/lib/db.py | 3 ++- openlp/core/lib/theme.py | 2 +- openlp/core/ui/exceptionform.py | 2 +- openlp/core/ui/filerenameform.py | 4 +++- openlp/core/utils/actions.py | 12 ------------ openlp/plugins/bibles/lib/http.py | 2 +- scripts/generate_resources.sh | 2 +- 9 files changed, 11 insertions(+), 28 deletions(-) diff --git a/openlp.py b/openlp.py index 0732fb066..ae0b88168 100755 --- a/openlp.py +++ b/openlp.py @@ -27,15 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -import sip import sys -sip.setapi(u'QDate', 2) -sip.setapi(u'QDateTime', 2) -sip.setapi(u'QString', 2) -sip.setapi(u'QTextStream', 2) -sip.setapi(u'QTime', 2) -sip.setapi(u'QUrl', 2) -sip.setapi(u'QVariant', 2) from openlp.core import main diff --git a/openlp/__init__.py b/openlp/__init__.py index 606d4ef9d..1d84ab53c 100644 --- a/openlp/__init__.py +++ b/openlp/__init__.py @@ -30,7 +30,7 @@ The :mod:`openlp` module contains all the project produced OpenLP functionality """ -import core -import plugins +from . import core +from . import plugins __all__ = [u'core', u'plugins'] diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index c6bce2a00..e7cee208d 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -105,7 +105,8 @@ def upgrade_db(url, upgrade): if version > upgrade.__version__: return version, upgrade.__version__ version += 1 - if load_changes: + #FIXME: python3 - dislable upgrade + if load_changes and False: while hasattr(upgrade, u'upgrade_%d' % version): log.debug(u'Running upgrade_%d', version) try: diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 401ab3cac..5be99854f 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -473,7 +473,7 @@ class ThemeXML(object): Pull out the XML string formatted for human consumption """ self._build_xml_from_attrs() - return self.theme_xml.toprettyxml(indent=u' ', newl=u'\n', encoding=u'utf-8') + return self.theme_xml.toprettyxml(indent=' ', newl='\n', encoding='utf-8') def parse(self, xml): """ diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 25f8201b1..f7dc83d29 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -35,7 +35,7 @@ import os import platform import sqlalchemy -import BeautifulSoup +from bs4 import BeautifulSoup from lxml import etree from PyQt4 import Qt, QtCore, QtGui, QtWebKit diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index 273d314fb..885824c38 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -45,7 +45,9 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): """ Constructor """ - QtGui.QDialog.__init__(self, self.main_window) + super().__init__() + # TODO: python3 - parent correct? + #QtGui.QDialog.__init__(self, self.main_window) self.setupUi(self) def exec_(self, copy=False): diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index d6a335ac2..56a6cf76e 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -103,12 +103,6 @@ class CategoryActionList(object): self.index += 1 return self.actions[self.index - 1][1] - def next(self): - """ - Python 2 "next" method. - """ - return self.__next__() - def has_key(self, key): """ Implement the has_key() method to make this class a dictionary type @@ -196,12 +190,6 @@ class CategoryList(object): self.index += 1 return self.categories[self.index - 1] - def next(self): - """ - Python 2 "next" method for iterator. - """ - return self.__next__() - def has_key(self, key): """ Implement the has_key() method to make this class like a dictionary diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index b01377a05..872180170 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -36,7 +36,7 @@ import socket import urllib from HTMLParser import HTMLParseError -from BeautifulSoup import BeautifulSoup, NavigableString, Tag +from BeautifulSoup from bs4 import BeautifulSoup, NavigableString, Tag from openlp.core.lib import Registry, translate from openlp.core.lib.ui import critical_error_message_box diff --git a/scripts/generate_resources.sh b/scripts/generate_resources.sh index d1717507d..c58e0ef61 100755 --- a/scripts/generate_resources.sh +++ b/scripts/generate_resources.sh @@ -44,7 +44,7 @@ mv openlp/core/resources.py openlp/core/resources.py.old # Create the new data from the updated qrc -pyrcc4 -o openlp/core/resources.py.new resources/images/openlp-2.qrc +pyrcc4 -py3 -o openlp/core/resources.py.new resources/images/openlp-2.qrc # Remove patch breaking lines cat openlp/core/resources.py.new | sed '/# Created: /d;/# by: /d' \ From d9afa35b9f9198ed7493f5cfbca159e9fff6d093 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 20:57:16 +0100 Subject: [PATCH 002/108] fixed import --- openlp/plugins/bibles/lib/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 872180170..e7056994e 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -36,7 +36,7 @@ import socket import urllib from HTMLParser import HTMLParseError -from BeautifulSoup from bs4 import BeautifulSoup, NavigableString, Tag +from bs4 import BeautifulSoup, NavigableString, Tag from openlp.core.lib import Registry, translate from openlp.core.lib.ui import critical_error_message_box From 4f46e578e1169004b7f759af1c1280314305479b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 21:18:50 +0100 Subject: [PATCH 003/108] updated vlc.py --- openlp/core/ui/media/vendor/vlc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/media/vendor/vlc.py b/openlp/core/ui/media/vendor/vlc.py index e7138b50a..dbb2971f7 100644 --- a/openlp/core/ui/media/vendor/vlc.py +++ b/openlp/core/ui/media/vendor/vlc.py @@ -48,7 +48,7 @@ import sys from inspect import getargspec __version__ = "N/A" -build_date = "Wed Feb 13 18:40:24 2013" +build_date = "Thu Mar 21 22:33:03 2013" if sys.version_info[0] > 2: str = str @@ -70,7 +70,7 @@ if sys.version_info[0] > 2: if isinstance(b, bytes): return b.decode(sys.getfilesystemencoding()) else: - return b + return str(b) else: str = str unicode = unicode @@ -90,6 +90,8 @@ else: """ if isinstance(b, str): return unicode(b, sys.getfilesystemencoding()) + else: + return b # Internal guard to prevent internal classes to be directly # instanciated. From 77904422402df0cd8dca8e7440357b987ac02e21 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 21:19:19 +0100 Subject: [PATCH 004/108] fixed vlc.py not working --- openlp/core/ui/media/vendor/vlc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/media/vendor/vlc.py b/openlp/core/ui/media/vendor/vlc.py index dbb2971f7..b963c7ea1 100644 --- a/openlp/core/ui/media/vendor/vlc.py +++ b/openlp/core/ui/media/vendor/vlc.py @@ -3422,7 +3422,7 @@ def libvlc_media_new_path(p_instance, path): f = _Cfunctions.get('libvlc_media_new_path', None) or \ _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p) - return f(p_instance, path) + return f(p_instance, str_to_bytes(path)) def libvlc_media_new_fd(p_instance, fd): '''Create a media for an already open file descriptor. From 60cf33f23c0b82875264eceabf03033590a7bdc7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 21:22:15 +0100 Subject: [PATCH 005/108] fixed vlc.py not working --- openlp/core/ui/media/vlcplayer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index a2764bc5a..40256570f 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -61,9 +61,11 @@ if VLC_AVAILABLE: VERSION = vlc.libvlc_get_version() except: VERSION = u'0.0.0' - if LooseVersion(VERSION) < LooseVersion('1.1.0'): - VLC_AVAILABLE = False - log.debug(u'VLC could not be loaded, because the vlc version is too old: %s' % VERSION) + #FIXME: python3 - LooseVersion does not work when a string contains letter and digits (2.0.5 Twoflower). + # http://bugs.python.org/issue14894 +# if LooseVersion(VERSION) < LooseVersion('1.1.0'): +# VLC_AVAILABLE = False +# log.debug(u'VLC could not be loaded, because the vlc version is too old: %s' % VERSION) AUDIO_EXT = [u'*.mp3', u'*.wav', u'*.wma', u'*.ogg'] From 37b7de22a5fc7917ad923da102e11909f1ed26ed Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 21:31:48 +0100 Subject: [PATCH 006/108] removed encoding from calls --- openlp/core/utils/applocation.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openlp/core/utils/applocation.py b/openlp/core/utils/applocation.py index 2f1cb45ba..1791ab41c 100644 --- a/openlp/core/utils/applocation.py +++ b/openlp/core/utils/applocation.py @@ -145,20 +145,19 @@ def _get_os_dir_path(dir_type): """ Return a path based on which OS and environment we are running in. """ - encoding = sys.getfilesystemencoding() if sys.platform == u'win32': if dir_type == AppLocation.DataDir: - return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp', u'data') + return os.path.join(unicode(os.getenv(u'APPDATA')), u'openlp', u'data') elif dir_type == AppLocation.LanguageDir: return os.path.split(openlp.__file__)[0] - return os.path.join(unicode(os.getenv(u'APPDATA'), encoding), u'openlp') + return os.path.join(unicode(os.getenv(u'APPDATA')), u'openlp') elif sys.platform == u'darwin': if dir_type == AppLocation.DataDir: - return os.path.join(unicode(os.getenv(u'HOME'), encoding), + return os.path.join(unicode(os.getenv(u'HOME')), u'Library', u'Application Support', u'openlp', u'Data') elif dir_type == AppLocation.LanguageDir: return os.path.split(openlp.__file__)[0] - return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'Library', u'Application Support', u'openlp') + return os.path.join(unicode(os.getenv(u'HOME')), u'Library', u'Application Support', u'openlp') else: if dir_type == AppLocation.LanguageDir: prefixes = [u'/usr/local', u'/usr'] @@ -175,6 +174,6 @@ def _get_os_dir_path(dir_type): elif dir_type == AppLocation.CacheDir: return os.path.join(unicode(BaseDirectory.xdg_cache_home, encoding), u'openlp') if dir_type == AppLocation.DataDir: - return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp', u'data') - return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp') + return os.path.join(unicode(os.getenv(u'HOME')), u'.openlp', u'data') + return os.path.join(unicode(os.getenv(u'HOME')), u'.openlp') From 60c1a4e9f433e616139e0a6a2e1298bd0d9b0364 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 26 Mar 2013 21:33:49 +0100 Subject: [PATCH 007/108] removed contains method --- openlp/core/utils/actions.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 56a6cf76e..fd93b3700 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -161,12 +161,6 @@ class CategoryList(object): return category raise KeyError(u'Category "%s" does not exist.' % key) - def __contains__(self, item): - """ - Implement the __contains__() method to make this class like a dictionary - """ - return self.has_key(item) - def __len__(self): """ Implement the __len__() method to make this class like a dictionary From 6127da074b648967f6f9b5eefeca4eec8d77c7ba Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:11:16 +0100 Subject: [PATCH 008/108] fixed service note form --- openlp/core/ui/servicenoteform.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index c62349104..cd265cb3a 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -43,7 +43,9 @@ class ServiceNoteForm(QtGui.QDialog): """ Constructor """ - QtGui.QDialog.__init__(self, self.main_window) + super().__init__() + # TODO: python3 - parent correct? + #QtGui.QDialog.__init__(self, self.main_window) self.setupUi() self.retranslateUi() From 7476ff27ff5ed2a4a850e86ff80334c9d86e1d81 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:12:54 +0100 Subject: [PATCH 009/108] fixed service item edit form --- openlp/core/ui/serviceitemeditform.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/serviceitemeditform.py b/openlp/core/ui/serviceitemeditform.py index 62870492b..d88dd8c12 100644 --- a/openlp/core/ui/serviceitemeditform.py +++ b/openlp/core/ui/serviceitemeditform.py @@ -42,8 +42,11 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog): def __init__(self): """ Constructor + """ - QtGui.QDialog.__init__(self, self.main_window) + super().__init__() + # TODO: python3 - parent correct? + #QtGui.QDialog.__init__(self, self.main_window) self.setupUi(self) self.item_list = [] self.list_widget.currentRowChanged.connect(self.on_current_row_changed) From 8bf76a7baa534132aa3e3ccecbdff442ccafc7e6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:14:24 +0100 Subject: [PATCH 010/108] fixed start time form --- openlp/core/ui/starttimeform.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index 7d8a42f0f..f2ac090d0 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -45,7 +45,9 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): """ Constructor """ - QtGui.QDialog.__init__(self, self.main_window) + super().__init__() + # TODO: python3 - parent correct? + #QtGui.QDialog.__init__(self, self.main_window) self.setupUi(self) def exec_(self): From bf60aa148e4e8b037ab4bc23e54898c8d3fea4c9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:20:54 +0100 Subject: [PATCH 011/108] fixed settings tabs --- openlp/core/lib/settingstab.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index d63f9c678..c6f2ad568 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -184,8 +184,9 @@ class SettingsTab(QtGui.QWidget): """ Adds the media controller to the class dynamically """ - if not hasattr(self, u'_media_controller'): - self._media_controller = Registry().get(u'media_controller') +# if not hasattr(self, '_media_controller'): +# self._media_controller = Registry().get('media_controller') + # FIXME: python3 return self._media_controller media_controller = property(_get_media_controller) From 4bd7c139f5738ae8561d135d959eca230b63a6c3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:23:09 +0100 Subject: [PATCH 012/108] fixed settings tabs --- openlp/core/lib/settingstab.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index c6f2ad568..8bdc60cbb 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -187,6 +187,7 @@ class SettingsTab(QtGui.QWidget): # if not hasattr(self, '_media_controller'): # self._media_controller = Registry().get('media_controller') # FIXME: python3 + self._media_controller = Registry().get('media_controller') return self._media_controller media_controller = property(_get_media_controller) From 0b2dc71f2872dd8e5c19242988694d929c900544 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:25:39 +0100 Subject: [PATCH 013/108] fixed not needed decode --- openlp/core/lib/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 155c10141..c77e49305 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -120,20 +120,19 @@ def get_text_file_string(text_file): if not os.path.isfile(text_file): return False file_handle = None - content_string = None + content = None try: file_handle = open(text_file, u'r') if not file_handle.read(3) == '\xEF\xBB\xBF': # no BOM was found file_handle.seek(0) content = file_handle.read() - content_string = content.decode(u'utf-8') except (IOError, UnicodeError): log.exception(u'Failed to open text file %s' % text_file) finally: if file_handle: file_handle.close() - return content_string + return content def str_to_bool(string_value): From 6908577b548ec6ce633d1354ebfd4d751c2d10ad Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 27 Mar 2013 10:41:01 +0100 Subject: [PATCH 014/108] fixed image display --- openlp/core/lib/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index c77e49305..9a51f592d 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -184,7 +184,7 @@ def image_to_byte(image): image.save(buffie, "PNG") log.debug(u'image_to_byte - end') # convert to base64 encoding so does not get missed! - return byte_array.toBase64() + return bytes(byte_array.toBase64()).decode('utf-8') def create_thumb(image_path, thumb_path, return_icon=True, size=None): From 297b47fca32235ed9a530064eeaa3f52651c4c6e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 15:57:47 +0100 Subject: [PATCH 015/108] added comment --- openlp/core/ui/media/vendor/vlc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/ui/media/vendor/vlc.py b/openlp/core/ui/media/vendor/vlc.py index b963c7ea1..91657f261 100644 --- a/openlp/core/ui/media/vendor/vlc.py +++ b/openlp/core/ui/media/vendor/vlc.py @@ -3422,6 +3422,7 @@ def libvlc_media_new_path(p_instance, path): f = _Cfunctions.get('libvlc_media_new_path', None) or \ _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p) + # OpenLP: Do not change this line. Needed for python3 rework. return f(p_instance, str_to_bytes(path)) def libvlc_media_new_fd(p_instance, fd): From 2a28094937d6fa6b89064ebba87ee39c3c3dc271 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Mar 2013 17:31:29 +0100 Subject: [PATCH 016/108] fixed encoding --- openlp/core/utils/applocation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/utils/applocation.py b/openlp/core/utils/applocation.py index 1791ab41c..ef045454a 100644 --- a/openlp/core/utils/applocation.py +++ b/openlp/core/utils/applocation.py @@ -168,11 +168,11 @@ def _get_os_dir_path(dir_type): return os.path.join(u'/usr', u'share', u'openlp') if XDG_BASE_AVAILABLE: if dir_type == AppLocation.ConfigDir: - return os.path.join(unicode(BaseDirectory.xdg_config_home, encoding), u'openlp') + return os.path.join(unicode(BaseDirectory.xdg_config_home), u'openlp') elif dir_type == AppLocation.DataDir: - return os.path.join(unicode(BaseDirectory.xdg_data_home, encoding), u'openlp') + return os.path.join(unicode(BaseDirectory.xdg_data_home), u'openlp') elif dir_type == AppLocation.CacheDir: - return os.path.join(unicode(BaseDirectory.xdg_cache_home, encoding), u'openlp') + return os.path.join(unicode(BaseDirectory.xdg_cache_home), u'openlp') if dir_type == AppLocation.DataDir: return os.path.join(unicode(os.getenv(u'HOME')), u'.openlp', u'data') return os.path.join(unicode(os.getenv(u'HOME')), u'.openlp') From 7d336911ba994529e1a3898107d59ec85e2a66cc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Mar 2013 17:38:48 +0100 Subject: [PATCH 017/108] disable manager --- openlp/plugins/bibles/bibleplugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 1f17ae39a..966c49001 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -107,6 +107,8 @@ class BiblePlugin(Plugin): Perform tasks on application startup """ Plugin.app_startup(self) + # FIXME: python3 + return if self.manager.old_bible_databases: if QtGui.QMessageBox.information(self.main_window, translate('OpenLP', 'Information'), From 28b557af807ff6d09ca826e0c2d199a8cc0746c2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 31 Mar 2013 10:00:28 +0200 Subject: [PATCH 018/108] changed import --- openlp/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/__init__.py b/openlp/__init__.py index 1d84ab53c..46e989655 100644 --- a/openlp/__init__.py +++ b/openlp/__init__.py @@ -30,7 +30,7 @@ The :mod:`openlp` module contains all the project produced OpenLP functionality """ -from . import core -from . import plugins +import openlp.core +import openlp.plugins __all__ = [u'core', u'plugins'] From aa7d56c4bc0c53001632141a99be1d1914b0ac06 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 31 Mar 2013 10:53:34 +0200 Subject: [PATCH 019/108] added fixmes --- openlp/core/ui/firsttimeform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index e828db597..5a19c5323 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -94,6 +94,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.web_access = get_web_page(u'%s%s' % (self.web, u'download.cfg')) if self.web_access: files = self.web_access.read() + #FIXME: python3 - TypeError: startswith first arg must be bytes or a tuple of bytes, not str + #FIXME: python3 - readfp: Deprecated, use read_file instead. self.config.readfp(io.BytesIO(files)) self.update_screen_list_combo() self.was_download_cancelled = False From 8761117d341e7ce41c3ecb364dbe82aa7c34c4dc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 12:19:15 +0200 Subject: [PATCH 020/108] fixed fixme: constructor --- openlp/core/lib/settingstab.py | 6 ++---- openlp/core/ui/media/playertab.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 8bdc60cbb..99b862958 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -184,10 +184,8 @@ class SettingsTab(QtGui.QWidget): """ Adds the media controller to the class dynamically """ -# if not hasattr(self, '_media_controller'): -# self._media_controller = Registry().get('media_controller') - # FIXME: python3 - self._media_controller = Registry().get('media_controller') + if not hasattr(self, '_media_controller'): + self._media_controller = Registry().get('media_controller') return self._media_controller media_controller = property(_get_media_controller) diff --git a/openlp/core/ui/media/playertab.py b/openlp/core/ui/media/playertab.py index 1c61a5545..3331c70ca 100644 --- a/openlp/core/ui/media/playertab.py +++ b/openlp/core/ui/media/playertab.py @@ -55,7 +55,7 @@ class PlayerTab(SettingsTab): """ Constructor """ - self.media_players = self.media_controller.media_players + self.media_players = Registry().get('media_controller').media_players self.saved_used_players = None self.icon_path = u':/media/multimedia-player.png' player_translated = translate('OpenLP.PlayerTab', 'Players') From 2c94f0df835552e47333c5e7861d58f62dcc2180 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 12:23:52 +0200 Subject: [PATCH 021/108] fixed #FIXME: constructor --- openlp/core/ui/filerenameform.py | 22 ++++++++++------------ openlp/core/ui/serviceitemeditform.py | 4 +--- openlp/core/ui/servicenoteform.py | 4 +--- openlp/core/ui/starttimeform.py | 4 +--- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index 885824c38..a53695426 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -45,9 +45,7 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): """ Constructor """ - super().__init__() - # TODO: python3 - parent correct? - #QtGui.QDialog.__init__(self, self.main_window) + super(FileRenameForm, self).__init__(Registry().get(u'main_window')) self.setupUi(self) def exec_(self, copy=False): @@ -61,12 +59,12 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): self.file_name_edit.setFocus() return QtGui.QDialog.exec_(self) - def _get_main_window(self): - """ - Adds the main window to the class dynamically - """ - if not hasattr(self, u'_main_window'): - self._main_window = Registry().get(u'main_window') - return self._main_window - - main_window = property(_get_main_window) +# def _get_main_window(self): +# """ +# Adds the main window to the class dynamically +# """ +# if not hasattr(self, u'_main_window'): +# self._main_window = Registry().get(u'main_window') +# return self._main_window +# +# main_window = property(_get_main_window) diff --git a/openlp/core/ui/serviceitemeditform.py b/openlp/core/ui/serviceitemeditform.py index d88dd8c12..6ca1068cc 100644 --- a/openlp/core/ui/serviceitemeditform.py +++ b/openlp/core/ui/serviceitemeditform.py @@ -44,9 +44,7 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog): Constructor """ - super().__init__() - # TODO: python3 - parent correct? - #QtGui.QDialog.__init__(self, self.main_window) + super(ServiceItemEditForm, self).__init__(Registry().get(u'main_window')) self.setupUi(self) self.item_list = [] self.list_widget.currentRowChanged.connect(self.on_current_row_changed) diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index cd265cb3a..308d9edcf 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -43,9 +43,7 @@ class ServiceNoteForm(QtGui.QDialog): """ Constructor """ - super().__init__() - # TODO: python3 - parent correct? - #QtGui.QDialog.__init__(self, self.main_window) + super(ServiceNoteForm, self).__init__(Registry().get(u'main_window')) self.setupUi() self.retranslateUi() diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index f2ac090d0..bf952a2d1 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -45,9 +45,7 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): """ Constructor """ - super().__init__() - # TODO: python3 - parent correct? - #QtGui.QDialog.__init__(self, self.main_window) + super(StartTimeForm, self).__init__(Registry().get(u'main_window')) self.setupUi(self) def exec_(self): From 440876eff78be977cbcaa465d8d84eac97f38065 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 12:33:15 +0200 Subject: [PATCH 022/108] reverted fix: fix available for trunk --- openlp/core/ui/media/vendor/vlc.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/media/vendor/vlc.py b/openlp/core/ui/media/vendor/vlc.py index 91657f261..dbb2971f7 100644 --- a/openlp/core/ui/media/vendor/vlc.py +++ b/openlp/core/ui/media/vendor/vlc.py @@ -3422,8 +3422,7 @@ def libvlc_media_new_path(p_instance, path): f = _Cfunctions.get('libvlc_media_new_path', None) or \ _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p) - # OpenLP: Do not change this line. Needed for python3 rework. - return f(p_instance, str_to_bytes(path)) + return f(p_instance, path) def libvlc_media_new_fd(p_instance, fd): '''Create a media for an already open file descriptor. From 74eb0b59fb92a305d8bb25de94d54232ee4a5ad1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 12:39:42 +0200 Subject: [PATCH 023/108] fixed LooseVersion not working --- openlp/core/ui/media/vlcplayer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 40256570f..c9ec2bf48 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -61,11 +61,11 @@ if VLC_AVAILABLE: VERSION = vlc.libvlc_get_version() except: VERSION = u'0.0.0' - #FIXME: python3 - LooseVersion does not work when a string contains letter and digits (2.0.5 Twoflower). + # LooseVersion does not work when a string contains letter and digits (2.0.5 Twoflower). # http://bugs.python.org/issue14894 -# if LooseVersion(VERSION) < LooseVersion('1.1.0'): -# VLC_AVAILABLE = False -# log.debug(u'VLC could not be loaded, because the vlc version is too old: %s' % VERSION) + if LooseVersion(VERSION.split()[0]) < LooseVersion('1.1.0'): + VLC_AVAILABLE = False + log.debug(u'VLC could not be loaded, because the vlc version is too old: %s' % VERSION) AUDIO_EXT = [u'*.mp3', u'*.wav', u'*.wma', u'*.ogg'] From a6d966d1d2bee446ce66c6a8df44a75002657b5f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 12:40:09 +0200 Subject: [PATCH 024/108] changed comment --- openlp/core/ui/media/vlcplayer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index c9ec2bf48..28966fc23 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -61,7 +61,7 @@ if VLC_AVAILABLE: VERSION = vlc.libvlc_get_version() except: VERSION = u'0.0.0' - # LooseVersion does not work when a string contains letter and digits (2.0.5 Twoflower). + # LooseVersion does not work when a string contains letter and digits (e. g. 2.0.5 Twoflower). # http://bugs.python.org/issue14894 if LooseVersion(VERSION.split()[0]) < LooseVersion('1.1.0'): VLC_AVAILABLE = False From 4b76db7ad7c2b3398e90306ea86654dabb56c040 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 12:54:11 +0200 Subject: [PATCH 025/108] convert bytes to str --- openlp/core/ui/media/vlcplayer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 28966fc23..8c943dc82 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -58,7 +58,7 @@ except OSError, e: if VLC_AVAILABLE: try: - VERSION = vlc.libvlc_get_version() + VERSION = vlc.libvlc_get_version().decode('UTF-8') except: VERSION = u'0.0.0' # LooseVersion does not work when a string contains letter and digits (e. g. 2.0.5 Twoflower). From 72ba94d39089074a90aa7d4b38f22dd2b592440f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Apr 2013 16:53:30 +0200 Subject: [PATCH 026/108] replaced cPickle by pickle --- openlp/core/lib/formattingtags.py | 8 +++----- openlp/core/ui/servicemanager.py | 8 ++++---- tests/functional/openlp_core_lib/test_formattingtags.py | 8 ++++---- tests/functional/openlp_core_lib/test_serviceitem.py | 4 ++-- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index b2d8f6ea7..028abff35 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -29,7 +29,7 @@ """ Provide HTML Tag management and Formatting Tag access class """ -import cPickle +import pickle from openlp.core.lib import Settings, translate @@ -66,7 +66,7 @@ class FormattingTags(object): if isinstance(tag[element], unicode): tag[element] = tag[element].encode('utf8') # Formatting Tags were also known as display tags. - Settings().setValue(u'displayTags/html_tags', cPickle.dumps(tags) if tags else u'') + Settings().setValue(u'displayTags/html_tags', pickle.dumps(tags) if tags else u'') @staticmethod def load_tags(): @@ -159,10 +159,8 @@ class FormattingTags(object): # Formatting Tags were also known as display tags. user_expands = Settings().value(u'displayTags/html_tags') - # cPickle only accepts str not unicode strings - user_expands_string = str(user_expands) if user_expands_string: - user_tags = cPickle.loads(user_expands_string) + user_tags = pickle.loads(user_expands_string) for tag in user_tags: for element in tag: if isinstance(tag[element], str): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 6490d2b8d..1cfb21d2c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -30,7 +30,7 @@ The service manager sets up, loads, saves and manages services. """ import cgi -import cPickle +import pickle import logging import os import shutil @@ -507,7 +507,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): file_size = os.path.getsize(file_item) total_size += file_size log.debug(u'ServiceManager.save_file - ZIP contents size is %i bytes' % total_size) - service_content = cPickle.dumps(service) + service_content = pickle.dumps(service) # Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be extracted using unzip in UNIX. allow_zip_64 = (total_size > 2147483648 + len(service_content)) log.debug(u'ServiceManager.save_file - allowZip64 is %s' % allow_zip_64) @@ -580,7 +580,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): #TODO: check for file item on save. service.append({u'serviceitem': service_item}) self.main_window.increment_progress_bar() - service_content = cPickle.dumps(service) + service_content = pickle.dumps(service) zip_file = None success = True self.main_window.increment_progress_bar() @@ -697,7 +697,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): p_file = os.path.join(self.servicePath, osfile) if 'p_file' in locals(): file_to = open(p_file, u'r') - items = cPickle.load(file_to) + items = pickle.load(file_to) file_to.close() self.new_file() self.set_file_name(file_name) diff --git a/tests/functional/openlp_core_lib/test_formattingtags.py b/tests/functional/openlp_core_lib/test_formattingtags.py index 26d87f466..721032033 100644 --- a/tests/functional/openlp_core_lib/test_formattingtags.py +++ b/tests/functional/openlp_core_lib/test_formattingtags.py @@ -33,11 +33,11 @@ class TestFormattingTags(TestCase): """ with patch(u'openlp.core.lib.translate') as mocked_translate, \ patch(u'openlp.core.lib.settings') as mocked_settings, \ - patch(u'openlp.core.lib.formattingtags.cPickle') as mocked_cPickle: + patch(u'openlp.core.lib.formattingtags.pickle') as mocked_pickle: # GIVEN: Our mocked modules and functions. mocked_translate.side_effect = lambda module, string_to_translate, comment: string_to_translate mocked_settings.value.return_value = u'' - mocked_cPickle.load.return_value = [] + mocked_pickle.load.return_value = [] # WHEN: Get the display tags. FormattingTags.load_tags() @@ -54,11 +54,11 @@ class TestFormattingTags(TestCase): """ with patch(u'openlp.core.lib.translate') as mocked_translate, \ patch(u'openlp.core.lib.settings') as mocked_settings, \ - patch(u'openlp.core.lib.formattingtags.cPickle') as mocked_cPickle: + patch(u'openlp.core.lib.formattingtags.pickle') as mocked_pickle: # GIVEN: Our mocked modules and functions. mocked_translate.side_effect = lambda module, string_to_translate: string_to_translate mocked_settings.value.return_value = u'' - mocked_cPickle.loads.side_effect = [[], [TAG]] + mocked_pickle.loads.side_effect = [[], [TAG]] # WHEN: Get the display tags. FormattingTags.load_tags() diff --git a/tests/functional/openlp_core_lib/test_serviceitem.py b/tests/functional/openlp_core_lib/test_serviceitem.py index d50ddc978..0f1730820 100644 --- a/tests/functional/openlp_core_lib/test_serviceitem.py +++ b/tests/functional/openlp_core_lib/test_serviceitem.py @@ -2,7 +2,7 @@ Package to test the openlp.core.lib package. """ import os -import cPickle +import pickle from unittest import TestCase from mock import MagicMock, patch @@ -272,7 +272,7 @@ class TestServiceItem(TestCase): service_file = os.path.join(TEST_PATH, name) try: open_file = open(service_file, u'r') - items = cPickle.load(open_file) + items = pickle.load(open_file) first_line = items[0] except IOError: first_line = u'' From 3e53ea9376c1687a27b59ca94c6cf9da69e22476 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 4 Apr 2013 13:18:49 +0200 Subject: [PATCH 027/108] fixed formatting tags rename error --- openlp/core/lib/formattingtags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 028abff35..770b2fb34 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -159,8 +159,8 @@ class FormattingTags(object): # Formatting Tags were also known as display tags. user_expands = Settings().value(u'displayTags/html_tags') - if user_expands_string: - user_tags = pickle.loads(user_expands_string) + if user_expands: + user_tags = pickle.loads(user_expands) for tag in user_tags: for element in tag: if isinstance(tag[element], str): From 0fbbf29cfa957599dfa17f0a7e7c9667eb888197 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 4 Apr 2013 13:54:19 +0200 Subject: [PATCH 028/108] added pickle fixme --- openlp/core/lib/formattingtags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 770b2fb34..501106619 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -156,7 +156,7 @@ class FormattingTags(object): u'end html': u'', u'protected': True, u'temporary': False}) FormattingTags.add_html_tags(base_tags) FormattingTags.add_html_tags(temporary_tags) - + # FIXME: python3 - fix pickle.load() and pickle.dumps(). # Formatting Tags were also known as display tags. user_expands = Settings().value(u'displayTags/html_tags') if user_expands: From a393302a07f5ed72fcab3001130baca84dd11bd3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 20 Apr 2013 19:53:17 +0200 Subject: [PATCH 029/108] fixed test --- tests/functional/openlp_core_lib/test_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/openlp_core_lib/test_lib.py b/tests/functional/openlp_core_lib/test_lib.py index 66cb834f1..d04fd1f29 100644 --- a/tests/functional/openlp_core_lib/test_lib.py +++ b/tests/functional/openlp_core_lib/test_lib.py @@ -179,7 +179,7 @@ class TestLib(TestCase): """ Test the get_text_file_string() method when a read error happens """ - with patch(u'openlp.core.lib.os.path.isfile') as mocked_isfile, patch(u'__builtin__.open') as mocked_open: + with patch(u'openlp.core.lib.os.path.isfile') as mocked_isfile, patch(u'builtins.open') as mocked_open: # GIVEN: A mocked-out open() which raises an exception and isfile returns True filename = u'testfile.txt' mocked_isfile.return_value = True From 186ca920dae2b8db40f6e5eadde9a82ec9d3e1b8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 20 Apr 2013 20:05:01 +0200 Subject: [PATCH 030/108] fixed test --- tests/functional/openlp_core_lib/test_image_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_image_manager.py b/tests/functional/openlp_core_lib/test_image_manager.py index 81098eb89..17facbc16 100644 --- a/tests/functional/openlp_core_lib/test_image_manager.py +++ b/tests/functional/openlp_core_lib/test_image_manager.py @@ -46,8 +46,8 @@ class TestImageManager(TestCase): # WHEN: The image bytes are requested. byte_array = self.image_manager.get_image_bytes(TEST_PATH, u'church.jpg') - # THEN: Type should be a byte array. - self.assertEqual(isinstance(byte_array, QtCore.QByteArray), True, u'The returned object should be a QByteArray') + # THEN: Type should be a str. + self.assertEqual(isinstance(byte_array, str), True, u'The returned object should be a str') # WHEN the image is retrieved has not been loaded # THEN a KeyError is thrown From 372a3cd4efff6546998a75b39e0112cd6681559b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 20 Apr 2013 20:23:42 +0200 Subject: [PATCH 031/108] fixed importer --- .../plugins/songs/lib/songshowplusimport.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index a72f83c4f..84fa0918f 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -27,7 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`songshowplusimport` module provides the functionality for importing +The :mod:`songshowplusimport` module provides the functionality for importing SongShow Plus songs into the OpenLP database. """ import os @@ -134,7 +134,7 @@ class SongShowPlusImport(SongImport): log.debug(length_descriptor_size) data = song_data.read(length_descriptor) if block_key == TITLE: - self.title = unicode(data, u'cp1252') + self.title = data elif block_key == AUTHOR: authors = data.split(" / ") for author in authors: @@ -143,19 +143,19 @@ class SongShowPlusImport(SongImport): author = authorParts[1] + " " + authorParts[0] self.parse_author(unicode(author, u'cp1252')) elif block_key == COPYRIGHT: - self.addCopyright(unicode(data, u'cp1252')) + self.addCopyright(data) elif block_key == CCLI_NO: self.ccliNumber = int(data) elif block_key == VERSE: - self.addVerse(unicode(data, u'cp1252'), "%s%s" % (VerseType.tags[VerseType.Verse], verse_no)) + self.addVerse(data, "%s%s" % (VerseType.tags[VerseType.Verse], verse_no)) elif block_key == CHORUS: - self.addVerse(unicode(data, u'cp1252'), "%s%s" % (VerseType.tags[VerseType.Chorus], verse_no)) + self.addVerse(data, "%s%s" % (VerseType.tags[VerseType.Chorus], verse_no)) elif block_key == BRIDGE: - self.addVerse(unicode(data, u'cp1252'), "%s%s" % (VerseType.tags[VerseType.Bridge], verse_no)) + self.addVerse(data, "%s%s" % (VerseType.tags[VerseType.Bridge], verse_no)) elif block_key == TOPIC: - self.topics.append(unicode(data, u'cp1252')) + self.topics.append(data) elif block_key == COMMENTS: - self.comments = unicode(data, u'cp1252') + self.comments = data elif block_key == VERSE_ORDER: verse_tag = self.to_openlp_verse_tag(data, True) if verse_tag: @@ -163,12 +163,12 @@ class SongShowPlusImport(SongImport): verse_tag = unicode(verse_tag, u'cp1252') self.ssp_verse_order_list.append(verse_tag) elif block_key == SONG_BOOK: - self.songBookName = unicode(data, u'cp1252') + self.songBookName = data elif block_key == SONG_NUMBER: self.songNumber = ord(data) elif block_key == CUSTOM_VERSE: verse_tag = self.to_openlp_verse_tag(verse_name) - self.addVerse(unicode(data, u'cp1252'), verse_tag) + self.addVerse(data, verse_tag) else: log.debug("Unrecognised blockKey: %s, data: %s" % (block_key, data)) song_data.seek(next_block_starts) From 85224bb792a6e3b98b64e8bf3f46a0f34b3776dd Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 20 Apr 2013 20:24:48 +0200 Subject: [PATCH 032/108] fixed importer --- openlp/plugins/songs/lib/songshowplusimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 84fa0918f..2f55ad221 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -141,7 +141,7 @@ class SongShowPlusImport(SongImport): if author.find(",") !=-1: authorParts = author.split(", ") author = authorParts[1] + " " + authorParts[0] - self.parse_author(unicode(author, u'cp1252')) + self.parse_author(author) elif block_key == COPYRIGHT: self.addCopyright(data) elif block_key == CCLI_NO: From 0a595a5994de9f17d3773a512ee2761f62a7598e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 20 Apr 2013 20:25:46 +0200 Subject: [PATCH 033/108] fixed importer --- openlp/plugins/songs/lib/songshowplusimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 2f55ad221..3fa3026fd 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -132,7 +132,7 @@ class SongShowPlusImport(SongImport): else: length_descriptor, = struct.unpack("B", song_data.read(1)) log.debug(length_descriptor_size) - data = song_data.read(length_descriptor) + data = song_data.read(length_descriptor).decode() if block_key == TITLE: self.title = data elif block_key == AUTHOR: From 646b1596a9ee7e571dd1185765146c80c4ce904a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 20 Apr 2013 20:34:06 +0200 Subject: [PATCH 034/108] should not be needed --- openlp/plugins/songs/lib/songshowplusimport.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 3fa3026fd..3f22e5e0f 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -159,8 +159,6 @@ class SongShowPlusImport(SongImport): elif block_key == VERSE_ORDER: verse_tag = self.to_openlp_verse_tag(data, True) if verse_tag: - if not isinstance(verse_tag, unicode): - verse_tag = unicode(verse_tag, u'cp1252') self.ssp_verse_order_list.append(verse_tag) elif block_key == SONG_BOOK: self.songBookName = data From 8fe2aed62f34d2e9fb4b9fb8e0cb27b5a8df805a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 23 Jun 2013 16:38:41 +0200 Subject: [PATCH 035/108] bytes/str fix --- openlp/core/ui/thememanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index be0e3bfa1..4ab125039 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -637,7 +637,7 @@ class ThemeManager(QtGui.QWidget): out_file = None try: out_file = open(theme_file, u'w') - out_file.write(theme_pretty_xml) + out_file.write(theme_pretty_xml.decode('UTF-8')) except IOError: log.exception(u'Saving theme to file failed') finally: From 0fee84cbb6dc02d7ed91ecf5a11f3cef2e080928 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 23 Jun 2013 19:32:25 +0200 Subject: [PATCH 036/108] works now --- openlp/core/ui/filerenameform.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index a53695426..51dd95b7c 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -59,12 +59,12 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): self.file_name_edit.setFocus() return QtGui.QDialog.exec_(self) -# def _get_main_window(self): -# """ -# Adds the main window to the class dynamically -# """ -# if not hasattr(self, u'_main_window'): -# self._main_window = Registry().get(u'main_window') -# return self._main_window -# -# main_window = property(_get_main_window) + def _get_main_window(self): + """ + Adds the main window to the class dynamically + """ + if not hasattr(self, u'_main_window'): + self._main_window = Registry().get(u'main_window') + return self._main_window + + main_window = property(_get_main_window) From 97a4bdf286508c5616e2f6f363ac538d6cc8e279 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Jul 2013 19:04:45 +0200 Subject: [PATCH 037/108] reverted changes to prevent merge conflicts --- openlp/core/lib/db.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index e7cee208d..c6bce2a00 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -105,8 +105,7 @@ def upgrade_db(url, upgrade): if version > upgrade.__version__: return version, upgrade.__version__ version += 1 - #FIXME: python3 - dislable upgrade - if load_changes and False: + if load_changes: while hasattr(upgrade, u'upgrade_%d' % version): log.debug(u'Running upgrade_%d', version) try: From ba462d321b06d8957efdfd13ec267d3a505652dc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Jul 2013 19:06:21 +0200 Subject: [PATCH 038/108] reverted change --- openlp/plugins/bibles/bibleplugin.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 3b9751157..e2888d67a 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -107,8 +107,6 @@ class BiblePlugin(Plugin): Perform tasks on application startup """ Plugin.app_startup(self) - # FIXME: python3 - return if self.manager.old_bible_databases: if QtGui.QMessageBox.information(self.main_window, translate('OpenLP', 'Information'), From 08f47c4a491878ef0ad958329cdb8098c0ce49aa Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Jul 2013 19:10:37 +0200 Subject: [PATCH 039/108] fixed str.decode --- openlp/core/lib/formattingtags.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 1984b08ba..78ad31fae 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -156,15 +156,10 @@ class FormattingTags(object): u'end html': u'', u'protected': True, u'temporary': False}) FormattingTags.add_html_tags(base_tags) FormattingTags.add_html_tags(temporary_tags) - # Formatting Tags were also known as display tags. user_expands_string = str(Settings().value(u'formattingTags/html_tags')) + # If we have some user ones added them as well if user_expands_string: user_tags = json.loads(user_expands_string) - for tag in user_tags: - for element in tag: - if isinstance(tag[element], str): - tag[element] = tag[element].decode('utf8') - # If we have some user ones added them as well FormattingTags.add_html_tags(user_tags) @staticmethod From b0f0fb554f88b7d52ab02e4b107fc275c7d547cb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 20:15:44 +0200 Subject: [PATCH 041/108] python3 does not have buffer --- openlp/plugins/songs/forms/editsongform.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 24d0d3024..df48aa704 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -385,9 +385,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): # lazy xml migration for now self.verse_list_widget.clear() self.verse_list_widget.setRowCount(0) - # This is just because occasionally the lyrics come back as a "buffer" - if isinstance(self.song.lyrics, buffer): - self.song.lyrics = unicode(self.song.lyrics) verse_tags_translated = False if self.song.lyrics.startswith(u' Date: Sat, 6 Jul 2013 20:20:27 +0200 Subject: [PATCH 042/108] python3 does not have buffer --- openlp/plugins/songs/lib/__init__.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 407fede8d..1fc6258cc 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -395,12 +395,6 @@ def clean_song(manager, song): """ from xml import SongXML - if isinstance(song.title, buffer): - song.title = unicode(song.title) - if isinstance(song.alternate_title, buffer): - song.alternate_title = unicode(song.alternate_title) - if isinstance(song.lyrics, buffer): - song.lyrics = unicode(song.lyrics) if song.title: song.title = clean_title(song.title) else: From 2c5eb64f6edc1d4014e103ea3679c173720b6628 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 21:49:03 +0200 Subject: [PATCH 043/108] sort fix --- openlp/core/utils/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index bfd0b0740..3529884d3 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -395,9 +395,10 @@ def get_natural_key(string): """ key = DIGITS_OR_NONDIGITS.findall(string) key = [int(part) if part.isdigit() else get_locale_key(part) for part in key] - # Python 3 does not support comparision of different types anymore. So make sure, that we do not compare str and int. - #if string[0].isdigit(): - # return [''] + key + # Python 3 does not support comparision of different types anymore. So make sure, that we do not compare str + # and int. + if string[0].isdigit(): + return [b''] + key return key From 414d9bb914b9c9ff90b521d7e68ac5a813817d8f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 22:35:20 +0200 Subject: [PATCH 044/108] fixed song import wizard --- openlp/plugins/songs/forms/songimportform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index add306505..a6126a9f3 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -60,8 +60,8 @@ class SongImportForm(OpenLPWizard): ``plugin`` The songs plugin. """ - self.clipboard = self.main_window.clipboard OpenLPWizard.__init__(self, parent, plugin, u'songImportWizard', u':/wizards/wizard_importsong.bmp') + self.clipboard = self.main_window.clipboard def setupUi(self, image): """ From a2b7ebcc30963781a5116f45d2fc50350acec478 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 22:56:13 +0200 Subject: [PATCH 045/108] started to fix FTW --- openlp/core/ui/firsttimeform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index e5bd9bf78..f4e716c0e 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -95,7 +95,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): files = self.web_access.read() #FIXME: python3 - TypeError: startswith first arg must be bytes or a tuple of bytes, not str #FIXME: python3 - readfp: Deprecated, use read_file instead. - self.config.readfp(io.BytesIO(files)) + self.config.read_string(files.decode()) self.update_screen_list_combo() self.was_download_cancelled = False self.theme_screenshot_thread = None From e3148f7f1aa7bf892dc3611d2cf8809b36aba41d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 23:04:47 +0200 Subject: [PATCH 046/108] more fixes to the FTW --- openlp/core/ui/firsttimeform.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index f4e716c0e..3da625dc1 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -67,7 +67,7 @@ class ThemeScreenshotThread(QtCore.QThread): filename = config.get(u'theme_%s' % theme, u'filename') screenshot = config.get(u'theme_%s' % theme, u'screenshot') urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot), - os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', screenshot)) + os.path.join(gettempdir(), u'openlp', screenshot)) item = QtGui.QListWidgetItem(title, self.parent().themes_list_widget) item.setData(QtCore.Qt.UserRole, filename) item.setCheckState(QtCore.Qt.Unchecked) @@ -117,7 +117,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): Set up display at start of theme edit. """ self.restart() - check_directory_exists(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) + check_directory_exists(os.path.join(gettempdir(), u'openlp')) self.no_internet_finish_button.setVisible(False) # Check if this is a re-run of the wizard. self.has_run_wizard = Settings().value(u'core/has run wizard') @@ -126,8 +126,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): songs = self.config.get(u'songs', u'languages') songs = songs.split(u',') for song in songs: - title = unicode(self.config.get(u'songs_%s' % song, u'title'), u'utf8') - filename = unicode(self.config.get(u'songs_%s' % song, u'filename'), u'utf8') + title = self.config.get(u'songs_%s' % song, u'title') + filename = self.config.get(u'songs_%s' % song, u'filename') item = QtGui.QListWidgetItem(title, self.songs_list_widget) item.setData(QtCore.Qt.UserRole, filename) item.setCheckState(QtCore.Qt.Unchecked) @@ -135,13 +135,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): bible_languages = self.config.get(u'bibles', u'languages') bible_languages = bible_languages.split(u',') for lang in bible_languages: - language = unicode(self.config.get(u'bibles_%s' % lang, u'title'), u'utf8') + language = self.config.get(u'bibles_%s' % lang, u'title') langItem = QtGui.QTreeWidgetItem(self.bibles_tree_widget, [language]) bibles = self.config.get(u'bibles_%s' % lang, u'translations') bibles = bibles.split(u',') for bible in bibles: - title = unicode(self.config.get(u'bible_%s' % bible, u'title'), u'utf8') - filename = unicode(self.config.get(u'bible_%s' % bible, u'filename')) + title = self.config.get(u'bible_%s' % bible, u'title') + filename = self.config.get(u'bible_%s' % bible, u'filename') item = QtGui.QTreeWidgetItem(langItem, [title]) item.setData(0, QtCore.Qt.UserRole, filename) item.setCheckState(0, QtCore.Qt.Unchecked) @@ -294,8 +294,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): item = self.themes_list_widget.item(index) if item.data(QtCore.Qt.UserRole) == filename: break - item.setIcon(build_icon(os.path.join(unicode(gettempdir(), - get_filesystem_encoding()), u'openlp', screenshot))) + item.setIcon(build_icon(os.path.join(gettempdir(), u'openlp', screenshot))) def _getFileSize(self, url): """ From 04bbeead566f63d2e271f7e8439591e35c3dff51 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 23:06:45 +0200 Subject: [PATCH 047/108] more fixes to the FTW --- openlp/core/ui/firsttimeform.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 3da625dc1..ca00118eb 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -42,7 +42,7 @@ from ConfigParser import SafeConfigParser from PyQt4 import QtCore, QtGui from openlp.core.lib import PluginStatus, Settings, Registry, build_icon, check_directory_exists, translate -from openlp.core.utils import AppLocation, get_web_page, get_filesystem_encoding +from openlp.core.utils import AppLocation, get_web_page from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage log = logging.getLogger(__name__) @@ -427,8 +427,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self._set_plugin_status(self.alert_check_box, u'alerts/status') if self.web_access: # Build directories for downloads - songs_destination = os.path.join( - unicode(gettempdir(), get_filesystem_encoding()), u'openlp') + songs_destination = os.path.join(gettempdir(), u'openlp') bibles_destination = AppLocation.get_section_data_path(u'bibles') themes_destination = AppLocation.get_section_data_path(u'themes') # Download songs From 18c3574cfef0aad6764622e5db8bcac36abe5d9f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 23:18:15 +0200 Subject: [PATCH 048/108] more FTW fixes --- openlp/core/ui/firsttimeform.py | 4 ++-- openlp/plugins/songs/songsplugin.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index ca00118eb..e844673ee 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -303,9 +303,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): ``url`` The URL of the file we want to download. """ - site = urllib.urlopen(url) + site = urllib.request.urlopen(url) meta = site.info() - return int(meta.getheaders("Content-Length")[0]) + return int(meta.get("Content-Length")) def _download_progress(self, count, block_size): """ diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 1c895d327..c9cf22534 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -41,7 +41,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, StringContent, UiStrings, build_icon, translate from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action -from openlp.core.utils import get_filesystem_encoding from openlp.core.utils.actions import ActionList from openlp.plugins.songs.lib import clean_song, upgrade from openlp.plugins.songs.lib.db import init_schema, Song @@ -263,7 +262,7 @@ class SongsPlugin(Plugin): self.application.process_events() self.on_tools_reindex_item_triggered() self.application.process_events() - db_dir = unicode(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) + db_dir = os.path.join(gettempdir(), u'openlp') if not os.path.exists(db_dir): return song_dbs = [] From 022f899c10171b76a43177103df29b180b87e221 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 23:20:46 +0200 Subject: [PATCH 049/108] added fixme --- openlp/core/ui/firsttimeform.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index e844673ee..951a36ad7 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -29,6 +29,7 @@ """ This module contains the first time wizard. """ +#FIXME: python3: remove duplicated imports. import io import logging import os From e145be9873c494298d35013260bd4eb1f22374af Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 6 Jul 2013 23:32:58 +0200 Subject: [PATCH 050/108] --- openlp/core/ui/mainwindow.py | 5 ++- .../plugins/bibles/forms/bibleupgradeform.py | 4 +-- .../openlp_core_utils/test_utils.py | 31 +------------------ 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 307239032..b143d6e01 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -47,8 +47,7 @@ from openlp.core.lib.ui import UiStrings, create_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm from openlp.core.ui.media import MediaController -from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version, \ - get_filesystem_encoding +from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.ui.firsttimeform import FirstTimeForm @@ -903,7 +902,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Make sure it's a .conf file. if not export_file_name.endswith(u'conf'): export_file_name += u'.conf' - temp_file = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', u'exportConf.tmp') + temp_file = os.path.join(gettempdir(), u'openlp', u'exportConf.tmp') self.save_settings() setting_sections = [] # Add main sections. diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index caba4b30f..99ef941ed 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -39,7 +39,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Registry, Settings, UiStrings, translate, check_directory_exists from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings -from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding +from openlp.core.utils import AppLocation, delete_file from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta, OldBibleDB, BiblesResourcesDB from openlp.plugins.bibles.lib.http import BSExtract, BGExtract, CWExtract @@ -71,7 +71,7 @@ class BibleUpgradeForm(OpenLPWizard): self.suffix = u'.sqlite' self.settings_section = u'bibles' self.path = AppLocation.get_section_data_path(self.settings_section) - self.temp_dir = os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp') + self.temp_dir = os.path.join(gettempdir(), u'openlp') self.files = self.manager.old_bible_databases self.success = {} self.new_bibles = {} diff --git a/tests/functional/openlp_core_utils/test_utils.py b/tests/functional/openlp_core_utils/test_utils.py index 8e3a427ed..9409f0803 100644 --- a/tests/functional/openlp_core_utils/test_utils.py +++ b/tests/functional/openlp_core_utils/test_utils.py @@ -5,42 +5,13 @@ from unittest import TestCase from mock import patch -from openlp.core.utils import clean_filename, get_filesystem_encoding, _get_frozen_path, get_locale_key, \ - get_natural_key, split_filename +from openlp.core.utils import clean_filename, _get_frozen_path, get_locale_key, get_natural_key, split_filename class TestUtils(TestCase): """ A test suite to test out various methods around the AppLocation class. """ - def get_filesystem_encoding_test(self): - """ - Test the get_filesystem_encoding() function - """ - with patch(u'openlp.core.utils.sys.getfilesystemencoding') as mocked_getfilesystemencoding, \ - patch(u'openlp.core.utils.sys.getdefaultencoding') as mocked_getdefaultencoding: - # GIVEN: sys.getfilesystemencoding returns "cp1252" - mocked_getfilesystemencoding.return_value = u'cp1252' - - # WHEN: get_filesystem_encoding() is called - result = get_filesystem_encoding() - - # THEN: getdefaultencoding should have been called - mocked_getfilesystemencoding.assert_called_with() - assert not mocked_getdefaultencoding.called - assert result == u'cp1252', u'The result should be "cp1252"' - - # GIVEN: sys.getfilesystemencoding returns None and sys.getdefaultencoding returns "utf-8" - mocked_getfilesystemencoding.return_value = None - mocked_getdefaultencoding.return_value = u'utf-8' - - # WHEN: get_filesystem_encoding() is called - result = get_filesystem_encoding() - - # THEN: getdefaultencoding should have been called - mocked_getfilesystemencoding.assert_called_with() - mocked_getdefaultencoding.assert_called_with() - assert result == u'utf-8', u'The result should be "utf-8"' def get_frozen_path_test(self): """ From a3b99a6a5da12928c8fc8efca7d34b2452de4137 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 00:24:27 +0200 Subject: [PATCH 051/108] removed fixme --- openlp/core/ui/firsttimeform.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 951a36ad7..f1307fb0e 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -94,8 +94,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.web_access = get_web_page(u'%s%s' % (self.web, u'download.cfg')) if self.web_access: files = self.web_access.read() - #FIXME: python3 - TypeError: startswith first arg must be bytes or a tuple of bytes, not str - #FIXME: python3 - readfp: Deprecated, use read_file instead. self.config.read_string(files.decode()) self.update_screen_list_combo() self.was_download_cancelled = False From 3d803f4423ffe2210ef9ea2455290b3b40442f2e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 00:27:49 +0200 Subject: [PATCH 052/108] reverted not needed changes --- openlp/core/lib/settingstab.py | 4 ++-- openlp/core/ui/serviceitemeditform.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 7d38f3e28..ab775599a 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -185,8 +185,8 @@ class SettingsTab(QtGui.QWidget): """ Adds the media controller to the class dynamically """ - if not hasattr(self, '_media_controller'): - self._media_controller = Registry().get('media_controller') + if not hasattr(self, u'_media_controller'): + self._media_controller = Registry().get(u'media_controller') return self._media_controller media_controller = property(_get_media_controller) diff --git a/openlp/core/ui/serviceitemeditform.py b/openlp/core/ui/serviceitemeditform.py index 6ca1068cc..5eb074a0e 100644 --- a/openlp/core/ui/serviceitemeditform.py +++ b/openlp/core/ui/serviceitemeditform.py @@ -42,7 +42,6 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog): def __init__(self): """ Constructor - """ super(ServiceItemEditForm, self).__init__(Registry().get(u'main_window')) self.setupUi(self) From 8363979040755bf692b29d08505babb087b96e14 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 16:00:14 +0200 Subject: [PATCH 053/108] fixed duplicate finder --- openlp/plugins/songs/forms/duplicatesongremovalform.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/forms/duplicatesongremovalform.py b/openlp/plugins/songs/forms/duplicatesongremovalform.py index 4427bbb31..424e913b1 100644 --- a/openlp/plugins/songs/forms/duplicatesongremovalform.py +++ b/openlp/plugins/songs/forms/duplicatesongremovalform.py @@ -67,7 +67,7 @@ class DuplicateSongRemovalForm(OpenLPWizard): self.review_total_count = 0 # Used to interrupt ongoing searches when cancel is clicked. self.break_search = False - OpenLPWizard.__init__(self, self.main_window, plugin, u'duplicateSongRemovalWizard', + OpenLPWizard.__init__(self, Registry().get('main_window'), plugin, u'duplicateSongRemovalWizard', u':/wizards/wizard_duplicateremoval.bmp', False) self.setMinimumWidth(730) @@ -312,7 +312,7 @@ class DuplicateSongRemovalForm(OpenLPWizard): self.review_scroll_area_layout.removeItem(item) # Process next set of duplicates. self.process_current_duplicate_entry() - + def process_current_duplicate_entry(self): """ Update the review counter in the wizard header, add song widgets for @@ -359,4 +359,5 @@ class DuplicateSongRemovalForm(OpenLPWizard): self._application = Registry().get(u'application') return self._application - application = property(_get_application) \ No newline at end of file + application = property(_get_application) + From 83df3c293a9f6466e93e645e1c7029305641170d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 16:08:47 +0200 Subject: [PATCH 054/108] fixed sorting again --- openlp/plugins/songs/lib/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index 015caa87d..010aabc75 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -68,7 +68,7 @@ class Song(BaseModel): Song model """ def __init__(self): - self.sort_key = () + self.sort_key = [] @reconstructor def init_on_load(self): From 1328ca62d210b76068cf260c140ae7de8371ccff Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 16:16:55 +0200 Subject: [PATCH 055/108] print form constructor --- openlp/core/ui/printserviceform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 37a170224..c285662bb 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -118,7 +118,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): """ Constructor """ - QtGui.QDialog.__init__(self, self.main_window) + QtGui.QDialog.__init__(self, Registry().get('main_window')) self.printer = QtGui.QPrinter() self.print_dialog = QtGui.QPrintDialog(self.printer, self) self.document = QtGui.QTextDocument() From 90e867b797d8e31fca5d1438778f52cdadba6ea2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 16:19:18 +0200 Subject: [PATCH 056/108] fixed service print --- openlp/core/ui/printserviceform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index c285662bb..169478106 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -183,7 +183,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): self._add_element( u'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div, classId=u'customNotesTitle') self._add_element(u'span', cgi.escape(self.footer_text_edit.toPlainText()), div, classId=u'customNotesText') - self.document.setHtml(html.tostring(html_data)) + self.document.setHtml(html.tostring(html_data).decode()) self.preview_widget.updatePreview() def _add_preview_item(self, body, item, index): From 07039a4908399774fa6f0d8f068f1a9e3afd174c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 16:41:43 +0200 Subject: [PATCH 057/108] import clean up --- openlp/core/ui/firsttimeform.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index f1307fb0e..9cbde8531 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -29,14 +29,13 @@ """ This module contains the first time wizard. """ -#FIXME: python3: remove duplicated imports. -import io import logging import os import sys import time -import urllib -import urllib2 +import urllib.request +import urllib.parse +import urllib.error from tempfile import gettempdir from ConfigParser import SafeConfigParser From 3db606f653d006080af5b288659779b312707a29 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 7 Jul 2013 16:47:04 +0200 Subject: [PATCH 058/108] theme import fixes --- openlp/core/ui/thememanager.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index dcaad74d4..1fe1ea0b7 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -514,23 +514,17 @@ class ThemeManager(QtGui.QWidget): else: abort_import = False for name in theme_zip.namelist(): - try: - uname = unicode(name, u'utf-8') - except UnicodeDecodeError: - log.exception(u'Theme file contains non utf-8 filename "%s"' % - name.decode(u'utf-8', u'replace')) - raise Exception(u'validation') - uname = uname.replace(u'/', os.path.sep) - split_name = uname.split(os.path.sep) + name = name.replace(u'/', os.path.sep) + split_name = name.split(os.path.sep) if split_name[-1] == u'' or len(split_name) == 1: # is directory or preview file continue - full_name = os.path.join(directory, uname) + full_name = os.path.join(directory, name) check_directory_exists(os.path.dirname(full_name)) - if os.path.splitext(uname)[1].lower() == u'.xml': + if os.path.splitext(name)[1].lower() == u'.xml': file_xml = unicode(theme_zip.read(name), u'utf-8') out_file = open(full_name, u'w') - out_file.write(file_xml.encode(u'utf-8')) + out_file.write(file_xml) else: out_file = open(full_name, u'wb') out_file.write(theme_zip.read(name)) From b8624e60194284d8665cfd9021e833a53a2aa9eb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 12 Jul 2013 09:30:38 +0200 Subject: [PATCH 059/108] fixed OpenLyrics export --- openlp/plugins/songs/lib/openlyricsexport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index 35a9a29ec..533170b38 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -78,7 +78,7 @@ class OpenLyricsExport(object): filename = u'%s.xml' % filename[0:250 - len(self.save_path)] # Pass a file object, because lxml does not cope with some special # characters in the path (see lp:757673 and lp:744337). - tree.write(open(os.path.join(self.save_path, filename), u'w'), + tree.write(open(os.path.join(self.save_path, filename), u'wb'), encoding=u'utf-8', xml_declaration=True, pretty_print=True) return True From 419b6764c36de9a349e171426ca2b201e5ffaaae Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 12 Jul 2013 21:13:18 +0200 Subject: [PATCH 060/108] fixed OpenLyrics importer --- openlp/plugins/songs/lib/openlyricsimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/openlyricsimport.py b/openlp/plugins/songs/lib/openlyricsimport.py index d855f521e..e33718853 100644 --- a/openlp/plugins/songs/lib/openlyricsimport.py +++ b/openlp/plugins/songs/lib/openlyricsimport.py @@ -70,7 +70,7 @@ class OpenLyricsImport(SongImport): # Pass a file object, because lxml does not cope with some # special characters in the path (see lp:757673 and lp:744337). parsed_file = etree.parse(open(file_path, u'r'), parser) - xml = unicode(etree.tostring(parsed_file)) + xml = etree.tostring(parsed_file).decode() self.openLyrics.xml_to_song(xml) except etree.XMLSyntaxError: log.exception(u'XML syntax error in file %s' % file_path) From 53b0825a185caee9e832425735371ba150f29ba8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 12 Jul 2013 21:26:46 +0200 Subject: [PATCH 061/108] fixed service save --- openlp/core/ui/servicemanager.py | 2 +- openlp/plugins/songs/lib/xml.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e6b764189..37feffd6c 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -594,7 +594,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, True) # First we add service contents. - zip_file.writestr(service_file_name.encode(u'utf-8'), service_content) + zip_file.writestr(service_file_name, service_content) except IOError: log.exception(u'Failed to save service to disk: %s', temp_file_name) self.main_window.error_message(translate(u'OpenLP.ServiceManager', u'Error Saving File'), diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 8d6bbc032..454ae209a 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -340,7 +340,7 @@ class OpenLyrics(object): # Do not add the break attribute to the last lines element. if index < len(optional_verses) - 1: lines_element.set(u'break', u'optional') - return self._extract_xml(song_xml) + return self._extract_xml(song_xml).decode() def _get_missing_tags(self, text): """ From 765a10d2ea3dda1b49e5b4a688e488a23de4f2f7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 12 Jul 2013 21:32:46 +0200 Subject: [PATCH 062/108] fixed service save --- openlp/core/ui/servicemanager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 37feffd6c..26d09db8a 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -522,11 +522,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self.main_window.increment_progress_bar() try: zip_file = zipfile.ZipFile(temp_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64) - # First we add service contents. We save ALL file_names into ZIP using UTF-8. - zip_file.writestr(service_file_name.encode(u'utf-8'), service_content) + # First we add service contents.. + zip_file.writestr(service_file_name, service_content) # Finally add all the listed media files. for write_from in write_list: - zip_file.write(write_from, write_from.encode(u'utf-8')) + zip_file.write(write_from, write_from) for audio_from, audio_to in audio_files: if audio_from.startswith(u'audio'): # When items are saved, they get new unique_identifier. Let's copy the file to the new location. @@ -537,7 +537,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): check_directory_exists(save_path) if not os.path.exists(save_file): shutil.copy(audio_from, save_file) - zip_file.write(audio_from, audio_to.encode(u'utf-8')) + zip_file.write(audio_from, audio_to) except IOError: log.exception(u'Failed to save service to disk: %s', temp_file_name) self.main_window.error_message(translate(u'OpenLP.ServiceManager', u'Error Saving File'), From a091fe939505f139984920ee4dd093894663238d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 12 Jul 2013 21:35:30 +0200 Subject: [PATCH 063/108] fixed service load --- openlp/core/ui/servicemanager.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 26d09db8a..e02036bf2 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -686,14 +686,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): zip_file = zipfile.ZipFile(file_name) for zip_info in zip_file.infolist(): try: - ucsfile = zip_info.filename.decode(u'utf-8') + ucs_file = zip_info.filename except UnicodeDecodeError: - log.exception(u'file_name "%s" is not valid UTF-8' % - zip_info.file_name.decode(u'utf-8', u'replace')) + log.exception(u'file_name "%s" is not valid UTF-8' % zip_info.file_name) critical_error_message_box(message=translate('OpenLP.ServiceManager', 'File is not a valid service.\n The content encoding is not UTF-8.')) continue - osfile = ucsfile.replace(u'/', os.path.sep) + osfile = ucs_file.replace(u'/', os.path.sep) if not osfile.startswith(u'audio'): osfile = os.path.split(osfile)[1] log.debug(u'Extract file: %s', osfile) From aa7d45c09d34a75733d4abd9b41aaa18222f00c1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 13 Jul 2013 17:27:19 +0200 Subject: [PATCH 064/108] started to fix remotes --- openlp/plugins/remotes/lib/httpserver.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index a2abbb41e..19529c0e1 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -445,7 +445,7 @@ class HttpRouter(object): u'display': self.live_controller.desktop_screen.isChecked() } cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': result}) + return json.dumps({u'results': result}).encode() def live_poll(self): """ @@ -455,7 +455,7 @@ class HttpRouter(object): u'slide_count': self.live_controller.slide_count } cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': result}) + return json.dumps({u'results': result}).encode() def live_image(self): """ @@ -465,7 +465,7 @@ class HttpRouter(object): u'slide_image': u'data:image/png;base64,' + str(image_to_byte(self.live_controller.slide_image)) } cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': result}) + return json.dumps({u'results': result}).encode() def display(self, action): """ @@ -477,7 +477,7 @@ class HttpRouter(object): """ self.live_controller.emit(QtCore.SIGNAL(u'slidecontroller_toggle_display'), action) cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': {u'success': True}}) + return json.dumps({u'results': {u'success': True}}).encode() def alert(self): """ @@ -495,7 +495,7 @@ class HttpRouter(object): else: success = False cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': {u'success': success}}) + return json.dumps({u'results': {u'success': success}}).encode() def controller(self, display_type, action): """ @@ -543,7 +543,7 @@ class HttpRouter(object): self.live_controller.emit(QtCore.SIGNAL(event)) json_data = {u'results': {u'success': True}} cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps(json_data) + return json.dumps(json_data).encode() def service(self, action): """ @@ -555,7 +555,7 @@ class HttpRouter(object): event = u'servicemanager_%s' % action if action == u'list': cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': {u'items': self._get_service_items()}}) + return json.dumps({u'results': {u'items': self._get_service_items()}}).encode() event += u'_item' if self.request_data: try: @@ -566,7 +566,7 @@ class HttpRouter(object): else: Registry().execute(event) cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': {u'success': True}}) + return json.dumps({u'results': {u'success': True}}).encode() def plugin_info(self, action): """ @@ -582,7 +582,7 @@ class HttpRouter(object): if plugin.status == PluginStatus.Active and plugin.media_item and plugin.media_item.has_search: searches.append([plugin.name, unicode(plugin.text_strings[StringContent.Name][u'plural'])]) cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': {u'items': searches}}) + return json.dumps({u'results': {u'items': searches}}).encode() def search(self, plugin_name): """ @@ -602,7 +602,7 @@ class HttpRouter(object): else: results = [] cherrypy.response.headers['Content-Type'] = u'application/json' - return json.dumps({u'results': {u'items': results}}) + return json.dumps({u'results': {u'items': results}}).encode() def go_live(self, plugin_name): """ From cf9768aa2e046486bd32954046182ef774efeea8 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 13 Jul 2013 17:30:45 +0200 Subject: [PATCH 065/108] another remotes fix --- openlp/plugins/remotes/lib/httpserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 19529c0e1..671a85517 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -648,7 +648,7 @@ class HttpRouter(object): Set the HTTP not found return code. """ cherrypy.response.status = 404 - cherrypy.response.body = ["Sorry, an error occurred "] + cherrypy.response.body = [b'Sorry, an error occurred '] def _get_service_manager(self): """ From 678bb3e2beadaa9e904a52010ddafcc74b69807a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 13 Jul 2013 17:35:47 +0200 Subject: [PATCH 066/108] fixed DreamBeam importer --- openlp/plugins/songs/lib/dreambeamimport.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/dreambeamimport.py b/openlp/plugins/songs/lib/dreambeamimport.py index 72dbed2d4..5a5bde163 100644 --- a/openlp/plugins/songs/lib/dreambeamimport.py +++ b/openlp/plugins/songs/lib/dreambeamimport.py @@ -100,12 +100,11 @@ class DreamBeamImport(SongImport): log.exception(u'XML syntax error in file %s' % file) self.logError(file, SongStrings.XMLSyntaxError) continue - xml = unicode(etree.tostring(parsed_file)) + xml = etree.tostring(parsed_file).decode() song_xml = objectify.fromstring(xml) if song_xml.tag != u'DreamSong': - self.logError(file, unicode( - translate('SongsPlugin.DreamBeamImport', - ('Invalid DreamBeam song file. Missing DreamSong tag.')))) + self.logError(file, + translate('SongsPlugin.DreamBeamImport', 'Invalid DreamBeam song file. Missing DreamSong tag.')) continue if hasattr(song_xml, u'Version'): self.version = float(song_xml.Version.text) From f37748ba51fe8714a287d75ac82e816503983c6a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 13 Jul 2013 17:38:14 +0200 Subject: [PATCH 067/108] fixed easyslides importer --- openlp/plugins/songs/lib/easyslidesimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/easyslidesimport.py b/openlp/plugins/songs/lib/easyslidesimport.py index 415810400..cfbdf787a 100644 --- a/openlp/plugins/songs/lib/easyslidesimport.py +++ b/openlp/plugins/songs/lib/easyslidesimport.py @@ -54,7 +54,7 @@ class EasySlidesImport(SongImport): log.info(u'Importing EasySlides XML file %s', self.import_source) parser = etree.XMLParser(remove_blank_text=True) parsed_file = etree.parse(self.import_source, parser) - xml = unicode(etree.tostring(parsed_file)) + xml = etree.tostring(parsed_file).decode() song_xml = objectify.fromstring(xml) self.import_wizard.progress_bar.setMaximum(len(song_xml.Item)) for song in song_xml.Item: From 7bb5d6afbdbf03f3bd9e31f1889bdf4d04bf5cc5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 13 Jul 2013 17:45:55 +0200 Subject: [PATCH 068/108] fixed FoliPresenter importer --- openlp/plugins/songs/lib/foilpresenterimport.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/foilpresenterimport.py b/openlp/plugins/songs/lib/foilpresenterimport.py index cc91562c5..d89bdb719 100644 --- a/openlp/plugins/songs/lib/foilpresenterimport.py +++ b/openlp/plugins/songs/lib/foilpresenterimport.py @@ -126,11 +126,10 @@ class FoilPresenterImport(SongImport): for file_path in self.import_source: if self.stop_import_flag: return - self.import_wizard.increment_progress_bar( - WizardStrings.ImportingType % os.path.basename(file_path)) + self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path)) try: parsed_file = etree.parse(file_path, parser) - xml = unicode(etree.tostring(parsed_file)) + xml = etree.tostring(parsed_file).decode() self.FoilPresenter.xml_to_song(xml) except etree.XMLSyntaxError: self.logError(file_path, SongStrings.XMLSyntaxError) From ad715fec293b3fd510334eae455f87d3930a7ee6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 15 Jul 2013 20:02:54 +0200 Subject: [PATCH 069/108] try to use locale.strxfrm --- openlp/core/utils/__init__.py | 19 +++++++++------ .../openlp_core_utils/test_utils.py | 23 +++++++++++++++++-- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 3529884d3..cdda7b3ea 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -376,16 +376,21 @@ def format_time(text, local_time): def get_locale_key(string): """ Creates a key for case insensitive, locale aware string sorting. + + ``string`` + The corresponding string. """ string = string.lower() # For Python 3 on platforms other than Windows ICU is not necessary. In those cases locale.strxfrm(str) can be used. - global ICU_COLLATOR - if ICU_COLLATOR is None: - from languagemanager import LanguageManager - locale = LanguageManager.get_language() - icu_locale = icu.Locale(locale) - ICU_COLLATOR = icu.Collator.createInstance(icu_locale) - return ICU_COLLATOR.getSortKey(string) + if os.name == 'nt': + global ICU_COLLATOR + if ICU_COLLATOR is None: + from .languagemanager import LanguageManager + language = LanguageManager.get_language() + icu_locale = icu.Locale(language) + ICU_COLLATOR = icu.Collator.createInstance(icu_locale) + return ICU_COLLATOR.getSortKey(string) + return locale.strxfrm(string).encode() def get_natural_key(string): diff --git a/tests/functional/openlp_core_utils/test_utils.py b/tests/functional/openlp_core_utils/test_utils.py index 8e3a427ed..9c8db3ac9 100644 --- a/tests/functional/openlp_core_utils/test_utils.py +++ b/tests/functional/openlp_core_utils/test_utils.py @@ -105,14 +105,33 @@ class TestUtils(TestCase): # THEN: The file name should be cleaned. assert result == wanted_name, u'The file name should not contain any special characters.' - def get_locale_key_test(self): + def get_locale_key_windows_test(self): """ Test the get_locale_key(string) function """ - with patch(u'openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language: + with patch(u'openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language, \ + patch(u'openlp.core.utils.os') as mocked_os: # GIVEN: The language is German # 0x00C3 (A with diaresis) should be sorted as "A". 0x00DF (sharp s) should be sorted as "ss". mocked_get_language.return_value = u'de' + mocked_os.name = u'nt' + unsorted_list = [u'Auszug', u'Aushang', u'\u00C4u\u00DFerung'] + # WHEN: We sort the list and use get_locale_key() to generate the sorting keys + # THEN: We get a properly sorted list + test_passes = sorted(unsorted_list, key=get_locale_key) == [u'Aushang', u'\u00C4u\u00DFerung', u'Auszug'] + assert test_passes, u'Strings should be sorted properly' + + def get_locale_key_linux_test(self): + + """ + Test the get_locale_key(string) function + """ + with patch(u'openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language, \ + patch(u'openlp.core.utils.os.name') as mocked_os: + # GIVEN: The language is German + # 0x00C3 (A with diaresis) should be sorted as "A". 0x00DF (sharp s) should be sorted as "ss". + mocked_get_language.return_value = u'de' + mocked_os.name = u'linux' unsorted_list = [u'Auszug', u'Aushang', u'\u00C4u\u00DFerung'] # WHEN: We sort the list and use get_locale_key() to generate the sorting keys # THEN: We get a properly sorted list From 0512b74f326d4bd123338facc855be9b5bce6410 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 15 Jul 2013 20:06:45 +0200 Subject: [PATCH 070/108] reverted change --- openlp/core/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index cdda7b3ea..59dd08b27 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -385,7 +385,7 @@ def get_locale_key(string): if os.name == 'nt': global ICU_COLLATOR if ICU_COLLATOR is None: - from .languagemanager import LanguageManager + from languagemanager import LanguageManager language = LanguageManager.get_language() icu_locale = icu.Locale(language) ICU_COLLATOR = icu.Collator.createInstance(icu_locale) From 8bec3492732184942081367bc56127af303aa160 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 17 Jul 2013 14:22:21 +0200 Subject: [PATCH 071/108] fixed image filter --- openlp/core/utils/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 0a4df48f8..0bbcb0c40 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -239,7 +239,8 @@ def get_images_filter(): global IMAGES_FILTER if not IMAGES_FILTER: log.debug(u'Generating images filter.') - formats = map(unicode, QtGui.QImageReader.supportedImageFormats()) + formats = list(map(bytes, QtGui.QImageReader.supportedImageFormats())) + formats = list(map(bytes.decode, formats)) visible_formats = u'(*.%s)' % u'; *.'.join(formats) actual_formats = u'(*.%s)' % u' *.'.join(formats) IMAGES_FILTER = u'%s %s %s' % (translate('OpenLP', 'Image Files'), visible_formats, actual_formats) From b04d0f42cc661d862cca953e00eeb9c6180b0fe7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 17 Jul 2013 14:28:48 +0200 Subject: [PATCH 072/108] fixed image filter --- openlp/core/utils/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 0bbcb0c40..ed958a53f 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -239,8 +239,7 @@ def get_images_filter(): global IMAGES_FILTER if not IMAGES_FILTER: log.debug(u'Generating images filter.') - formats = list(map(bytes, QtGui.QImageReader.supportedImageFormats())) - formats = list(map(bytes.decode, formats)) + formats = list(map(bytes.decode, map(bytes, QtGui.QImageReader.supportedImageFormats()))) visible_formats = u'(*.%s)' % u'; *.'.join(formats) actual_formats = u'(*.%s)' % u' *.'.join(formats) IMAGES_FILTER = u'%s %s %s' % (translate('OpenLP', 'Image Files'), visible_formats, actual_formats) From 161a1db12d4de21803700354b6dabe0597231801 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 17 Jul 2013 16:32:29 +0200 Subject: [PATCH 073/108] fixed test --- tests/functional/openlp_core_lib/test_image_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/openlp_core_lib/test_image_manager.py b/tests/functional/openlp_core_lib/test_image_manager.py index 17facbc16..d5bcca2e3 100644 --- a/tests/functional/openlp_core_lib/test_image_manager.py +++ b/tests/functional/openlp_core_lib/test_image_manager.py @@ -53,4 +53,4 @@ class TestImageManager(TestCase): # THEN a KeyError is thrown with self.assertRaises(KeyError) as context: self.image_manager.get_image(TEST_PATH, u'church1.jpg') - self.assertNotEquals(context.exception[0], u'', u'KeyError exception should have been thrown for missing image') + self.assertNotEquals(context.exception, u'', u'KeyError exception should have been thrown for missing image') From 55fbe75695f3cb3551a003419949e226f5c869b0 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 17 Jul 2013 16:38:14 +0200 Subject: [PATCH 074/108] 'fixed' tests --- tests/functional/openlp_core_lib/test_registry.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_registry.py b/tests/functional/openlp_core_lib/test_registry.py index 6e9e8fe7f..b10afe0cc 100644 --- a/tests/functional/openlp_core_lib/test_registry.py +++ b/tests/functional/openlp_core_lib/test_registry.py @@ -31,14 +31,14 @@ class TestRegistry(TestCase): # THEN and I will get an exception with self.assertRaises(KeyError) as context: Registry().register(u'test1', mock_1) - self.assertEqual(context.exception[0], u'Duplicate service exception test1', + self.assertEqual(context.exception, u'Duplicate service exception test1', u'KeyError exception should have been thrown for duplicate service') # WHEN I try to get back a non existent component # THEN I will get an exception with self.assertRaises(KeyError) as context: temp = Registry().get(u'test2') - self.assertEqual(context.exception[0], u'Service test2 not found in list', + self.assertEqual(context.exception, u'Service test2 not found in list', u'KeyError exception should have been thrown for missing service') # WHEN I try to replace a component I should be allowed (testing only) @@ -46,7 +46,7 @@ class TestRegistry(TestCase): # THEN I will get an exception with self.assertRaises(KeyError) as context: temp = Registry().get(u'test1') - self.assertEqual(context.exception[0], u'Service test1 not found in list', + self.assertEqual(context.exception, u'Service test1 not found in list', u'KeyError exception should have been thrown for deleted service') def registry_function_test(self): @@ -81,4 +81,5 @@ class TestRegistry(TestCase): return "function_1" def dummy_function_2(self): - return "function_2" \ No newline at end of file + return "function_2" + From 2c167ca9960974d42a800d48897f5150027b05fa Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 13:15:17 +0200 Subject: [PATCH 075/108] changed constructor --- openlp/core/lib/imagemanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index dc535a665..bc0d99636 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -56,7 +56,7 @@ class ImageThread(QtCore.QThread): ``manager`` The image manager. """ - QtCore.QThread.__init__(self, None) + super(ImageThread, self).__init__(None) self.image_manager = manager def run(self): @@ -183,7 +183,7 @@ class ImageManager(QtCore.QObject): """ Constructor for the image manager. """ - QtCore.QObject.__init__(self) + super(ImageManager, self).__init__() Registry().register(u'image_manager', self) current_screen = ScreenList().current self.width = current_screen[u'size'].width() From e8e003d6f82c2f8fa8ec4b2a178cba6e57adfd9a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 13:17:40 +0200 Subject: [PATCH 076/108] changed constructor --- openlp/core/lib/dockwidget.py | 2 +- openlp/core/lib/listwidgetwithdnd.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/dockwidget.py b/openlp/core/lib/dockwidget.py index 15c116e0f..1966a55ed 100644 --- a/openlp/core/lib/dockwidget.py +++ b/openlp/core/lib/dockwidget.py @@ -49,7 +49,7 @@ class OpenLPDockWidget(QtGui.QDockWidget): Initialise the DockWidget """ log.debug(u'Initialise the %s widget' % name) - QtGui.QDockWidget.__init__(self, parent) + super(OpenLPDockWidget, self).__init__(parent) if name: self.setObjectName(name) if icon: diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py index 5b15b8103..0f90228ea 100644 --- a/openlp/core/lib/listwidgetwithdnd.py +++ b/openlp/core/lib/listwidgetwithdnd.py @@ -44,7 +44,7 @@ class ListWidgetWithDnD(QtGui.QListWidget): """ Initialise the list widget """ - QtGui.QListWidget.__init__(self, parent) + super(ListWidgetWithDnD, self).__init__(parent) self.mimeDataText = name assert(self.mimeDataText) From 542cdd78cb3eb914a177a98a256de3c0e1a88797 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 13:19:20 +0200 Subject: [PATCH 077/108] changed constructor --- openlp/core/lib/mediamanageritem.py | 2 +- openlp/core/lib/searchedit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 973d457bb..a4c68e3ce 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -82,7 +82,7 @@ class MediaManagerItem(QtGui.QWidget): """ Constructor to create the media manager item. """ - QtGui.QWidget.__init__(self) + super(MediaManagerItem, self).__init__() self.hide() self.whitespace = re.compile(r'[\W_]+', re.UNICODE) self.plugin = plugin diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index a0c51cb74..6ebc6de1a 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -46,7 +46,7 @@ class SearchEdit(QtGui.QLineEdit): """ Constructor. """ - QtGui.QLineEdit.__init__(self, parent) + super(SearchEdit, self).__init__(parent) self._current_search_type = -1 self.clear_button = QtGui.QToolButton(self) self.clear_button.setIcon(build_icon(u':/system/clear_shortcut.png')) From 0e480e389b653c3eec05cadbc28c16604ca8d21b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 13:23:59 +0200 Subject: [PATCH 078/108] changed constructor --- openlp/core/lib/settingstab.py | 2 +- openlp/core/lib/toolbar.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index ab775599a..4ded47b04 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -52,7 +52,7 @@ class SettingsTab(QtGui.QWidget): ``visible_title`` The title of the tab, which is usually displayed on the tab. """ - QtGui.QWidget.__init__(self, parent) + super(SettingsTab, self).__init__(parent) self.tab_title = title self.tab_title_visible = visible_title self.settings_section = self.tab_title.lower() diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index 41b454207..894f7bc88 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -47,7 +47,7 @@ class OpenLPToolbar(QtGui.QToolBar): """ Initialise the toolbar. """ - QtGui.QToolBar.__init__(self, parent) + super(OpenLPToolbar, self).__init__(parent) # useful to be able to reuse button icons... self.setIconSize(QtCore.QSize(20, 20)) self.actions = {} From 3409c491fe1ac41c240b65e161fa7936b36f4501 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:11:39 +0200 Subject: [PATCH 079/108] changed constructors --- openlp/core/lib/treewidgetwithdnd.py | 2 +- openlp/core/ui/aboutform.py | 2 +- openlp/core/ui/advancedtab.py | 2 +- openlp/core/ui/generaltab.py | 2 +- openlp/core/ui/mainwindow.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/treewidgetwithdnd.py b/openlp/core/lib/treewidgetwithdnd.py index 13e1a9abd..6411333c7 100644 --- a/openlp/core/lib/treewidgetwithdnd.py +++ b/openlp/core/lib/treewidgetwithdnd.py @@ -44,7 +44,7 @@ class TreeWidgetWithDnD(QtGui.QTreeWidget): """ Initialise the tree widget """ - QtGui.QTreeWidget.__init__(self, parent) + super(TreeWidgetWithDnD, self).__init__(parent) self.mimeDataText = name self.allow_internal_dnd = False self.header().close() diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py index c847f1f04..c1890dfcd 100644 --- a/openlp/core/ui/aboutform.py +++ b/openlp/core/ui/aboutform.py @@ -46,7 +46,7 @@ class AboutForm(QtGui.QDialog, Ui_AboutDialog): """ Do some initialisation stuff """ - QtGui.QDialog.__init__(self, parent) + super(AboutForm, self).__init__(parent) application_version = get_application_version() self.setupUi(self) about_text = self.about_text_edit.toPlainText() diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index b2d06fe88..7d9d72f4e 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -57,7 +57,7 @@ class AdvancedTab(SettingsTab): self.data_exists = False self.icon_path = u':/system/system_settings.png' advanced_translated = translate('OpenLP.AdvancedTab', 'Advanced') - SettingsTab.__init__(self, parent, u'Advanced', advanced_translated) + super(AdvancedTab, self).__init__(parent, u'Advanced', advanced_translated) def setupUi(self): """ diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 7fe7beaca..111d3fb28 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -49,7 +49,7 @@ class GeneralTab(SettingsTab): self.screens = ScreenList() self.icon_path = u':/icon/openlp-logo-16x16.png' general_translated = translate('OpenLP.GeneralTab', 'General') - SettingsTab.__init__(self, parent, u'Core', general_translated) + super(GeneralTab, self).__init__(parent, u'Core', general_translated) def setupUi(self): """ diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b143d6e01..d907a90c0 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -475,7 +475,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ This constructor sets up the interface, the various managers, and the plugins. """ - QtGui.QMainWindow.__init__(self) + super(MainWindow, self).__init__() Registry().register(u'main_window', self) self.clipboard = self.application.clipboard() self.arguments = self.application.args From 13c9a69de1061d4bdaab2fb43c11c6fcd6954246 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:14:29 +0200 Subject: [PATCH 080/108] changed constructors --- openlp/core/ui/media/mediacontroller.py | 2 +- openlp/core/ui/media/phononplayer.py | 2 +- openlp/core/ui/splashscreen.py | 2 +- openlp/core/ui/themeform.py | 2 +- openlp/core/ui/themelayoutform.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 71f2b4b10..b6c27e9d2 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -53,7 +53,7 @@ class MediaSlider(QtGui.QSlider): """ Constructor """ - QtGui.QSlider.__init__(self, direction) + super(MediaSlider, self).__init__(direction) self.manager = manager self.controller = controller diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 2a6eb77ba..8f91abb28 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -87,7 +87,7 @@ class PhononPlayer(MediaPlayer): """ Constructor """ - MediaPlayer.__init__(self, parent, u'phonon') + super(PhononPlayer, self).__init__(parent, u'phonon') self.original_name = u'Phonon' self.display_name = u'&Phonon' self.parent = parent diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index c6f259499..be7751769 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -41,7 +41,7 @@ class SplashScreen(QtGui.QSplashScreen): """ Constructor """ - QtGui.QSplashScreen.__init__(self) + super(SplashScreen, self).__init__() self.setupUi() def setupUi(self): diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 007932f6e..b4dbabd54 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -58,7 +58,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): ``parent`` The QWidget-derived parent of the wizard. """ - QtGui.QWizard.__init__(self, parent) + super(ThemeForm, self).__init__(parent) self.setupUi(self) self.registerFields() self.updateThemeAllowed = True diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py index a8cb7cb84..fb982ecd3 100644 --- a/openlp/core/ui/themelayoutform.py +++ b/openlp/core/ui/themelayoutform.py @@ -42,7 +42,7 @@ class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(ThemeLayoutForm, self).__init__(parent) self.setupUi(self) def exec_(self, image): From 1571cab0cfea8eae33dfc06ba6404b4105149727 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:19:01 +0200 Subject: [PATCH 081/108] changed constructors --- openlp/core/lib/spelltextedit.py | 2 +- openlp/core/ui/exceptionform.py | 2 +- openlp/core/ui/firsttimelanguageform.py | 2 +- openlp/core/ui/formattingtagform.py | 2 +- openlp/core/ui/media/playertab.py | 2 +- openlp/core/ui/media/vlcplayer.py | 5 ++--- openlp/core/ui/media/webkitplayer.py | 2 +- openlp/core/ui/pluginform.py | 2 +- openlp/core/ui/printserviceform.py | 2 +- openlp/core/ui/servicemanager.py | 2 +- openlp/core/ui/settingsform.py | 2 +- 11 files changed, 12 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 168ce528f..e4fa5fa4e 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -60,7 +60,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): Constructor. """ global ENCHANT_AVAILABLE - QtGui.QPlainTextEdit.__init__(self, parent) + super(SpellTextEdit, self).__init__(parent) self.formatting_tags_allowed = formatting_tags_allowed # Default dictionary based on the current locale. if ENCHANT_AVAILABLE: diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 49d6b0bef..1de11b1af 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -117,7 +117,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): """ Constructor. """ - QtGui.QDialog.__init__(self, parent) + super(ExceptionForm, self).__init__(parent) self.setupUi(self) self.settings_section = u'crashreport' diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py index 14b9dadc3..2d024b6c1 100644 --- a/openlp/core/ui/firsttimelanguageform.py +++ b/openlp/core/ui/firsttimelanguageform.py @@ -44,7 +44,7 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(FirstTimeLanguageForm, self).__init__(parent) self.setupUi(self) self.qmList = LanguageManager.get_qm_list() self.language_combo_box.addItem(u'Autodetect') diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index d2390c2f9..f69ca7fc7 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -46,7 +46,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(FormattingTagForm, self).__init__(parent) self.setupUi(self) self.tag_table_widget.itemSelectionChanged.connect(self.on_row_selected) self.new_push_button.clicked.connect(self.on_new_clicked) diff --git a/openlp/core/ui/media/playertab.py b/openlp/core/ui/media/playertab.py index 3331c70ca..3fc4f682c 100644 --- a/openlp/core/ui/media/playertab.py +++ b/openlp/core/ui/media/playertab.py @@ -59,7 +59,7 @@ class PlayerTab(SettingsTab): self.saved_used_players = None self.icon_path = u':/media/multimedia-player.png' player_translated = translate('OpenLP.PlayerTab', 'Players') - SettingsTab.__init__(self, parent, u'Players', player_translated) + super(PlayerTab, self).__init__(parent, u'Players', player_translated) def setupUi(self): """ diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 8c943dc82..40be8290d 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -98,15 +98,14 @@ VIDEO_EXT = [ class VlcPlayer(MediaPlayer): """ - A specialised version of the MediaPlayer class, which provides a VLC - display. + A specialised version of the MediaPlayer class, which provides a VLC display. """ def __init__(self, parent): """ Constructor """ - MediaPlayer.__init__(self, parent, u'vlc') + super(VlcPlayer, self).__init__(parent, u'vlc') self.original_name = u'VLC' self.display_name = u'&VLC' self.parent = parent diff --git a/openlp/core/ui/media/webkitplayer.py b/openlp/core/ui/media/webkitplayer.py index e534a974b..5c348d556 100644 --- a/openlp/core/ui/media/webkitplayer.py +++ b/openlp/core/ui/media/webkitplayer.py @@ -213,7 +213,7 @@ class WebkitPlayer(MediaPlayer): """ Constructor """ - MediaPlayer.__init__(self, parent, u'webkit') + super(WebkitPlayer, self).__init__(parent, u'webkit') self.original_name = u'WebKit' self.display_name = u'&WebKit' self.parent = parent diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 4f4824fb7..038cca159 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -48,7 +48,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(PluginForm, self).__init__(parent) self.activePlugin = None self.programaticChange = False self.setupUi(self) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 169478106..00a68a847 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -118,7 +118,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): """ Constructor """ - QtGui.QDialog.__init__(self, Registry().get('main_window')) + super(PrintServiceForm, self).__init__(Registry().get('main_window')) self.printer = QtGui.QPrinter() self.print_dialog = QtGui.QPrintDialog(self.printer, self) self.document = QtGui.QTextDocument() diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e02036bf2..839d2b571 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -295,7 +295,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): """ Sets up the service manager, toolbars, list view, et al. """ - QtGui.QWidget.__init__(self, parent) + super(ServiceManager, self).__init__(parent) self.active = build_icon(u':/media/auto-start_active.png') self.inactive = build_icon(u':/media/auto-start_inactive.png') Registry().register(u'service_manager', self) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index bc40539cf..174b5da3e 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -51,7 +51,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): """ Registry().register(u'settings_form', self) Registry().register_function(u'bootstrap_post_set_up', self.post_set_up) - QtGui.QDialog.__init__(self, parent) + super(SettingsForm, self).__init__(parent) self.processes = [] self.setupUi(self) From 59be78f20a20746eb5a23a973d1f5a671f08f7c6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:28:03 +0200 Subject: [PATCH 082/108] changed constructors --- openlp/plugins/presentations/lib/pptviewlib/ppttest.py | 2 +- openlp/plugins/songs/forms/editverseform.py | 2 +- openlp/plugins/songs/forms/mediafilesform.py | 2 +- openlp/plugins/songs/forms/songexportform.py | 2 +- openlp/plugins/songs/forms/songreviewwidget.py | 2 +- openlp/plugins/songs/lib/xml.py | 2 +- openlp/plugins/songusage/forms/songusagedeleteform.py | 2 +- openlp/plugins/songusage/forms/songusagedetailform.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py index f07468bb8..198bf0593 100644 --- a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py +++ b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py @@ -37,7 +37,7 @@ class PPTViewer(QtGui.QWidget): Standalone Test Harness for the pptviewlib library """ def __init__(self, parent=None): - QtGui.QWidget.__init__(self, parent) + super(PPTViewer, self).__init__(parent) self.pptid = -1 self.setWindowTitle(u'PowerPoint Viewer Test') diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py index b3a5a332d..319c2ddd8 100644 --- a/openlp/plugins/songs/forms/editverseform.py +++ b/openlp/plugins/songs/forms/editverseform.py @@ -48,7 +48,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(EditVerseForm, self).__init__(parent) self.setupUi(self) self.verse_text_edit.customContextMenuRequested.connect(self.context_menu) self.insert_button.clicked.connect(self.on_insert_button_clicked) diff --git a/openlp/plugins/songs/forms/mediafilesform.py b/openlp/plugins/songs/forms/mediafilesform.py index 6010f7606..de6ce26fc 100644 --- a/openlp/plugins/songs/forms/mediafilesform.py +++ b/openlp/plugins/songs/forms/mediafilesform.py @@ -44,7 +44,7 @@ class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog): log.info(u'%s MediaFilesForm loaded', __name__) def __init__(self, parent): - QtGui.QDialog.__init__(self) + super(MediaFilesForm, self).__init__() self.setupUi(self) def populateFiles(self, files): diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 36ed50cee..41e0b86f9 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -60,7 +60,7 @@ class SongExportForm(OpenLPWizard): ``plugin`` The songs plugin. """ - OpenLPWizard.__init__(self, parent, plugin, u'song_export_wizard', u':/wizards/wizard_exportsong.bmp') + super(SongExportForm, self).__init__(parent, plugin, u'song_export_wizard', u':/wizards/wizard_exportsong.bmp') self.stop_export_flag = False Registry().register_function(u'openlp_stop_wizard', self.stop_export) diff --git a/openlp/plugins/songs/forms/songreviewwidget.py b/openlp/plugins/songs/forms/songreviewwidget.py index 7b24563f9..6314721b2 100644 --- a/openlp/plugins/songs/forms/songreviewwidget.py +++ b/openlp/plugins/songs/forms/songreviewwidget.py @@ -64,7 +64,7 @@ class SongReviewWidget(QtGui.QWidget): ``song`` The Song which this SongReviewWidget should represent. """ - QtGui.QWidget.__init__(self, parent) + super(SongReviewWidget, self).__init__(parent) self.song = song self.setupUi() self.retranslateUi() diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 454ae209a..6715b6407 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -820,7 +820,7 @@ class OpenLyricsError(Exception): VerseError = 2 def __init__(self, type, log_message, display_message): - Exception.__init__(self) + super(OpenLyricsError, self).__init__() self.type = type self.log_message = log_message self.display_message = display_message diff --git a/openlp/plugins/songusage/forms/songusagedeleteform.py b/openlp/plugins/songusage/forms/songusagedeleteform.py index 8ae2fa020..e17e33e18 100644 --- a/openlp/plugins/songusage/forms/songusagedeleteform.py +++ b/openlp/plugins/songusage/forms/songusagedeleteform.py @@ -43,7 +43,7 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog): Constructor """ self.manager = manager - QtGui.QDialog.__init__(self, parent) + super(SongUsageDeleteForm, self).__init__(parent) self.setupUi(self) self.button_box.clicked.connect(self.on_button_box_clicked) diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index edb007421..83a86c61a 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -50,7 +50,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): """ Initialise the form """ - QtGui.QDialog.__init__(self, parent) + super(SongUsageDetailForm, self).__init__(parent) self.plugin = plugin self.setupUi(self) From 5fb36b5ef79864f76d6393b9d4f73add25cecb64 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:32:23 +0200 Subject: [PATCH 083/108] updated constructor --- openlp/core/ui/servicemanager.py | 2 +- openlp/core/ui/shortcutlistform.py | 2 +- openlp/core/ui/slidecontroller.py | 2 +- openlp/core/ui/wizard.py | 2 +- openlp/plugins/alerts/forms/alertform.py | 1 + openlp/plugins/alerts/lib/alertsmanager.py | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 839d2b571..8af2f2106 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -61,7 +61,7 @@ class ServiceManagerList(QtGui.QTreeWidget): """ Constructor """ - QtGui.QTreeWidget.__init__(self, parent) + super(ServiceManagerList, self).__init__(parent) self.serviceManager = serviceManager def keyPressEvent(self, event): diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index 95a591e6d..0916eba81 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -52,7 +52,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(ShortcutListForm, self).__init__(parent) self.setupUi(self) self.changedActions = {} self.action_list = ActionList.get_instance() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 6e48f4571..70b816822 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -90,7 +90,7 @@ class SlideController(DisplayController): """ Set up the Slide Controller. """ - DisplayController.__init__(self, parent, is_live) + super(SlideController, self).__init__(parent, is_live) Registry().register_function(u'bootstrap_post_set_up', self.screen_size_changed) self.screens = ScreenList() try: diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index ca89808ff..6cfe7f624 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -96,7 +96,7 @@ class OpenLPWizard(QtGui.QWizard): """ Constructor """ - QtGui.QWizard.__init__(self, parent) + super(OpenLPWizard, self).__init__(parent) self.plugin = plugin self.with_progress_page = add_progress_page self.setObjectName(name) diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index d1f5361d0..20932624e 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -46,6 +46,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): self.manager = plugin.manager self.plugin = plugin self.item_id = None + # TODO: Use Registry() super(AlertForm, self).__init__(self.plugin.main_window) self.setupUi(self) self.display_button.clicked.connect(self.on_display_clicked) diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index a319f5c74..0318c37e4 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -48,7 +48,7 @@ class AlertsManager(QtCore.QObject): log.info(u'Alert Manager loaded') def __init__(self, parent): - QtCore.QObject.__init__(self, parent) + super(AlertsManager, self).__init__(parent) Registry().register(u'alerts_manager', self) self.timer_id = 0 self.alert_list = [] From 025e031d768c64f6745c40dadf816a6c2c6d7ddc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:34:33 +0200 Subject: [PATCH 084/108] updated constructor --- openlp/core/ui/shortcutlistdialog.py | 2 +- openlp/core/ui/slidecontroller.py | 2 +- openlp/core/ui/thememanager.py | 2 +- openlp/core/ui/themestab.py | 2 +- openlp/plugins/alerts/forms/__init__.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index 0e8bf602c..d7cee81b7 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -43,7 +43,7 @@ class CaptureShortcutButton(QtGui.QPushButton): """ Constructor """ - QtGui.QPushButton.__init__(self, *args) + super(CaptureShortcutButton, self).__init__(*args) self.setCheckable(True) def keyPressEvent(self, event): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 70b816822..3afac3441 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -65,7 +65,7 @@ class DisplayController(QtGui.QWidget): """ Set up the general Controller. """ - QtGui.QWidget.__init__(self, parent) + super(DisplayController, self).__init__(parent) self.is_live = is_live self.display = None self.controller_type = DisplayControllerType.Plugin diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 1fe1ea0b7..65b1c946b 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -57,7 +57,7 @@ class ThemeManager(QtGui.QWidget): """ Constructor """ - QtGui.QWidget.__init__(self, parent) + super(ThemeManager, self).__init__(parent) Registry().register(u'theme_manager', self) Registry().register_function(u'bootstrap_initialise', self.load_first_time_themes) Registry().register_function(u'bootstrap_post_set_up', self._push_themes) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index d6dba2880..42ecaaf16 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -48,7 +48,7 @@ class ThemesTab(SettingsTab): """ self.icon_path = u':/themes/theme_new.png' theme_translated = translate('OpenLP.ThemesTab', 'Themes') - SettingsTab.__init__(self, parent, u'Themes', theme_translated) + super(ThemesTab, self).__init__(parent, u'Themes', theme_translated) def setupUi(self): """ diff --git a/openlp/plugins/alerts/forms/__init__.py b/openlp/plugins/alerts/forms/__init__.py index 2a3037f97..20503a3b9 100644 --- a/openlp/plugins/alerts/forms/__init__.py +++ b/openlp/plugins/alerts/forms/__init__.py @@ -41,7 +41,7 @@ above, like so:: class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): def __init__(self, parent=None): - QtGui.QDialog.__init__(self, parent) + super(AuthorsForm, self).__init__(parent) self.setupUi(self) This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality, From 283d9c8e9dc09d849a07d0cc1a278fa7d512a9df Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:40:40 +0200 Subject: [PATCH 085/108] updated constructors --- openlp/plugins/bibles/forms/__init__.py | 2 +- openlp/plugins/bibles/forms/editbibleform.py | 2 +- openlp/plugins/bibles/forms/languageform.py | 2 +- openlp/plugins/bibles/lib/biblestab.py | 2 +- openlp/plugins/images/forms/__init__.py | 2 +- openlp/plugins/images/forms/addgroupform.py | 2 +- openlp/plugins/images/forms/choosegroupform.py | 2 +- openlp/plugins/images/lib/imagetab.py | 2 +- openlp/plugins/media/lib/mediatab.py | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/bibles/forms/__init__.py b/openlp/plugins/bibles/forms/__init__.py index abef5c85c..1d4fdad6c 100644 --- a/openlp/plugins/bibles/forms/__init__.py +++ b/openlp/plugins/bibles/forms/__init__.py @@ -42,7 +42,7 @@ above, like so:: class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard): def __init__(self, parent, manager, bible_plugin): - QtGui.QWizard.__init__(self, parent) + super(BibleImportForm, self).__init__(parent) self.setupUi(self) This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality, diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py index 4e0a5a7c0..1e57b10f9 100644 --- a/openlp/plugins/bibles/forms/editbibleform.py +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -51,7 +51,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(EditBibleForm, self).__init__(parent) self.media_item = media_item self.book_names = BibleStrings().BookNames self.setupUi(self) diff --git a/openlp/plugins/bibles/forms/languageform.py b/openlp/plugins/bibles/forms/languageform.py index 2bba3d7a4..efcd593d3 100644 --- a/openlp/plugins/bibles/forms/languageform.py +++ b/openlp/plugins/bibles/forms/languageform.py @@ -54,7 +54,7 @@ class LanguageForm(QDialog, Ui_LanguageDialog): """ Constructor """ - QDialog.__init__(self, parent) + super(LanguageForm, self).__init__(parent) self.setupUi(self) def exec_(self, bible_name): diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 17182d7e2..75aa45efc 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -49,7 +49,7 @@ class BiblesTab(SettingsTab): self.paragraph_style = True self.show_new_chapters = False self.display_style = 0 - SettingsTab.__init__(self, parent, title, visible_title, icon_path) + super(BiblesTab, self).__init__(parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'BiblesTab') diff --git a/openlp/plugins/images/forms/__init__.py b/openlp/plugins/images/forms/__init__.py index 8bb8e966f..bdb2bcc18 100644 --- a/openlp/plugins/images/forms/__init__.py +++ b/openlp/plugins/images/forms/__init__.py @@ -41,7 +41,7 @@ above, like so:: class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): def __init__(self, parent=None): - QtGui.QDialog.__init__(self, parent) + super(AuthorsForm, self).__init__(parent) self.setupUi(self) This allows OpenLP to use ``self.object`` for all the GUI elements while keeping them separate from the functionality, diff --git a/openlp/plugins/images/forms/addgroupform.py b/openlp/plugins/images/forms/addgroupform.py index 4cdc6a73b..29bad676d 100644 --- a/openlp/plugins/images/forms/addgroupform.py +++ b/openlp/plugins/images/forms/addgroupform.py @@ -42,7 +42,7 @@ class AddGroupForm(QtGui.QDialog, Ui_AddGroupDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(AddGroupForm, self).__init__(parent) self.setupUi(self) def exec_(self, clear=True, show_top_level_group=False, selected_group=None): diff --git a/openlp/plugins/images/forms/choosegroupform.py b/openlp/plugins/images/forms/choosegroupform.py index 02f79e63b..db5a7f541 100644 --- a/openlp/plugins/images/forms/choosegroupform.py +++ b/openlp/plugins/images/forms/choosegroupform.py @@ -40,7 +40,7 @@ class ChooseGroupForm(QtGui.QDialog, Ui_ChooseGroupDialog): """ Constructor """ - QtGui.QDialog.__init__(self, parent) + super(ChooseGroupForm, self).__init__(parent) self.setupUi(self) def exec_(self, selected_group=None): diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index b43b19097..95edbab15 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -37,7 +37,7 @@ class ImageTab(SettingsTab): ImageTab is the images settings tab in the settings dialog. """ def __init__(self, parent, name, visible_title, icon_path): - SettingsTab.__init__(self, parent, name, visible_title, icon_path) + super(ImageTab, self).__init__(parent, name, visible_title, icon_path) def setupUi(self): self.setObjectName(u'ImagesTab') diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index d0106b0f6..564585aa9 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -46,7 +46,7 @@ class MediaTab(SettingsTab): """ def __init__(self, parent, title, visible_title, icon_path): self.parent = parent - SettingsTab.__init__(self, parent, title, visible_title, icon_path) + super(MediaTab, self).__init__(parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'MediaTab') From 9c4201154102fa85ee41d1ed5c62655c4eaca747 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 16:42:55 +0200 Subject: [PATCH 086/108] fixed test --- openlp/plugins/songs/lib/ewimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index b548b32e2..f3df6379a 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -274,7 +274,7 @@ class EasyWorshipSongImport(SongImport): return None # Format the field depending on the field type if field_desc.field_type == FieldType.String: - return field.rstrip('\0').decode(self.encoding) + return field.rstrip('\0') elif field_desc.field_type == FieldType.Int16: return field ^ 0x8000 elif field_desc.field_type == FieldType.Int32: From c6f29ca53da43dd3e59df02deaa552ccd296466a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 18 Jul 2013 18:42:51 +0200 Subject: [PATCH 087/108] fixed for fedora --- openlp.py | 2 +- openlp/core/utils/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp.py b/openlp.py index ae0b88168..1317cb770 100755 --- a/openlp.py +++ b/openlp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index ed958a53f..53af2d83e 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -196,7 +196,7 @@ def check_latest_version(current_version): req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full']) remote_version = None try: - remote_version = unicode(urllib2.urlopen(req, None).read()).strip() + remote_version = unicode(urllib2.urlopen(req, None).read().decode()).strip() except IOError: log.exception(u'Failed to download the latest OpenLP version file') if remote_version: From 5c13035172b6e030cba370197dfd7f0e856f9bc2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 20:56:15 +0200 Subject: [PATCH 088/108] fixed tests --- tests/functional/openlp_core_lib/test_registry.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_registry.py b/tests/functional/openlp_core_lib/test_registry.py index b10afe0cc..20518fc9b 100644 --- a/tests/functional/openlp_core_lib/test_registry.py +++ b/tests/functional/openlp_core_lib/test_registry.py @@ -31,14 +31,14 @@ class TestRegistry(TestCase): # THEN and I will get an exception with self.assertRaises(KeyError) as context: Registry().register(u'test1', mock_1) - self.assertEqual(context.exception, u'Duplicate service exception test1', + self.assertEqual(context.exception.args[0], u'Duplicate service exception test1', u'KeyError exception should have been thrown for duplicate service') # WHEN I try to get back a non existent component # THEN I will get an exception with self.assertRaises(KeyError) as context: temp = Registry().get(u'test2') - self.assertEqual(context.exception, u'Service test2 not found in list', + self.assertEqual(context.exception.args[0], u'Service test2 not found in list', u'KeyError exception should have been thrown for missing service') # WHEN I try to replace a component I should be allowed (testing only) @@ -46,7 +46,7 @@ class TestRegistry(TestCase): # THEN I will get an exception with self.assertRaises(KeyError) as context: temp = Registry().get(u'test1') - self.assertEqual(context.exception, u'Service test1 not found in list', + self.assertEqual(context.exception.args[0], u'Service test1 not found in list', u'KeyError exception should have been thrown for deleted service') def registry_function_test(self): From 8dd57bcc9d2b41cbd63d798d13d26f70f7b3383b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:00:37 +0200 Subject: [PATCH 089/108] changed constructor --- openlp/plugins/alerts/lib/alertstab.py | 2 +- openlp/plugins/bibles/forms/bibleimportform.py | 3 ++- openlp/plugins/bibles/forms/bibleupgradeform.py | 3 ++- openlp/plugins/bibles/forms/booknameform.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index c4ae93c0d..1ffbd5f7d 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -38,7 +38,7 @@ class AlertsTab(SettingsTab): AlertsTab is the alerts settings tab in the settings dialog. """ def __init__(self, parent, name, visible_title, icon_path): - SettingsTab.__init__(self, parent, name, visible_title, icon_path) + super(AlertsTab, self).__init__(parent, name, visible_title, icon_path) def setupUi(self): self.setObjectName(u'AlertsTab') diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 0662f78db..b1aedbe65 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -78,7 +78,8 @@ class BibleImportForm(OpenLPWizard): """ self.manager = manager self.web_bible_list = {} - OpenLPWizard.__init__(self, parent, bible_plugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp') + super(BibleImportForm, self).__init__( + parent, bible_plugin, u'bibleImportWizard', u':/wizards/wizard_importbible.bmp') def setupUi(self, image): """ diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 99ef941ed..b2f0f470b 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -75,7 +75,8 @@ class BibleUpgradeForm(OpenLPWizard): self.files = self.manager.old_bible_databases self.success = {} self.new_bibles = {} - OpenLPWizard.__init__(self, parent, bible_plugin, u'bibleUpgradeWizard', u':/wizards/wizard_importbible.bmp') + super(BibleUpgradeForm, self).__init__( + parent, bible_plugin, u'bibleUpgradeWizard', u':/wizards/wizard_importbible.bmp') def setupUi(self, image): """ diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index cc213cf96..737c811c6 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -56,7 +56,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog): """ Constructor """ - QDialog.__init__(self, parent) + super(BookNameForm, self).__init__(parent) self.setupUi(self) self.custom_signals() self.book_names = BibleStrings().BookNames From 25e7df079b0b559b5adfef5c8377048ea8d7b7ae Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:04:38 +0200 Subject: [PATCH 090/108] changed constructor --- openlp/core/lib/spelltextedit.py | 4 ++-- openlp/plugins/custom/lib/customtab.py | 4 ++-- openlp/plugins/songs/forms/__init__.py | 2 +- openlp/plugins/songs/forms/authorsform.py | 2 +- openlp/plugins/songs/forms/editsongdialog.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index e4fa5fa4e..19adc61ad 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -177,7 +177,7 @@ class Highlighter(QtGui.QSyntaxHighlighter): """ Constructor """ - QtGui.QSyntaxHighlighter.__init__(self, *args) + super(Highlighter, self).__init__(*args) self.spelling_dictionary = None def highlightBlock(self, text): @@ -205,5 +205,5 @@ class SpellAction(QtGui.QAction): """ Constructor """ - QtGui.QAction.__init__(self, *args) + super(SpellAction, self).__init__(*args) self.triggered.connect(lambda x: self.correct.emit(self.text())) diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index dad7e7b47..29ae1c829 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -41,7 +41,7 @@ class CustomTab(SettingsTab): CustomTab is the Custom settings tab in the settings dialog. """ def __init__(self, parent, title, visible_title, icon_path): - SettingsTab.__init__(self, parent, title, visible_title, icon_path) + super(CustomTab, self).__init__(parent, title, visible_title, icon_path) def setupUi(self): self.setObjectName(u'CustomTab') @@ -97,4 +97,4 @@ class CustomTab(SettingsTab): settings.endGroup() if self.tab_visited: self.settings_form.register_post_process(u'custom_config_updated') - self.tab_visited = False \ No newline at end of file + self.tab_visited = False diff --git a/openlp/plugins/songs/forms/__init__.py b/openlp/plugins/songs/forms/__init__.py index 588f359f6..0018ca96a 100644 --- a/openlp/plugins/songs/forms/__init__.py +++ b/openlp/plugins/songs/forms/__init__.py @@ -45,7 +45,7 @@ mentioned above, like so:: class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): def __init__(self, parent=None): - QtGui.QDialog.__init__(self, parent) + super(AuthorsForm, self).__init__(parent) self.setupUi(self) This allows OpenLP to use ``self.object`` for all the GUI elements while keeping diff --git a/openlp/plugins/songs/forms/authorsform.py b/openlp/plugins/songs/forms/authorsform.py index 2d94ad3da..2548fd23b 100644 --- a/openlp/plugins/songs/forms/authorsform.py +++ b/openlp/plugins/songs/forms/authorsform.py @@ -42,7 +42,7 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog): """ Set up the screen and common data """ - QtGui.QDialog.__init__(self, parent) + super(AuthorsForm, self).__init__(parent) self.setupUi(self) self.auto_display_name = False self.first_name_edit.textEdited.connect(self.on_first_name_edited) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 19dad3eae..71aebd0c3 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -355,7 +355,7 @@ class SingleColumnTableWidget(QtGui.QTableWidget): """ Constructor """ - QtGui.QTableWidget.__init__(self, parent) + super(SingleColumnTableWidget, self).__init__(parent) self.horizontalHeader().setVisible(False) self.setColumnCount(1) From 5e2b7c310c2e928d5e064d77b84d588bd73dd750 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:06:42 +0200 Subject: [PATCH 091/108] changed constructor --- openlp/plugins/presentations/lib/presentationtab.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index e46467403..f948c4583 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -42,7 +42,7 @@ class PresentationTab(SettingsTab): """ self.parent = parent self.controllers = controllers - SettingsTab.__init__(self, parent, title, visible_title, icon_path) + super(PresentationTab, self).__init__(parent, title, visible_title, icon_path) self.activated = False def setupUi(self): @@ -50,7 +50,7 @@ class PresentationTab(SettingsTab): Create the controls for the settings tab """ self.setObjectName(u'PresentationTab') - SettingsTab.setupUi(self) + super(PresentationTab, self).setupUi() self.controllers_group_box = QtGui.QGroupBox(self.left_column) self.controllers_group_box.setObjectName(u'controllers_group_box') self.controllers_layout = QtGui.QVBoxLayout(self.controllers_group_box) From cbaf8beb1d8b65522720ce3f42737f4bde50c6b2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:36:52 +0200 Subject: [PATCH 092/108] changed constructor --- openlp/plugins/images/lib/mediaitem.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 3475570fc..ffac56b3a 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -52,7 +52,7 @@ class ImageMediaItem(MediaManagerItem): def __init__(self, parent, plugin): self.icon_path = u'images/image' - MediaManagerItem.__init__(self, parent, plugin) + super(ImageMediaItem, self).__init__(parent, plugin) self.quick_preview_allowed = True self.has_search = True self.manager = plugin.manager diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 30748a225..df96e9148 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -60,7 +60,7 @@ class MediaMediaItem(MediaManagerItem): self.icon_path = u'images/image' self.background = False self.automatic = u'' - MediaManagerItem.__init__(self, parent, plugin) + super(MediaMediaItem, self).__init__(parent, plugin) self.single_service_item = False self.has_search = True self.media_object = None From 0b22f36e6c169b97519a0653dd5ae771dfe41450 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:38:37 +0200 Subject: [PATCH 093/108] changed constructor --- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index c2c67c304..20d8626d5 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -57,7 +57,7 @@ class CustomMediaItem(MediaManagerItem): def __init__(self, parent, plugin): self.icon_path = u'custom/custom' - MediaManagerItem.__init__(self, parent, plugin) + super(CustomMediaItem, self).__init__(parent, plugin) self.edit_custom_form = EditCustomForm(self, self.main_window, self.plugin.manager) self.single_service_item = False self.quick_preview_allowed = True diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 7c50eb6b8..6b143f618 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -71,7 +71,7 @@ class SongMediaItem(MediaManagerItem): def __init__(self, parent, plugin): self.icon_path = u'songs/song' - MediaManagerItem.__init__(self, parent, plugin) + super(SongMediaItem, self).__init__(parent, plugin) self.single_service_item = False # Holds information about whether the edit is remotely triggered and which Song is required. self.remote_song = -1 From cd91e4dcbf8f8d38cbb4a1523e6ae3be776c2a5f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:42:07 +0200 Subject: [PATCH 094/108] changed constructor --- openlp/core/ui/maindisplay.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 4b99d38cd..506820b37 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -65,11 +65,11 @@ class Display(QtGui.QGraphicsView): Constructor """ if live: - QtGui.QGraphicsView.__init__(self) + super(Display, sef).__init__() # Overwrite the parent() method. self.parent = lambda: parent else: - QtGui.QGraphicsView.__init__(self, parent) + super(Display, self).__init__(parent) self.is_live = live self.controller = controller self.screen = {} @@ -126,7 +126,7 @@ class MainDisplay(Display): """ Constructor """ - Display.__init__(self, parent, live, controller) + super(MainDisplay, self).__init__(parent, live, controller) self.screens = ScreenList() self.rebuild_css = False self.hide_mode = None @@ -536,7 +536,7 @@ class AudioPlayer(QtCore.QObject): The parent widget. """ log.debug(u'AudioPlayer Initialisation started') - QtCore.QObject.__init__(self, parent) + super(AudioPlayer, self).__init__(parent) self.currentIndex = -1 self.playlist = [] self.repeat = False From e93a59e83ad725a3ffc9527bd736752f85f001e5 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:44:28 +0200 Subject: [PATCH 095/108] spelling --- openlp/core/ui/maindisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 506820b37..58d69253f 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -65,7 +65,7 @@ class Display(QtGui.QGraphicsView): Constructor """ if live: - super(Display, sef).__init__() + super(Display, self).__init__() # Overwrite the parent() method. self.parent = lambda: parent else: From 5fe64a1d39ab552c0e51f6dd1a4954fb4b527ad7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 18 Jul 2013 21:49:44 +0200 Subject: [PATCH 096/108] super calls --- openlp/plugins/bibles/forms/bibleimportform.py | 4 ++-- openlp/plugins/bibles/forms/bibleupgradeform.py | 6 +++--- openlp/plugins/songs/forms/duplicatesongremovalform.py | 6 +++--- openlp/plugins/songs/forms/songexportform.py | 4 ++-- openlp/plugins/songs/forms/songimportform.py | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index b1aedbe65..4ea5209c8 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -85,7 +85,7 @@ class BibleImportForm(OpenLPWizard): """ Set up the UI for the bible wizard. """ - OpenLPWizard.setupUi(self, image) + super(BibleImportForm, self).setupUi(image) self.formatComboBox.currentIndexChanged.connect(self.onCurrentIndexChanged) def onCurrentIndexChanged(self, index): @@ -516,7 +516,7 @@ class BibleImportForm(OpenLPWizard): """ Prepare the UI for the import. """ - OpenLPWizard.pre_wizard(self) + super(BibleImportForm, self).pre_wizard() bible_type = self.field(u'source_format') if bible_type == BibleFormat.WebDownload: self.progress_label.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...')) diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index b2f0f470b..070f73689 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -82,7 +82,7 @@ class BibleUpgradeForm(OpenLPWizard): """ Set up the UI for the bible wizard. """ - OpenLPWizard.setupUi(self, image) + super(BibleUpgradeForm, self).setupUi(image) Registry().execute(u'openlp_stop_wizard', self.stop_import) def stop_import(self): @@ -334,7 +334,7 @@ class BibleUpgradeForm(OpenLPWizard): """ Prepare the UI for the upgrade. """ - OpenLPWizard.pre_wizard(self) + super(BibleUpgradeForm, self).pre_wizard() self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...')) self.application.process_events() @@ -560,4 +560,4 @@ class BibleUpgradeForm(OpenLPWizard): self.progress_label.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Upgrade failed.')) # Remove temp directory. shutil.rmtree(self.temp_dir, True) - OpenLPWizard.post_wizard(self) + super(BibleUpgradeForm, self).post_wizard() diff --git a/openlp/plugins/songs/forms/duplicatesongremovalform.py b/openlp/plugins/songs/forms/duplicatesongremovalform.py index 424e913b1..428764941 100644 --- a/openlp/plugins/songs/forms/duplicatesongremovalform.py +++ b/openlp/plugins/songs/forms/duplicatesongremovalform.py @@ -67,8 +67,8 @@ class DuplicateSongRemovalForm(OpenLPWizard): self.review_total_count = 0 # Used to interrupt ongoing searches when cancel is clicked. self.break_search = False - OpenLPWizard.__init__(self, Registry().get('main_window'), plugin, u'duplicateSongRemovalWizard', - u':/wizards/wizard_duplicateremoval.bmp', False) + super(DuplicateSongRemovalForm, self).__init__(Registry().get('main_window'), + plugin, u'duplicateSongRemovalWizard', u':/wizards/wizard_duplicateremoval.bmp', False) self.setMinimumWidth(730) def custom_signals(self): @@ -269,7 +269,7 @@ class DuplicateSongRemovalForm(OpenLPWizard): else: self.proceed_to_next_review() return False - return OpenLPWizard.validateCurrentPage(self) + return super(DuplicateSongRemovalForm, self).validateCurrentPage() def remove_button_clicked(self, song_review_widget): """ diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 41e0b86f9..7f30c9abc 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -75,7 +75,7 @@ class SongExportForm(OpenLPWizard): """ Set up the song wizard UI. """ - OpenLPWizard.setupUi(self, image) + super(SongExportForm, self).setupUi(image) def custom_signals(self): """ @@ -239,7 +239,7 @@ class SongExportForm(OpenLPWizard): """ Perform pre export tasks. """ - OpenLPWizard.pre_wizard(self) + super(SongExportForm, self).pre_wizard() self.progress_label.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...')) self.application.process_events() diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index bcf86ceba..955b35096 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -60,7 +60,7 @@ class SongImportForm(OpenLPWizard): ``plugin`` The songs plugin. """ - OpenLPWizard.__init__(self, parent, plugin, u'songImportWizard', u':/wizards/wizard_importsong.bmp') + super(SongImportForm, self).__init__(parent, plugin, u'songImportWizard', u':/wizards/wizard_importsong.bmp') self.clipboard = self.main_window.clipboard def setupUi(self, image): @@ -68,7 +68,7 @@ class SongImportForm(OpenLPWizard): Set up the song wizard UI. """ self.format_widgets = dict([(song_format, {}) for song_format in SongFormat.get_format_list()]) - OpenLPWizard.setupUi(self, image) + super(SongImportForm, self).setupUi(image) self.current_format = SongFormat.OpenLyrics self.format_stack.setCurrentIndex(self.current_format) self.format_combo_box.currentIndexChanged.connect(self.onCurrentIndexChanged) @@ -329,7 +329,7 @@ class SongImportForm(OpenLPWizard): """ Perform pre import tasks """ - OpenLPWizard.pre_wizard(self) + super(SongImportForm, self).pre_wizard() self.progress_label.setText(WizardStrings.StartingImport) self.application.process_events() From e32f0869ccb6836245be344f43001eaa67131056 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 19 Jul 2013 15:00:15 +0200 Subject: [PATCH 097/108] constructors --- openlp/plugins/presentations/lib/impresscontroller.py | 4 ++-- openlp/plugins/presentations/lib/powerpointcontroller.py | 4 ++-- openlp/plugins/presentations/lib/pptviewcontroller.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index d30c71078..3e98c7d1b 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -78,7 +78,7 @@ class ImpressController(PresentationController): Initialise the class """ log.debug(u'Initialising') - PresentationController.__init__(self, plugin, u'Impress', ImpressDocument) + super(ImpressController, self).__init__(plugin, u'Impress', ImpressDocument) self.supports = [u'odp'] self.also_supports = [u'ppt', u'pps', u'pptx', u'ppsx'] self.process = None @@ -208,7 +208,7 @@ class ImpressDocument(PresentationDocument): Constructor, store information about the file and initialise. """ log.debug(u'Init Presentation OpenOffice') - PresentationDocument.__init__(self, controller, presentation) + super(ImpressDocument, self).__init__(controller, presentation) self.document = None self.presentation = None self.control = None diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 6895fda19..e52d9b1cf 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -58,7 +58,7 @@ class PowerpointController(PresentationController): Initialise the class """ log.debug(u'Initialising') - PresentationController.__init__(self, plugin, u'Powerpoint', PowerpointDocument) + super(PowerpointController, self).__init__(plugin, u'Powerpoint', PowerpointDocument) self.supports = [u'ppt', u'pps', u'pptx', u'ppsx'] self.process = None @@ -114,7 +114,7 @@ class PowerpointDocument(PresentationDocument): Constructor, store information about the file and initialise. """ log.debug(u'Init Presentation Powerpoint') - PresentationDocument.__init__(self, controller, presentation) + super(PowerpointDocument, self).__init__(controller, presentation) self.presentation = None def load_presentation(self): diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index abb9fd11e..01c4100cc 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -54,7 +54,7 @@ class PptviewController(PresentationController): """ log.debug(u'Initialising') self.process = None - PresentationController.__init__(self, plugin, u'Powerpoint Viewer', PptviewDocument) + super(PptviewController, self).__init__(plugin, u'Powerpoint Viewer', PptviewDocument) self.supports = [u'ppt', u'pps', u'pptx', u'ppsx'] def check_available(self): From d5b0f3ac9a88076cb2be589f8f4d140855eb68bc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 19 Jul 2013 18:07:33 +0200 Subject: [PATCH 098/108] fixed version number --- openlp/core/utils/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 53af2d83e..561eee4c1 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -107,6 +107,7 @@ def get_application_version(): # Get the revision of this tree. bzr = Popen((u'bzr', u'revno'), stdout=PIPE) tree_revision, error = bzr.communicate() + tree_revision = tree_revision.decode() code = bzr.wait() if code != 0: raise Exception(u'Error running bzr log') @@ -117,7 +118,7 @@ def get_application_version(): code = bzr.wait() if code != 0: raise Exception(u'Error running bzr tags') - tags = output.splitlines() + tags = map(bytes.decode, output.splitlines()) if not tags: tag_version = u'0.0.0' tag_revision = u'0' From a1577df2be4365d1d7bf8595fbb97ee91d569545 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 19 Jul 2013 18:27:16 +0200 Subject: [PATCH 099/108] fixed song export again --- openlp/plugins/songs/lib/openlyricsexport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index 533170b38..1e5610a1d 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -71,7 +71,7 @@ class OpenLyricsExport(object): self.parent.increment_progress_bar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') % song.title) xml = openLyrics.song_to_xml(song) - tree = etree.ElementTree(etree.fromstring(xml)) + tree = etree.ElementTree(etree.fromstring(xml.encode())) filename = u'%s (%s)' % (song.title, u', '.join([author.display_name for author in song.authors])) filename = clean_filename(filename) # Ensure the filename isn't too long for some filesystems From 4eb1c3b4f177169282b7e4f653400a2e209671c1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 19 Jul 2013 18:38:43 +0200 Subject: [PATCH 100/108] do not try to save an empty list --- openlp/plugins/songs/lib/xml.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 6715b6407..52ef075dd 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -592,8 +592,10 @@ class OpenLyrics(object): found_tags.append(openlp_tag) existing_tag_ids = [tag[u'start tag'] for tag in FormattingTags.get_html_tags()] new_tags = [tag for tag in found_tags if tag[u'start tag'] not in existing_tag_ids] - FormattingTags.add_html_tags(new_tags) - FormattingTags.save_html_tags() + # Do not save an empty list. + if new_tags: + FormattingTags.add_html_tags(new_tags) + FormattingTags.save_html_tags() def _process_lines_mixed_content(self, element, newlines=True): """ From 50b1ba437e65e6a751247c75720e5de564842e94 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 27 Jul 2013 12:30:38 +0200 Subject: [PATCH 102/108] cherrypy changes --- openlp/core/utils/__init__.py | 2 +- openlp/plugins/remotes/lib/httpserver.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 561eee4c1..3d5d13e24 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -38,7 +38,6 @@ import re from subprocess import Popen, PIPE import sys import urllib2 -import icu from PyQt4 import QtGui, QtCore @@ -403,6 +402,7 @@ def get_locale_key(string): if os.name == 'nt': global ICU_COLLATOR if ICU_COLLATOR is None: + import icu from languagemanager import LanguageManager language = LanguageManager.get_language() icu_locale = icu.Locale(language) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 48a6a4d79..e476bbd68 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -127,7 +127,7 @@ from PyQt4 import QtCore from openlp.core.lib import Registry, Settings, PluginStatus, StringContent, image_to_byte from openlp.core.utils import AppLocation, translate -from cherrypy._cpcompat import sha, ntob +from hashlib import sha1 log = logging.getLogger(__name__) @@ -137,7 +137,7 @@ def make_sha_hash(password): Create an encrypted password for the given password. """ log.debug("make_sha_hash") - return sha(ntob(password)).hexdigest() + return sha1(password.encode()).hexdigest() def fetch_password(username): From b48fbd40a3ba5e861556a3d4263025c946b45fec Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 Aug 2013 14:57:59 +0200 Subject: [PATCH 103/108] fixed formatting tags --- openlp/core/lib/formattingtags.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 78ad31fae..0b6c19097 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -62,9 +62,6 @@ class FormattingTags(object): # Remove key 'temporary' from tags. It is not needed to be saved. if u'temporary' in tag: del tag[u'temporary'] - for element in tag: - if isinstance(tag[element], unicode): - tag[element] = tag[element].encode('utf8') # Formatting Tags were also known as display tags. Settings().setValue(u'formattingTags/html_tags', json.dumps(tags) if tags else u'') From 5e7bc82694d3800f1e4476e1883687810feb3ef9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 Aug 2013 15:04:42 +0200 Subject: [PATCH 104/108] more constructors --- openlp/core/lib/plugin.py | 4 ++-- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/bibles/bibleplugin.py | 2 +- openlp/plugins/custom/customplugin.py | 2 +- openlp/plugins/images/imageplugin.py | 2 +- openlp/plugins/media/mediaplugin.py | 2 +- openlp/plugins/presentations/lib/pptviewcontroller.py | 2 +- openlp/plugins/remotes/remoteplugin.py | 2 +- openlp/plugins/songs/songsplugin.py | 2 +- openlp/plugins/songusage/songusageplugin.py | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 1950477ed..641969392 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -128,7 +128,7 @@ class Plugin(QtCore.QObject): class MyPlugin(Plugin): def __init__(self): - Plugin.__init__(self, u'MyPlugin', version=u'0.1') + super(MyPlugin, self).__init__('MyPlugin', version=u'0.1') ``name`` Defaults to *None*. The name of the plugin. @@ -146,7 +146,7 @@ class Plugin(QtCore.QObject): Defaults to *None*, which means that the same version number is used as OpenLP's version number. """ log.debug(u'Plugin %s initialised' % name) - QtCore.QObject.__init__(self) + super(Plugin, self).__init__() self.name = name self.text_strings = {} self.set_plugin_text_strings() diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index a2d77c42b..fe11db753 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -129,7 +129,7 @@ class AlertsPlugin(Plugin): log.info(u'Alerts Plugin loaded') def __init__(self): - Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab) + super(AlertsPlugin, self).__init__(u'alerts', __default_settings__, settings_tab_class=AlertsTab) self.weight = -3 self.icon_path = u':/plugins/plugin_alerts.png' self.icon = build_icon(self.icon_path) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index e2888d67a..7f8f0782c 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -69,7 +69,7 @@ class BiblePlugin(Plugin): log.info(u'Bible Plugin loaded') def __init__(self): - Plugin.__init__(self, u'bibles', __default_settings__, BibleMediaItem, BiblesTab) + super(BiblePlugin, self).__init__(u'bibles', __default_settings__, BibleMediaItem, BiblesTab) self.weight = -9 self.icon_path = u':/plugins/plugin_bibles.png' self.icon = build_icon(self.icon_path) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 06b070490..b237e4624 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -61,7 +61,7 @@ class CustomPlugin(Plugin): log.info(u'Custom Plugin loaded') def __init__(self): - Plugin.__init__(self, u'custom', __default_settings__, CustomMediaItem, CustomTab) + super(CustomPlugin, self).__init__(u'custom', __default_settings__, CustomMediaItem, CustomTab) self.weight = -5 self.manager = Manager(u'custom', init_schema) self.icon_path = u':/plugins/plugin_custom.png' diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index dfe927a7b..7717ae1ae 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -48,7 +48,7 @@ class ImagePlugin(Plugin): log.info(u'Image Plugin loaded') def __init__(self): - Plugin.__init__(self, u'images', __default_settings__, ImageMediaItem, ImageTab) + super(ImagePlugin, self).__init__(u'images', __default_settings__, ImageMediaItem, ImageTab) self.manager = Manager(u'images', init_schema) self.weight = -7 self.icon_path = u':/plugins/plugin_images.png' diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 38cd9bb69..0cc8345c1 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -49,7 +49,7 @@ class MediaPlugin(Plugin): log.info(u'%s MediaPlugin loaded', __name__) def __init__(self): - Plugin.__init__(self, u'media', __default_settings__, MediaMediaItem) + super(MediaPlugin, self).__init__(u'media', __default_settings__, MediaMediaItem) self.weight = -6 self.icon_path = u':/plugins/plugin_media.png' self.icon = build_icon(self.icon_path) diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 01c4100cc..06872ef36 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -109,7 +109,7 @@ class PptviewDocument(PresentationDocument): Constructor, store information about the file and initialise. """ log.debug(u'Init Presentation PowerPoint') - PresentationDocument.__init__(self, controller, presentation) + super(PptviewDocument, self).__init__(controller, presentation) self.presentation = None self.ppt_id = None self.blanked = False diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index f443fbda4..ea6d01551 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -55,7 +55,7 @@ class RemotesPlugin(Plugin): """ remotes constructor """ - Plugin.__init__(self, u'remotes', __default_settings__, settings_tab_class=RemoteTab) + super(RemotePlugin, self).__init__(u'remotes', __default_settings__, settings_tab_class=RemoteTab) self.icon_path = u':/plugins/plugin_remote.png' self.icon = build_icon(self.icon_path) self.weight = -1 diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index c9cf22534..0e1cb69df 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -80,7 +80,7 @@ class SongsPlugin(Plugin): """ Create and set up the Songs plugin. """ - Plugin.__init__(self, u'songs', __default_settings__, SongMediaItem, SongsTab) + super(SongsPlugin, self).__init__(u'songs', __default_settings__, SongMediaItem, SongsTab) self.manager = Manager(u'songs', init_schema, upgrade_mod=upgrade) self.weight = -10 self.icon_path = u':/plugins/plugin_songs.png' diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 7a730c992..4173d5d9d 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -60,7 +60,7 @@ class SongUsagePlugin(Plugin): log.info(u'SongUsage Plugin loaded') def __init__(self): - Plugin.__init__(self, u'songusage', __default_settings__) + super(SongUsagePlugin, self).__init__(u'songusage', __default_settings__) self.manager = Manager(u'songusage', init_schema, upgrade_mod=upgrade) self.weight = -4 self.icon = build_icon(u':/plugins/plugin_songusage.png') From 18508cf654bbba8fb41a7741ad68f3034a543c90 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 Aug 2013 15:05:45 +0200 Subject: [PATCH 105/108] fixed spelling --- openlp/plugins/remotes/remoteplugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index ea6d01551..11feee4df 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -55,7 +55,7 @@ class RemotesPlugin(Plugin): """ remotes constructor """ - super(RemotePlugin, self).__init__(u'remotes', __default_settings__, settings_tab_class=RemoteTab) + super(RemotesPlugin, self).__init__(u'remotes', __default_settings__, settings_tab_class=RemoteTab) self.icon_path = u':/plugins/plugin_remote.png' self.icon = build_icon(self.icon_path) self.weight = -1 From 4b7e9255a3a068a7d8169e0f125f38a685733048 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 Aug 2013 17:08:03 +0200 Subject: [PATCH 106/108] changed super calls --- openlp/plugins/alerts/alertsplugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index fe11db753..f652d1f34 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -153,7 +153,7 @@ class AlertsPlugin(Plugin): def initialise(self): log.info(u'Alerts Initialising') - Plugin.initialise(self) + super(AlertsPlugin, self).initialise() self.tools_alert_item.setVisible(True) action_list = ActionList.get_instance() action_list.add_action(self.tools_alert_item, UiStrings().Tools) @@ -164,7 +164,7 @@ class AlertsPlugin(Plugin): """ log.info(u'Alerts Finalising') self.manager.finalise() - Plugin.finalise(self) + super(AlertsPlugin, self).finalise() self.tools_alert_item.setVisible(False) action_list = ActionList.get_instance() action_list.remove_action(self.tools_alert_item, u'Tools') From 07ab1cf2173a265480d592a158df3207a9828570 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 Aug 2013 17:11:03 +0200 Subject: [PATCH 107/108] changes calls to super calls --- openlp/plugins/presentations/presentationplugin.py | 4 ++-- openlp/plugins/remotes/remoteplugin.py | 4 ++-- openlp/plugins/songs/songsplugin.py | 4 ++-- openlp/plugins/songusage/songusageplugin.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index cc1516b69..23a432998 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -82,7 +82,7 @@ class PresentationPlugin(Plugin): Initialise the plugin. Determine which controllers are enabled are start their processes. """ log.info(u'Presentations Initialising') - Plugin.initialise(self) + super(PresentationPlugin, self).initialise() for controller in self.controllers: if self.controllers[controller].enabled(): try: @@ -103,7 +103,7 @@ class PresentationPlugin(Plugin): controller = self.controllers[key] if controller.enabled(): controller.kill() - Plugin.finalise(self) + super(PresentationPlugin, self).finalise() def create_media_manager_item(self): """ diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 11feee4df..434428d58 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -66,7 +66,7 @@ class RemotesPlugin(Plugin): Initialise the remotes plugin, and start the http server """ log.debug(u'initialise') - Plugin.initialise(self) + super(RemotePlugin, self).initialise() self.server = HttpServer() self.server.start_server() @@ -75,7 +75,7 @@ class RemotesPlugin(Plugin): Tidy up and close down the http server """ log.debug(u'finalise') - Plugin.finalise(self) + super(RemotePlugin, self).finalise() if self.server: self.server.close() self.server = None diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 0e1cb69df..bc16fafc8 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -94,7 +94,7 @@ class SongsPlugin(Plugin): def initialise(self): log.info(u'Songs Initialising') - Plugin.initialise(self) + super(SongsPlugin, self).initialise() self.song_import_item.setVisible(True) self.song_export_item.setVisible(True) self.tools_reindex_item.setVisible(True) @@ -308,7 +308,7 @@ class SongsPlugin(Plugin): action_list.remove_action(self.song_export_item, UiStrings().Export) action_list.remove_action(self.tools_reindex_item, UiStrings().Tools) action_list.remove_action(self.tools_find_duplicates, UiStrings().Tools) - Plugin.finalise(self) + super(SongsPlugin, self).finalise() def new_service_created(self): """ diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 4173d5d9d..ba09c6258 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -122,7 +122,7 @@ class SongUsagePlugin(Plugin): def initialise(self): log.info(u'SongUsage Initialising') - Plugin.initialise(self) + super(SongUsagePlugin, self).initialise() Registry().register_function(u'slidecontroller_live_started', self.display_song_usage) Registry().register_function(u'print_service_started', self.print_song_usage) self.song_usage_active = Settings().value(self.settings_section + u'/active') @@ -143,7 +143,7 @@ class SongUsagePlugin(Plugin): """ log.info(u'Plugin Finalise') self.manager.finalise() - Plugin.finalise(self) + super(SongUsagePlugin, self).finalise() self.song_usage_menu.menuAction().setVisible(False) action_list = ActionList.get_instance() action_list.remove_action(self.song_usage_status, translate('SongUsagePlugin', 'Song Usage')) From 879a8ad3fdbe9de45c6f24d976dc33a9723dd2e4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 1 Aug 2013 17:12:29 +0200 Subject: [PATCH 108/108] spelling --- openlp/plugins/remotes/remoteplugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 434428d58..353148fdb 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -66,7 +66,7 @@ class RemotesPlugin(Plugin): Initialise the remotes plugin, and start the http server """ log.debug(u'initialise') - super(RemotePlugin, self).initialise() + super(RemotesPlugin, self).initialise() self.server = HttpServer() self.server.start_server() @@ -75,7 +75,7 @@ class RemotesPlugin(Plugin): Tidy up and close down the http server """ log.debug(u'finalise') - super(RemotePlugin, self).finalise() + super(RemotesPlugin, self).finalise() if self.server: self.server.close() self.server = None