From c1c1de547288ad70be78809ffa4897aa0afa991a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 25 Feb 2012 13:01:47 +0000 Subject: [PATCH 01/13] Fix Impress and OpenLP so it now starts . Fix Spelling Remove QLocale code for now as not supported by PyQt Fixes: https://launchpad.net/bugs/902115 --- openlp/core/lib/__init__.py | 9 +++++---- openlp/plugins/presentations/lib/impresscontroller.py | 1 - openlp/plugins/songs/lib/oooimport.py | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 9390ef650..2df8f23c2 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -56,7 +56,7 @@ class SlideLimits(object): class ServiceItemAction(object): """ - Provides an enumeration for the required action moving between service + Provides an enumeration for the required action moving between service items by left/right arrow keys """ Previous = 1 @@ -321,15 +321,16 @@ def check_directory_exists(dir): def create_separated_list(stringlist): """ Returns a string that represents a join of a list of strings with a - localized separator. This function corresponts to + localized separator. This function corresponds to QLocale::createSeparatedList which was introduced in Qt 4.8 and implements the algorithm from http://www.unicode.org/reports/tr35/#ListPatterns ``stringlist`` List of unicode strings """ - if Qt.qVersion() >= u'4.8': - return unicode(QtCore.QLocale.createSeparatedList(stringlist)) + #Not available via pyqt yet so will not work! + #if Qt.qVersion() >= u'4.8': + # return unicode(QtCore.QLocale.createSeparatedList(stringlist)) if not stringlist: return u'' elif len(stringlist) == 1: diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 3e6c5450a..0fd725b83 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -105,7 +105,6 @@ class ImpressController(PresentationController): cmd = get_uno_command() self.process = QtCore.QProcess() self.process.startDetached(cmd) - self.process.waitForStarted() def get_uno_desktop(self): """ diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index f98cf2dda..5820b1e94 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -142,7 +142,6 @@ class OooImport(SongImport): cmd = get_uno_command() process = QtCore.QProcess() process.startDetached(cmd) - process.waitForStarted() self.processStarted = True except: log.exception("startOooProcess failed") From 3e1ba89a41d7361461282e07150805d0e1664b45 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 25 Feb 2012 17:44:21 +0000 Subject: [PATCH 02/13] Fix locale test --- 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 2df8f23c2..650ae911d 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -328,9 +328,8 @@ def create_separated_list(stringlist): ``stringlist`` List of unicode strings """ - #Not available via pyqt yet so will not work! - #if Qt.qVersion() >= u'4.8': - # return unicode(QtCore.QLocale.createSeparatedList(stringlist)) + if Qt.PYQT_VERSION_STR >= u'4.9': + return unicode(QtCore.QLocale.createSeparatedList(stringlist)) if not stringlist: return u'' elif len(stringlist) == 1: From 025fe7e145b1a4896b32256d94890a8dc7e15754 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 25 Feb 2012 18:31:02 +0000 Subject: [PATCH 03/13] Correct brackets --- 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 650ae911d..d1e3b5308 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -329,7 +329,7 @@ def create_separated_list(stringlist): List of unicode strings """ if Qt.PYQT_VERSION_STR >= u'4.9': - return unicode(QtCore.QLocale.createSeparatedList(stringlist)) + return unicode(QtCore.QLocale().createSeparatedList(stringlist)) if not stringlist: return u'' elif len(stringlist) == 1: From ee3da316828a4aefad2f12e1119014d0814778c2 Mon Sep 17 00:00:00 2001 From: M2j Date: Sun, 26 Feb 2012 16:15:00 +0100 Subject: [PATCH 04/13] Check for Qt version before calling QtCore.QLocale().createSeparatedList --- 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 d1e3b5308..4403ac8ec 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -328,7 +328,7 @@ def create_separated_list(stringlist): ``stringlist`` List of unicode strings """ - if Qt.PYQT_VERSION_STR >= u'4.9': + if Qt.PYQT_VERSION_STR >= u'4.9' and Qt.qVersion() >= u'4.8': return unicode(QtCore.QLocale().createSeparatedList(stringlist)) if not stringlist: return u'' From 2592d6f698cbddffcfe84b7b73f358b8041123cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Sun, 26 Feb 2012 22:27:05 +0100 Subject: [PATCH 05/13] add possibility to search for songbook and songnumber --- openlp/plugins/songs/lib/mediaitem.py | 39 +++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index ab95d794f..62a48521c 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -43,7 +43,7 @@ from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \ SongImportForm, SongExportForm from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \ clean_string -from openlp.plugins.songs.lib.db import Author, Song, MediaFile +from openlp.plugins.songs.lib.db import Author, Song, Book, MediaFile from openlp.plugins.songs.lib.ui import SongStrings log = logging.getLogger(__name__) @@ -56,7 +56,8 @@ class SongSearch(object): Titles = 2 Lyrics = 3 Authors = 4 - Themes = 5 + Books = 5 + Themes = 6 class SongMediaItem(MediaManagerItem): @@ -158,6 +159,8 @@ class SongMediaItem(MediaManagerItem): translate('SongsPlugin.MediaItem', 'Lyrics')), (SongSearch.Authors, u':/songs/song_search_author.png', SongStrings.Authors), + (SongSearch.Books, u':/songs/song_book_edit.png', + SongStrings.SongBooks), (SongSearch.Themes, u':/slides/slide_theme.png', UiStrings().Themes) ]) self.searchTextEdit.setCurrentSearchType(QtCore.QSettings().value( @@ -196,6 +199,19 @@ class SongMediaItem(MediaManagerItem): Author.display_name.like(u'%' + search_keywords + u'%'), Author.display_name.asc()) self.displayResultsAuthor(search_results) + elif search_type == SongSearch.Books: + log.debug(u'Books Search') + search_results = self.plugin.manager.get_all_objects(Book, + Book.name.like(u'%' + search_keywords + u'%'), + Book.name.asc()) + song_number = False + if not search_results: + search_keywords = search_keywords.rpartition(' ') + search_results = self.plugin.manager.get_all_objects(Book, + Book.name.like(u'%' + search_keywords[0] + u'%'), + Book.name.asc()) + song_number = re.sub(r'[^0-9]', u'', search_keywords[2]) + self.displayResultsBook(search_results, song_number) elif search_type == SongSearch.Themes: log.debug(u'Theme Search') search_results = self.plugin.manager.get_all_objects(Song, @@ -270,6 +286,25 @@ class SongMediaItem(MediaManagerItem): song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) self.listView.addItem(song_name) + def displayResultsBook(self, searchresults, song_number=False): + log.debug(u'display results Book') + self.listView.clear() + for book in searchresults: + songs = sorted(book.songs, key=lambda song: int( + re.sub(r'[^0-9]', u' ', song.song_number).partition(' ')[0]) + if len(re.sub(r'[^\w]', ' ', song.song_number)) else 0) + for song in songs: + # Do not display temporary songs + if song.temporary: + continue + if song_number and not song_number in song.song_number: + continue + song_detail = u'%s - %s (%s)' % (book.name, song.song_number, + song.title) + song_name = QtGui.QListWidgetItem(song_detail) + song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id)) + self.listView.addItem(song_name) + def onClearTextButtonClick(self): """ Clear the search text. From b56d8d2a061aa52511cab2763c64230b42fc65e6 Mon Sep 17 00:00:00 2001 From: Rastislav Pecik Date: Mon, 27 Feb 2012 01:42:35 +0100 Subject: [PATCH 06/13] Fixed connection to mysql to use UTF8 encoding. Fixes: https://launchpad.net/bugs/941692 --- openlp/core/lib/db.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index d7ca10f0f..30b41a6b5 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -193,6 +193,12 @@ class Manager(object): else: self.db_url = u'sqlite:///%s/%s.sqlite' % ( AppLocation.get_section_data_path(plugin_name), plugin_name) + elif db_type == u'mysql' : + self.db_url = u'%s://%s:%s@%s/%s?charset=utf8' % (db_type, + urlquote(unicode(settings.value(u'db username').toString())), + urlquote(unicode(settings.value(u'db password').toString())), + urlquote(unicode(settings.value(u'db hostname').toString())), + urlquote(unicode(settings.value(u'db database').toString()))) else: self.db_url = u'%s://%s:%s@%s/%s' % (db_type, urlquote(unicode(settings.value(u'db username').toString())), From c024e9e47d989855418f3e20aa564fa1a6b1b889 Mon Sep 17 00:00:00 2001 From: Rastislav Pecik Date: Mon, 27 Feb 2012 19:18:52 +0100 Subject: [PATCH 07/13] Exported mysql charset settings to configuration files and cleaned up the code --- openlp/core/lib/db.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 30b41a6b5..36823b118 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -193,18 +193,18 @@ class Manager(object): else: self.db_url = u'sqlite:///%s/%s.sqlite' % ( AppLocation.get_section_data_path(plugin_name), plugin_name) - elif db_type == u'mysql' : - self.db_url = u'%s://%s:%s@%s/%s?charset=utf8' % (db_type, - urlquote(unicode(settings.value(u'db username').toString())), - urlquote(unicode(settings.value(u'db password').toString())), - urlquote(unicode(settings.value(u'db hostname').toString())), - urlquote(unicode(settings.value(u'db database').toString()))) else: self.db_url = u'%s://%s:%s@%s/%s' % (db_type, urlquote(unicode(settings.value(u'db username').toString())), urlquote(unicode(settings.value(u'db password').toString())), urlquote(unicode(settings.value(u'db hostname').toString())), urlquote(unicode(settings.value(u'db database').toString()))) + if db_type == u'mysql': + db_encoding = unicode( + settings.value(u'db encoding').toString()) + if db_encoding == "": + db_encoding = u'utf8' + self.db_url += u'?charset=%s' % (urlquote(db_encoding)) settings.endGroup() if upgrade_mod: db_ver, up_ver = upgrade_db(self.db_url, upgrade_mod) From 6ec167ed83b13f84f3307194509f7634d03a008f Mon Sep 17 00:00:00 2001 From: Rastislav Pecik Date: Tue, 28 Feb 2012 12:12:52 +0100 Subject: [PATCH 08/13] QSettings.value() now uses second argument for default value, which is utf8 --- openlp/core/lib/db.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 36823b118..a4a047497 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -201,9 +201,7 @@ class Manager(object): urlquote(unicode(settings.value(u'db database').toString()))) if db_type == u'mysql': db_encoding = unicode( - settings.value(u'db encoding').toString()) - if db_encoding == "": - db_encoding = u'utf8' + settings.value(u'db encoding', u'utf8').toString()) self.db_url += u'?charset=%s' % (urlquote(db_encoding)) settings.endGroup() if upgrade_mod: From 271c4ef1a41a18b18707d6d4509ee5069eee93b9 Mon Sep 17 00:00:00 2001 From: Rastislav Pecik Date: Tue, 28 Feb 2012 12:30:30 +0100 Subject: [PATCH 09/13] using QtCore.QVariant object as a second argument in settings.value method --- openlp/core/lib/db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index a4a047497..6eff984c3 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -201,7 +201,7 @@ class Manager(object): urlquote(unicode(settings.value(u'db database').toString()))) if db_type == u'mysql': db_encoding = unicode( - settings.value(u'db encoding', u'utf8').toString()) + settings.value(u'db encoding', QtCore.QVariant(u'utf8')).toString()) self.db_url += u'?charset=%s' % (urlquote(db_encoding)) settings.endGroup() if upgrade_mod: From 8818256b2a99d0b8a3805495ff47232a6ad054f0 Mon Sep 17 00:00:00 2001 From: Rastislav Pecik Date: Tue, 28 Feb 2012 15:06:14 +0100 Subject: [PATCH 10/13] Fixed code according to mrege proposal comments --- openlp/core/lib/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 6eff984c3..436ea82de 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -201,8 +201,8 @@ class Manager(object): urlquote(unicode(settings.value(u'db database').toString()))) if db_type == u'mysql': db_encoding = unicode( - settings.value(u'db encoding', QtCore.QVariant(u'utf8')).toString()) - self.db_url += u'?charset=%s' % (urlquote(db_encoding)) + settings.value(u'db encoding', u'utf8').toString()) + self.db_url += u'?charset=%s' % urlquote(db_encoding) settings.endGroup() if upgrade_mod: db_ver, up_ver = upgrade_db(self.db_url, upgrade_mod) From 87e70fa2dcb953ad6db2fa91f83841cee15d5cbf Mon Sep 17 00:00:00 2001 From: rimach Date: Sat, 3 Mar 2012 00:08:24 +0100 Subject: [PATCH 11/13] fix --- openlp/core/ui/media/mediacontroller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 9c44f1693..6ef7185bc 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -100,8 +100,7 @@ class MediaController(object): Register each media Player controller (Webkit, Phonon, etc) and store for later use """ - if controller.check_available(): - self.mediaPlayers[controller.name] = controller + self.mediaPlayers[controller.name] = controller def check_available_media_players(self): """ @@ -134,7 +133,8 @@ class MediaController(object): QtCore.QVariant(u'webkit')).toString()) savedPlayers = playerSettings.split(u',') invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \ - if not mediaPlayer in self.mediaPlayers] + if not mediaPlayer in self.mediaPlayers or \ + self.mediaPlayers[mediaPlayer].check_available() == False] if len(invalidMediaPlayers) > 0: for invalidPlayer in invalidMediaPlayers: savedPlayers.remove(invalidPlayer) From 0b15238245d19fb5dbebd11c786e1e3a556d00ac Mon Sep 17 00:00:00 2001 From: Samuel Findlay Date: Sat, 3 Mar 2012 16:13:48 +1100 Subject: [PATCH 12/13] fixed bug #944510 'web remote doesn't scale to screen' Fixes: https://launchpad.net/bugs/944510 --- openlp/plugins/remotes/html/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index fb88ee0dc..7a2da3bea 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -27,6 +27,7 @@ --> + ${app_title} From 5d6db957e166c3aa4d5f1e3b27b302efb1c0853e Mon Sep 17 00:00:00 2001 From: rimach Date: Sat, 3 Mar 2012 23:36:46 +0100 Subject: [PATCH 13/13] fix --- openlp/core/ui/media/mediacontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 6ef7185bc..3beffbf36 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -134,7 +134,7 @@ class MediaController(object): savedPlayers = playerSettings.split(u',') invalidMediaPlayers = [mediaPlayer for mediaPlayer in savedPlayers \ if not mediaPlayer in self.mediaPlayers or \ - self.mediaPlayers[mediaPlayer].check_available() == False] + not self.mediaPlayers[mediaPlayer].check_available()] if len(invalidMediaPlayers) > 0: for invalidPlayer in invalidMediaPlayers: savedPlayers.remove(invalidPlayer)