From 562a88a9934f532c08d67a4c4070405c40f0626f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 8 Mar 2011 09:38:25 +0200 Subject: [PATCH 01/12] Fixes #730459 and 4 unreported bugs. --- openlp/core/lib/mediamanageritem.py | 6 +++--- openlp/core/ui/servicemanager.py | 32 ++++++++++++++--------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index e3bb4ae0f..ceaad2d46 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -349,11 +349,11 @@ class MediaManagerItem(QtGui.QWidget): Validates whether an image still exists and, if it does, is the thumbnail representation of the image up to date. """ - if not os.path.exists(image): + if not os.path.exists(unicode(image)): return False if os.path.exists(thumb): - imageDate = os.stat(image).st_mtime - thumbDate = os.stat(thumb).st_mtime + imageDate = os.stat(unicode(image)).st_mtime + thumbDate = os.stat(unicode(thumb)).st_mtime # If image has been updated rebuild icon if imageDate > thumbDate: self.iconFromFile(image, thumb) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 3cdf25c7a..555441f96 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -416,36 +416,37 @@ class ServiceManager(QtGui.QWidget): if not self.fileName(): return self.saveFileAs() else: - fileName = self.fileName() - log.debug(u'ServiceManager.saveFile - %s' % fileName) + path_file_name = unicode(self.fileName()) + (path, file_name) = os.path.split(path_file_name) + basename = file_name[0:file_name.rfind(u'.')-1] + file_name = basename + '.osz' + service_file_name = basename + '.osd' + log.debug(u'ServiceManager.saveFile - %s' % path_file_name) SettingsManager.set_last_dir(self.mainwindow.serviceSettingsSection, - split_filename(fileName)[0]) + path) service = [] - serviceFileName = fileName.replace(u'.osz', u'.osd') zip = None file = None try: write_list = [] - zip = zipfile.ZipFile(unicode(fileName), 'w') + zip = zipfile.ZipFile(path_file_name, 'w') for item in self.serviceItems: - service.append({u'serviceitem': \ + service.append({u'serviceitem': item[u'service_item'].get_service_repr()}) if item[u'service_item'].uses_file(): for frame in item[u'service_item'].get_frames(): if item[u'service_item'].is_image(): path_from = frame[u'path'] else: - path_from = unicode(os.path.join( - frame[u'path'], - frame[u'title'])) + path_from = os.path.join(frame[u'path'], + frame[u'title']) # On write a file once if not path_from in write_list: write_list.append(path_from) - zip.write(path_from.encode(u'utf-8')) - file = open(serviceFileName, u'wb') - cPickle.dump(service, file) - file.close() - zip.write(serviceFileName.encode(u'utf-8')) + zip.write(path_from, + path_from.encode(u'utf-8')) + zip.writestr(service_file_name.encode(u'utf-8'), + cPickle.dumps(service)) except IOError: log.exception(u'Failed to save service to disk') finally: @@ -453,8 +454,7 @@ class ServiceManager(QtGui.QWidget): file.close() if zip: zip.close() - delete_file(serviceFileName) - self.mainwindow.addRecentFile(fileName) + self.mainwindow.addRecentFile(path_file_name) self.setModified(False) return True From 216cc407c6372110b58e12130a6f9f7bdf28d044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 8 Mar 2011 11:32:37 +0200 Subject: [PATCH 02/12] Now able to write >2GiB service files (haven't tested opening these),\n on IOError not-saved * asterisk will remain in place,\nbefore adding >50GiB files, user is asked first. --- openlp/core/ui/servicemanager.py | 58 +++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 555441f96..93d24a567 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -419,17 +419,15 @@ class ServiceManager(QtGui.QWidget): path_file_name = unicode(self.fileName()) (path, file_name) = os.path.split(path_file_name) basename = file_name[0:file_name.rfind(u'.')-1] - file_name = basename + '.osz' service_file_name = basename + '.osd' log.debug(u'ServiceManager.saveFile - %s' % path_file_name) SettingsManager.set_last_dir(self.mainwindow.serviceSettingsSection, path) service = [] zip = None - file = None try: write_list = [] - zip = zipfile.ZipFile(path_file_name, 'w') + total_size = 0 for item in self.serviceItems: service.append({u'serviceitem': item[u'service_item'].get_service_repr()}) @@ -440,20 +438,54 @@ class ServiceManager(QtGui.QWidget): else: path_from = os.path.join(frame[u'path'], frame[u'title']) - # On write a file once + # Only write a file once if not path_from in write_list: - write_list.append(path_from) - zip.write(path_from, - path_from.encode(u'utf-8')) + file_size = os.path.getsize(path_from) + size_limit = 52428800 # 50MiB + if file_size > size_limit: + # File exeeds size_limit bytes, ask user + message = unicode(self.trUtf8('Do you want' + ' to include \n%.1f MiB file "%s"\n' + 'into the service file?\n' + 'This may take some time.\n\n' + 'Please note that you need to\n' + 'take care of that file yourself.')) %\ + (file_size/1048576, + os.path.split(path_from)[1]) + ans = QtGui.QMessageBox.question(self, + self.trUtf8('Including Large File'), + message, + QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Ok|\ + QtGui.QMessageBox.Cancel), + QtGui.QMessageBox.Ok) + if ans == QtGui.QMessageBox.Ok: + write_list.append(path_from) + total_size += file_size + else: + write_list.append(path_from) + total_size += file_size + log.debug(u'ServiceManager.saveFile - ZIP contents size is %i' + ' bytes' % total_size) + service_content = cPickle.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.saveFile - allowZip64 is %s' % + allow_zip_64) + zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, + allow_zip_64) + # We first add service contents. + # We save ALL filenames into ZIP using UTF-8. zip.writestr(service_file_name.encode(u'utf-8'), - cPickle.dumps(service)) + service_content) + # Finally add all the listed media files. + for path_from in write_list: + zip.write(path_from, path_from.encode(u'utf-8')) + zip.close() except IOError: log.exception(u'Failed to save service to disk') - finally: - if file: - file.close() - if zip: - zip.close() + return False self.mainwindow.addRecentFile(path_file_name) self.setModified(False) return True From 25dbf271f68ec848df9908eee3cbf841d9a9fa8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 8 Mar 2011 12:16:09 +0200 Subject: [PATCH 03/12] Cleanup --- openlp/core/ui/servicemanager.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 93d24a567..164147c06 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -444,16 +444,20 @@ class ServiceManager(QtGui.QWidget): size_limit = 52428800 # 50MiB if file_size > size_limit: # File exeeds size_limit bytes, ask user - message = unicode(self.trUtf8('Do you want' - ' to include \n%.1f MiB file "%s"\n' + message = unicode(translate( + 'OpenLP.ServiceManager', 'Do you want' + ' to include \n%.1f MB file "%s"\n' 'into the service file?\n' 'This may take some time.\n\n' 'Please note that you need to\n' - 'take care of that file yourself.')) %\ + 'take care of that file yourself,\n' + 'if you leave it out.')) %\ (file_size/1048576, os.path.split(path_from)[1]) - ans = QtGui.QMessageBox.question(self, - self.trUtf8('Including Large File'), + ans = QtGui.QMessageBox.question( + self.mainwindow, + translate('OpenLP.ServiceManager', + 'Including Large File'), message, QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Ok|\ From e7cc230560212417c78b32439f60f0d3e97ca5b4 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 9 Mar 2011 08:55:41 +0200 Subject: [PATCH 04/12] Added debian into the main branch. --- resources/debian/Makefile | 13 + resources/debian/debian/changelog | 389 +++++++++++++++++++++++++ resources/debian/debian/compat | 1 + resources/debian/debian/control | 19 ++ resources/debian/debian/copyright | 10 + resources/debian/debian/docs | 1 + resources/debian/debian/openlp.install | 1 + resources/debian/debian/pycompat | 1 + resources/debian/debian/pyversions | 1 + resources/debian/debian/rules | 21 ++ 10 files changed, 457 insertions(+) create mode 100644 resources/debian/Makefile create mode 100644 resources/debian/debian/changelog create mode 100644 resources/debian/debian/compat create mode 100644 resources/debian/debian/control create mode 100644 resources/debian/debian/copyright create mode 100644 resources/debian/debian/docs create mode 100644 resources/debian/debian/openlp.install create mode 100644 resources/debian/debian/pycompat create mode 100644 resources/debian/debian/pyversions create mode 100755 resources/debian/debian/rules diff --git a/resources/debian/Makefile b/resources/debian/Makefile new file mode 100644 index 000000000..fd19cffb7 --- /dev/null +++ b/resources/debian/Makefile @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +build: + mkdir -p openlp/i18n + for TSFILE in resources/i18n/*.ts; do\ + lrelease-qt4 $$TSFILE -qm openlp/i18n/`basename $$TSFILE .ts`.qm;\ + done + +install: + +clean: + diff --git a/resources/debian/debian/changelog b/resources/debian/debian/changelog new file mode 100644 index 000000000..1d22843f1 --- /dev/null +++ b/resources/debian/debian/changelog @@ -0,0 +1,389 @@ +openlp (1.9.4+bzr1355-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sun, 06 Mar 2011 00:10:03 -0500 + +openlp (1.9.4+bzr1355-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sun, 06 Mar 2011 00:07:03 -0500 + +openlp (1.9.4+bzr1355-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sun, 06 Mar 2011 00:05:27 -0500 + +openlp (1.9.4+bzr1355-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sun, 06 Mar 2011 00:03:17 -0500 + +openlp (1.9.4+bzr1350-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sat, 05 Mar 2011 00:08:15 -0500 + +openlp (1.9.4+bzr1350-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sat, 05 Mar 2011 00:06:40 -0500 + +openlp (1.9.4+bzr1350-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sat, 05 Mar 2011 00:05:09 -0500 + +openlp (1.9.4+bzr1350-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sat, 05 Mar 2011 00:03:14 -0500 + +openlp (1.9.4+bzr1347-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Fri, 04 Mar 2011 00:04:49 -0500 + +openlp (1.9.4+bzr1347-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Fri, 04 Mar 2011 00:04:15 -0500 + +openlp (1.9.4+bzr1347-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Fri, 04 Mar 2011 00:03:34 -0500 + +openlp (1.9.4+bzr1347-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Fri, 04 Mar 2011 00:02:43 -0500 + +openlp (1.9.4+bzr1344-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Thu, 03 Mar 2011 00:03:56 -0500 + +openlp (1.9.4+bzr1344-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Thu, 03 Mar 2011 00:03:30 -0500 + +openlp (1.9.4+bzr1344-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Thu, 03 Mar 2011 00:03:05 -0500 + +openlp (1.9.4+bzr1344-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Thu, 03 Mar 2011 00:02:26 -0500 + +openlp (1.9.4+bzr1342-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Tue, 01 Mar 2011 00:03:44 -0500 + +openlp (1.9.4+bzr1342-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Tue, 01 Mar 2011 00:03:28 -0500 + +openlp (1.9.4+bzr1342-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Tue, 01 Mar 2011 00:03:03 -0500 + +openlp (1.9.4+bzr1342-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Tue, 01 Mar 2011 00:02:28 -0500 + +openlp (1.9.4+bzr1341-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sun, 27 Feb 2011 00:04:05 -0500 + +openlp (1.9.4+bzr1341-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sun, 27 Feb 2011 00:03:48 -0500 + +openlp (1.9.4+bzr1341-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sun, 27 Feb 2011 00:03:20 -0500 + +openlp (1.9.4+bzr1341-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sun, 27 Feb 2011 00:02:34 -0500 + +openlp (1.9.4+bzr1337-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sat, 26 Feb 2011 00:04:02 -0500 + +openlp (1.9.4+bzr1337-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sat, 26 Feb 2011 00:03:44 -0500 + +openlp (1.9.4+bzr1337-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sat, 26 Feb 2011 00:03:18 -0500 + +openlp (1.9.4+bzr1337-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sat, 26 Feb 2011 00:02:32 -0500 + +openlp (1.9.4+bzr1332-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Fri, 25 Feb 2011 00:04:00 -0500 + +openlp (1.9.4+bzr1332-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Fri, 25 Feb 2011 00:03:41 -0500 + +openlp (1.9.4+bzr1332-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Fri, 25 Feb 2011 00:03:16 -0500 + +openlp (1.9.4+bzr1332-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Fri, 25 Feb 2011 00:02:36 -0500 + +openlp (1.9.4+bzr1328-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Thu, 24 Feb 2011 00:03:47 -0500 + +openlp (1.9.4+bzr1328-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Thu, 24 Feb 2011 00:03:31 -0500 + +openlp (1.9.4+bzr1328-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Thu, 24 Feb 2011 00:03:07 -0500 + +openlp (1.9.4+bzr1328-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Thu, 24 Feb 2011 00:02:28 -0500 + +openlp (1.9.4+bzr1324-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Wed, 23 Feb 2011 00:03:48 -0500 + +openlp (1.9.4+bzr1324-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Wed, 23 Feb 2011 00:03:33 -0500 + +openlp (1.9.4+bzr1324-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Wed, 23 Feb 2011 00:03:08 -0500 + +openlp (1.9.4+bzr1324-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Wed, 23 Feb 2011 00:02:28 -0500 + +openlp (1.9.4+bzr1322-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Tue, 22 Feb 2011 00:04:06 -0500 + +openlp (1.9.4+bzr1322-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Tue, 22 Feb 2011 00:03:52 -0500 + +openlp (1.9.4+bzr1322-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Tue, 22 Feb 2011 00:03:28 -0500 + +openlp (1.9.4+bzr1322-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Tue, 22 Feb 2011 00:02:42 -0500 + +openlp (1.9.4+bzr1320-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Mon, 21 Feb 2011 00:03:59 -0500 + +openlp (1.9.4+bzr1320-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Mon, 21 Feb 2011 00:03:45 -0500 + +openlp (1.9.4+bzr1320-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Mon, 21 Feb 2011 00:03:21 -0500 + +openlp (1.9.4+bzr1320-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Mon, 21 Feb 2011 00:02:41 -0500 + +openlp (1.9.4+bzr1316-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sun, 20 Feb 2011 05:32:08 -0500 + +openlp (1.9.4+bzr1316-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sun, 20 Feb 2011 05:31:51 -0500 + +openlp (1.9.4+bzr1316-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sun, 20 Feb 2011 05:31:28 -0500 + +openlp (1.9.4+bzr1316-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sun, 20 Feb 2011 05:30:49 -0500 + +openlp (1.9.4+bzr1315-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 16:24:12 -0500 + +openlp (1.9.4+bzr1315-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 16:23:51 -0500 + +openlp (1.9.4+bzr1315-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 16:23:28 -0500 + +openlp (1.9.4+bzr1315-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 16:22:49 -0500 + +openlp (1.9.4+bzr1314-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 15:35:36 -0500 + +openlp (1.9.4+bzr1314-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 15:35:21 -0500 + +openlp (1.9.4+bzr1314-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 15:34:53 -0500 + +openlp (1.9.4+bzr1314-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 15:34:10 -0500 + +openlp (1.9.4+bzr1313-0ubuntu1~natty1) natty; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 13:58:14 -0500 + +openlp (1.9.4+bzr1313-0ubuntu1~maverick1) maverick; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 13:57:40 -0500 + +openlp (1.9.4+bzr1313-0ubuntu1~lucid1) lucid; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 13:57:11 -0500 + +openlp (1.9.4+bzr1313-0ubuntu1~karmic1) karmic; urgency=low + + * Autobuild + + -- Sat, 19 Feb 2011 13:56:17 -0500 + +openlp (0.0.0+bzr664-0ubuntu1) karmic; urgency=low + + * Initial release + + -- Michael Gorven Fri, 06 Nov 2009 09:46:40 +0200 diff --git a/resources/debian/debian/compat b/resources/debian/debian/compat new file mode 100644 index 000000000..7ed6ff82d --- /dev/null +++ b/resources/debian/debian/compat @@ -0,0 +1 @@ +5 diff --git a/resources/debian/debian/control b/resources/debian/debian/control new file mode 100644 index 000000000..220b500d2 --- /dev/null +++ b/resources/debian/debian/control @@ -0,0 +1,19 @@ +Source: openlp +Section: python +Priority: extra +Maintainer: OpenLP Developers +Build-Depends: cdbs, debhelper (>= 5), python-setuptools, python-support, + python, qt4-dev-tools +Standards-Version: 3.8.3 +Homepage: http://openlp.org/ + +Package: openlp +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-qt4, + python-qt4-phonon, python-sqlalchemy, python-chardet, python-beautifulsoup, + python-lxml, python-sqlite, python-enchant +Conflicts: python-openlp +Description: Church lyrics projection application + OpenLP is free church presentation software, or lyrics projection software, + used to display slides of songs, Bible verses, videos, images, and even + presentations for church worship using a computer and a data projector. diff --git a/resources/debian/debian/copyright b/resources/debian/debian/copyright new file mode 100644 index 000000000..54e52a356 --- /dev/null +++ b/resources/debian/debian/copyright @@ -0,0 +1,10 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Name: OpenLP +Upstream-Maintainer: OpenLP Developers +Upstream-Source: http://openlp.org/ + +Files: * +Copyright: (c) 2008-2009 Raoul Snyman +License: GPL-2 +X-Comment: On Debian GNU/Linux systems, the complete text of the + GPL-2 License can be found in /usr/share/common-licenses/GPL-2 diff --git a/resources/debian/debian/docs b/resources/debian/debian/docs new file mode 100644 index 000000000..dfcaa10d3 --- /dev/null +++ b/resources/debian/debian/docs @@ -0,0 +1 @@ +documentation diff --git a/resources/debian/debian/openlp.install b/resources/debian/debian/openlp.install new file mode 100644 index 000000000..5ef4e79ce --- /dev/null +++ b/resources/debian/debian/openlp.install @@ -0,0 +1 @@ +resources/openlp.desktop /usr/share/applications diff --git a/resources/debian/debian/pycompat b/resources/debian/debian/pycompat new file mode 100644 index 000000000..0cfbf0888 --- /dev/null +++ b/resources/debian/debian/pycompat @@ -0,0 +1 @@ +2 diff --git a/resources/debian/debian/pyversions b/resources/debian/debian/pyversions new file mode 100644 index 000000000..b3dc41ebc --- /dev/null +++ b/resources/debian/debian/pyversions @@ -0,0 +1 @@ +2.5- diff --git a/resources/debian/debian/rules b/resources/debian/debian/rules new file mode 100755 index 000000000..18a593660 --- /dev/null +++ b/resources/debian/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f + +DEB_PYTHON_SYSTEM := pysupport +DEB_MAKE_BUILD_TARGET := build +DEB_MAKE_INSTALL_TARGET := +DEB_MAKE_CLEAN_TARGET := + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/python-distutils.mk +include /usr/share/cdbs/1/class/makefile.mk + +binary-post-install/openlp:: + for SIZE in 16x16 32x32 48x48 64x64 128x128 256x256; do \ + mkdir -p debian/openlp/usr/share/icons/hicolor/$$SIZE/apps && \ + cp resources/images/openlp-logo-$$SIZE.png debian/openlp/usr/share/icons/hicolor/$$SIZE/apps/openlp.png; \ + done + + mkdir -p debian/openlp/usr/share/icons/hicolor/scalable/apps && \ + cp resources/images/openlp-logo.svg debian/openlp/usr/share/icons/hicolor/scalable/apps/openlp.svg + + cd debian/openlp/usr/bin/ && mv openlp.pyw openlp From c7a435951df7d6eefcadc05ed37a09dd11358cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 9 Mar 2011 09:17:58 +0200 Subject: [PATCH 05/12] Better code, as suggested and a few suggested fixes as well. --- openlp/core/ui/servicemanager.py | 142 ++++++++++++++----------------- 1 file changed, 66 insertions(+), 76 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 164147c06..703c5ebc4 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -415,84 +415,74 @@ class ServiceManager(QtGui.QWidget): """ if not self.fileName(): return self.saveFileAs() - else: - path_file_name = unicode(self.fileName()) - (path, file_name) = os.path.split(path_file_name) - basename = file_name[0:file_name.rfind(u'.')-1] - service_file_name = basename + '.osd' - log.debug(u'ServiceManager.saveFile - %s' % path_file_name) - SettingsManager.set_last_dir(self.mainwindow.serviceSettingsSection, - path) - service = [] - zip = None - try: - write_list = [] - total_size = 0 - for item in self.serviceItems: - service.append({u'serviceitem': - item[u'service_item'].get_service_repr()}) - if item[u'service_item'].uses_file(): - for frame in item[u'service_item'].get_frames(): - if item[u'service_item'].is_image(): - path_from = frame[u'path'] - else: - path_from = os.path.join(frame[u'path'], - frame[u'title']) - # Only write a file once - if not path_from in write_list: - file_size = os.path.getsize(path_from) - size_limit = 52428800 # 50MiB - if file_size > size_limit: - # File exeeds size_limit bytes, ask user - message = unicode(translate( - 'OpenLP.ServiceManager', 'Do you want' - ' to include \n%.1f MB file "%s"\n' - 'into the service file?\n' - 'This may take some time.\n\n' - 'Please note that you need to\n' - 'take care of that file yourself,\n' - 'if you leave it out.')) %\ - (file_size/1048576, - os.path.split(path_from)[1]) - ans = QtGui.QMessageBox.question( - self.mainwindow, - translate('OpenLP.ServiceManager', - 'Including Large File'), - message, - QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Ok|\ - QtGui.QMessageBox.Cancel), - QtGui.QMessageBox.Ok) - if ans == QtGui.QMessageBox.Ok: - write_list.append(path_from) - total_size += file_size - else: - write_list.append(path_from) - total_size += file_size - log.debug(u'ServiceManager.saveFile - ZIP contents size is %i' - ' bytes' % total_size) - service_content = cPickle.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.saveFile - allowZip64 is %s' % - allow_zip_64) - zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, - allow_zip_64) - # We first add service contents. - # We save ALL filenames into ZIP using UTF-8. - zip.writestr(service_file_name.encode(u'utf-8'), - service_content) - # Finally add all the listed media files. - for path_from in write_list: - zip.write(path_from, path_from.encode(u'utf-8')) - zip.close() - except IOError: - log.exception(u'Failed to save service to disk') - return False + path_file_name = unicode(self.fileName()) + (path, file_name) = os.path.split(path_file_name) + basename = file_name[0:file_name.rfind(u'.')-1] + service_file_name = basename + '.osd' + log.debug(u'ServiceManager.saveFile - %s' % path_file_name) + SettingsManager.set_last_dir(self.mainwindow.serviceSettingsSection, + path) + service = [] + write_list = [] + total_size = 0 + for item in self.serviceItems: + service.append({u'serviceitem': + item[u'service_item'].get_service_repr()}) + if not item[u'service_item'].uses_file(): + continue + for frame in item[u'service_item'].get_frames(): + if item[u'service_item'].is_image(): + path_from = frame[u'path'] + else: + path_from = os.path.join(frame[u'path'], frame[u'title']) + # Only write a file once + if path_from in write_list: + continue + file_size = os.path.getsize(path_from) + size_limit = 52428800 # 50MiB + if file_size > size_limit: + # File exeeds size_limit bytes, ask user + message = unicode(translate('OpenLP.ServiceManager', + 'Do you want to include \n%.1f MB file "%s"\n' + 'into the service file?\nThis may take some time.\n\n' + 'Please note that you need to\ntake care of that file ' + 'yourself,\nif you leave it out.')) % \ + (file_size/1048576, os.path.split(path_from)[1]) + ans = QtGui.QMessageBox.question(self.mainwindow, + translate('OpenLP.ServiceManager', 'Including Large ' + 'File'), message, QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel), + QtGui.QMessageBox.Ok) + if ans == QtGui.QMessageBox.Cancel: + continue + write_list.append(path_from) + total_size += file_size + log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' % + total_size) + service_content = cPickle.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.saveFile - allowZip64 is %s' % + allow_zip_64) + try: + zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, + allow_zip_64) + # First we add service contents. + # We save ALL filenames into ZIP using UTF-8. + zip.writestr(service_file_name.encode(u'utf-8'), + service_content) + # Finally add all the listed media files. + for path_from in write_list: + zip.write(path_from, path_from.encode(u'utf-8')) + except IOError: + log.exception(u'Failed to save service to disk') + finally: + zip.close() self.mainwindow.addRecentFile(path_file_name) self.setModified(False) - return True + return True + return False def saveFileAs(self): """ From f710746a5597ce77c09aef668c65ead4a9c8aeb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 9 Mar 2011 20:02:21 +0200 Subject: [PATCH 06/12] Returns now done right. Commented out dialog part, which needs more work --- openlp/core/ui/servicemanager.py | 35 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 703c5ebc4..ff7c077e2 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -413,6 +413,7 @@ class ServiceManager(QtGui.QWidget): """ Save the current Service file. """ + success = True if not self.fileName(): return self.saveFileAs() path_file_name = unicode(self.fileName()) @@ -440,21 +441,21 @@ class ServiceManager(QtGui.QWidget): continue file_size = os.path.getsize(path_from) size_limit = 52428800 # 50MiB - if file_size > size_limit: - # File exeeds size_limit bytes, ask user - message = unicode(translate('OpenLP.ServiceManager', - 'Do you want to include \n%.1f MB file "%s"\n' - 'into the service file?\nThis may take some time.\n\n' - 'Please note that you need to\ntake care of that file ' - 'yourself,\nif you leave it out.')) % \ - (file_size/1048576, os.path.split(path_from)[1]) - ans = QtGui.QMessageBox.question(self.mainwindow, - translate('OpenLP.ServiceManager', 'Including Large ' - 'File'), message, QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel), - QtGui.QMessageBox.Ok) - if ans == QtGui.QMessageBox.Cancel: - continue + #if file_size > size_limit: + # # File exeeds size_limit bytes, ask user + # message = unicode(translate('OpenLP.ServiceManager', + # 'Do you want to include \n%.1f MB file "%s"\n' + # 'into the service file?\nThis may take some time.\n\n' + # 'Please note that you need to\ntake care of that file' + # ' yourself,\nif you leave it out.')) % \ + # (file_size/1048576, os.path.split(path_from)[1]) + # ans = QtGui.QMessageBox.question(self.mainwindow, + # translate('OpenLP.ServiceManager', 'Including Large ' + # 'File'), message, QtGui.QMessageBox.StandardButtons( + # QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel), + # QtGui.QMessageBox.Ok) + # if ans == QtGui.QMessageBox.Cancel: + # continue write_list.append(path_from) total_size += file_size log.debug(u'ServiceManager.saveFile - ZIP contents size is %i bytes' % @@ -477,12 +478,12 @@ class ServiceManager(QtGui.QWidget): zip.write(path_from, path_from.encode(u'utf-8')) except IOError: log.exception(u'Failed to save service to disk') + success = False finally: zip.close() self.mainwindow.addRecentFile(path_file_name) self.setModified(False) - return True - return False + return success def saveFileAs(self): """ From 32034dea950bd0840c23c8b961a82f456779455e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 9 Mar 2011 20:08:06 +0200 Subject: [PATCH 07/12] Just to make more sense. --- openlp/core/ui/servicemanager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ff7c077e2..fb3664769 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -482,6 +482,7 @@ class ServiceManager(QtGui.QWidget): finally: zip.close() self.mainwindow.addRecentFile(path_file_name) + if success: self.setModified(False) return success From 674e9713e7418d35453fedf90c065050daa8c157 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 9 Mar 2011 19:14:50 +0100 Subject: [PATCH 08/12] serach comments --- openlp/core/ui/maindisplay.py | 3 --- openlp/plugins/songs/lib/mediaitem.py | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 357eb655a..72ebe422a 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -516,9 +516,6 @@ class AudioPlayer(QtCore.QObject): ``parent`` The parent widget. - - ``screens`` - The list of screens. """ log.debug(u'AudioPlayer Initialisation started') QtCore.QObject.__init__(self, parent) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 4c267dd3c..c16516eb7 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -159,15 +159,15 @@ class SongMediaItem(MediaManagerItem): def onSearchTextButtonClick(self): search_keywords = unicode(self.searchTextEdit.displayText()) search_results = [] - # search_type = self.searchTypeComboBox.currentIndex() search_type = self.searchTextEdit.currentSearchType() if search_type == SongSearch.Entire: log.debug(u'Entire Song Search') search_results = self.parent.manager.get_all_objects(Song, or_(Song.search_title.like(u'%' + self.whitespace.sub(u' ', search_keywords.lower()) + u'%'), - Song.search_lyrics.like(u'%' + search_keywords.lower() + \ - u'%')), Song.search_title.asc()) + Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'), + Song.comments.like(u'%' + search_keywords.lower() + u'%')), + Song.search_title.asc()) self.displayResultsSong(search_results) elif search_type == SongSearch.Titles: log.debug(u'Titles Search') @@ -253,11 +253,13 @@ class SongMediaItem(MediaManagerItem): if self.searchAsYouType: search_length = 1 if self.searchTextEdit.currentSearchType() == SongSearch.Entire: - search_length = 3 - elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics: search_length = 7 + elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics: + search_length = 3 if len(text) > search_length: self.onSearchTextButtonClick() + elif len(text) == 0: + self.onClearTextButtonClick() def onImportClick(self): if not hasattr(self, u'import_wizard'): @@ -446,10 +448,9 @@ class SongMediaItem(MediaManagerItem): add_song = False editId = song.id break - if add_song: - if self.addSongFromService: - editId = self.openLyrics.xml_to_song(item.xml_version) - self.onSearchTextButtonClick() + if add_song and self.addSongFromService: + editId = self.openLyrics.xml_to_song(item.xml_version) + self.onSearchTextButtonClick() # Update service with correct song id. if editId: Receiver.send_message(u'service_item_update', From 89187ffadecc48d0bd4d10c72dd7480f00119fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 9 Mar 2011 20:22:07 +0200 Subject: [PATCH 09/12] Neater again. --- 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 fb3664769..9951c8295 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -413,7 +413,6 @@ class ServiceManager(QtGui.QWidget): """ Save the current Service file. """ - success = True if not self.fileName(): return self.saveFileAs() path_file_name = unicode(self.fileName()) @@ -478,13 +477,13 @@ class ServiceManager(QtGui.QWidget): zip.write(path_from, path_from.encode(u'utf-8')) except IOError: log.exception(u'Failed to save service to disk') - success = False + zip.close() + return False finally: zip.close() self.mainwindow.addRecentFile(path_file_name) - if success: self.setModified(False) - return success + return True def saveFileAs(self): """ From d668060cf9593b84c6a48a26116cad9b7fe7c028 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 9 Mar 2011 19:43:50 +0100 Subject: [PATCH 10/12] fixed search_length --- openlp/plugins/songs/lib/mediaitem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index c16516eb7..46c027316 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -255,7 +255,7 @@ class SongMediaItem(MediaManagerItem): if self.searchTextEdit.currentSearchType() == SongSearch.Entire: search_length = 7 elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics: - search_length = 3 + search_length = 6 if len(text) > search_length: self.onSearchTextButtonClick() elif len(text) == 0: From f1174469543a36b3e6860bc4b36b8339e2bf2cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 9 Mar 2011 21:22:52 +0200 Subject: [PATCH 11/12] I hope it finally is right. --- openlp/core/ui/servicemanager.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9951c8295..73ca4b9ca 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -465,6 +465,7 @@ class ServiceManager(QtGui.QWidget): allow_zip_64 = (total_size > 2147483648 + len(service_content)) log.debug(u'ServiceManager.saveFile - allowZip64 is %s' % allow_zip_64) + zip = None try: zip = zipfile.ZipFile(path_file_name, 'w', zipfile.ZIP_STORED, allow_zip_64) @@ -477,13 +478,13 @@ class ServiceManager(QtGui.QWidget): zip.write(path_from, path_from.encode(u'utf-8')) except IOError: log.exception(u'Failed to save service to disk') - zip.close() return False finally: - zip.close() - self.mainwindow.addRecentFile(path_file_name) - self.setModified(False) - return True + if zip: + zip.close() + self.mainwindow.addRecentFile(path_file_name) + self.setModified(False) + return True def saveFileAs(self): """ From 010adf3f254e9779b2b83116362aa5f2ea9ce2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Thu, 10 Mar 2011 20:31:34 +0200 Subject: [PATCH 12/12] Improve readability a bit, as Meths suggested. --- openlp/core/ui/servicemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 73ca4b9ca..fa2bc50f5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -417,7 +417,7 @@ class ServiceManager(QtGui.QWidget): return self.saveFileAs() path_file_name = unicode(self.fileName()) (path, file_name) = os.path.split(path_file_name) - basename = file_name[0:file_name.rfind(u'.')-1] + (basename, extension) = os.path.splitext(file_name) service_file_name = basename + '.osd' log.debug(u'ServiceManager.saveFile - %s' % path_file_name) SettingsManager.set_last_dir(self.mainwindow.serviceSettingsSection,