diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 9390ef650..4403ac8ec 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,15 @@ 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)) + 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'' elif len(stringlist) == 1: diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index d7ca10f0f..436ea82de 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -199,6 +199,10 @@ class Manager(object): 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', 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) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 9c44f1693..3beffbf36 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 \ + not self.mediaPlayers[mediaPlayer].check_available()] if len(invalidMediaPlayers) > 0: for invalidPlayer in invalidMediaPlayers: savedPlayers.remove(invalidPlayer) 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/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} 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. 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")