From f34ae80eec59edff957c5a78401d397019d01697 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 3 Dec 2011 19:01:36 +0100 Subject: [PATCH 01/26] fixed bug 887313 Fixes: https://launchpad.net/bugs/887313 --- openlp/core/ui/printserviceform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index c08b6293e..4d1dc71c8 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -402,6 +402,9 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): settings.endGroup() def update_song_usage(self): + # Only continue when we include the song's text. + if not self.slideTextCheckBox.isChecked(): + return for index, item in enumerate(self.serviceManager.serviceItems): # Trigger Audit requests Receiver.send_message(u'print_service_started', From 5b67d36b3cc91c94ffde82adfba1ab4c9d37350d Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 3 Dec 2011 20:23:46 +0200 Subject: [PATCH 02/26] Fix problem where importing new song databases now does not work. Fixes: https://launchpad.net/bugs/863845 --- openlp/plugins/songs/lib/olpimport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 75e149fad..29d03a136 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -39,7 +39,7 @@ from openlp.core.lib import translate from openlp.core.lib.db import BaseModel from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import clean_song -from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile +from openlp.plugins.songs.lib.db import Author, Book, Song, Topic, MediaFile from songimport import SongImport log = logging.getLogger(__name__) @@ -143,7 +143,8 @@ class OpenLPSongImport(SongImport): secondary=source_media_files_songs_table) else: song_props['media_files'] = relation(OldMediaFile, - backref='songs') + backref='songs', primaryjoin=source_songs_table.c.id==OldMediaFile.song_id, + foreign_keys=[source_media_files_table.c.song_id]) try: class_mapper(OldAuthor) except UnmappedClassError: From b78bb1c7e60547814beb6da01b92cbd79a0743bc Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 3 Dec 2011 21:35:53 +0100 Subject: [PATCH 03/26] fixed tooltip strings --- openlp/core/ui/media/mediacontroller.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index b05a7fe59..c4e3e7fa9 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -206,15 +206,15 @@ class MediaController(object): controller.mediabar = OpenLPToolbar(controller) controller.mediabar.addToolbarButton( u'media_playback_play', u':/slides/media_playback_start.png', - translate('OpenLP.SlideController', 'Start playing media'), + translate('OpenLP.SlideController', 'Start playing media.'), controller.sendToPlugins) controller.mediabar.addToolbarButton( u'media_playback_pause', u':/slides/media_playback_pause.png', - translate('OpenLP.SlideController', 'Pause playing media'), + translate('OpenLP.SlideController', 'Pause playing media.'), controller.sendToPlugins) controller.mediabar.addToolbarButton( u'media_playback_stop', u':/slides/media_playback_stop.png', - translate('OpenLP.SlideController', 'Stop playing media'), + translate('OpenLP.SlideController', 'Stop playing media.'), controller.sendToPlugins) # Build the seekSlider. controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal) @@ -223,7 +223,7 @@ class MediaController(object): 'OpenLP.SlideController', 'Video position.')) controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) controller.seekSlider.setObjectName(u'seek_slider') - controller.mediabar.addToolbarWidget(u'Seek Slider', + controller.mediabar.addToolbarWidget(u'Seek Slider', controller.seekSlider) # Build the volumeSlider. controller.volumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal) @@ -236,7 +236,7 @@ class MediaController(object): controller.volumeSlider.setValue(controller.media_info.volume) controller.volumeSlider.setGeometry(QtCore.QRect(90, 160, 221, 24)) controller.volumeSlider.setObjectName(u'volume_slider') - controller.mediabar.addToolbarWidget(u'Audio Volume', + controller.mediabar.addToolbarWidget(u'Audio Volume', controller.volumeSlider) control_panel.addWidget(controller.mediabar) controller.mediabar.setVisible(False) @@ -255,7 +255,7 @@ class MediaController(object): def setup_display(self, display): """ - After a new display is configured, all media related widget will be + After a new display is configured, all media related widget will be created too """ # clean up possible running old media files @@ -276,13 +276,13 @@ class MediaController(object): def set_controls_visible(self, controller, value): # Generic controls controller.mediabar.setVisible(value) - # Special controls: Here media type specific Controls will be enabled + # Special controls: Here media type specific Controls will be enabled # (e.g. for DVD control, ...) # TODO def resize(self, controller, display, player): """ - After Mainwindow changes or Splitter moved all related media widgets + After Mainwindow changes or Splitter moved all related media widgets have to be resized """ player.resize(display) @@ -389,7 +389,7 @@ class MediaController(object): def video_play(self, msg, status=True): """ Responds to the request to play a loaded video - + ``msg`` First element is the controller which should be used """ From def18307ccc9d1bb7b0c95d1eee4aaae65994900 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 3 Dec 2011 23:49:40 +0200 Subject: [PATCH 04/26] Avoid an error about something not being a Boolean. Fixes: https://launchpad.net/bugs/899532 --- openlp/plugins/songs/lib/olpimport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 29d03a136..99ca9e748 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -121,6 +121,7 @@ class OpenLPSongImport(SongImport): source_topics_table = source_meta.tables[u'topics'] source_authors_songs_table = source_meta.tables[u'authors_songs'] source_songs_topics_table = source_meta.tables[u'songs_topics'] + source_media_files_songs_table = None if has_media_files: source_media_files_table = source_meta.tables[u'media_files'] source_media_files_songs_table = \ @@ -137,7 +138,7 @@ class OpenLPSongImport(SongImport): secondary=source_songs_topics_table) } if has_media_files: - if source_media_files_songs_table: + if source_media_files_songs_table is not None: song_props['media_files'] = relation(OldMediaFile, backref='songs', secondary=source_media_files_songs_table) From 2016ce61ca220fdc7dcfe5445bb7d35966698657 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 4 Dec 2011 00:30:22 +0200 Subject: [PATCH 05/26] Sometimes the song_id column doesn't exist on the model, so we use the table instead. --- openlp/plugins/songs/lib/olpimport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 99ca9e748..d7a735033 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -144,8 +144,9 @@ class OpenLPSongImport(SongImport): secondary=source_media_files_songs_table) else: song_props['media_files'] = relation(OldMediaFile, - backref='songs', primaryjoin=source_songs_table.c.id==OldMediaFile.song_id, - foreign_keys=[source_media_files_table.c.song_id]) + backref='songs', + primaryjoin=source_songs_table.c.id == \ + source_media_files_table.c.song_id) try: class_mapper(OldAuthor) except UnmappedClassError: From c825df38fad9bd0a745c09f3f1d9dc5a9bb38a9a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 4 Dec 2011 15:26:27 +0200 Subject: [PATCH 06/26] Hopefully the final piece of the fix. --- openlp/plugins/songs/lib/olpimport.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index d7a735033..598815c8f 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -145,6 +145,7 @@ class OpenLPSongImport(SongImport): else: song_props['media_files'] = relation(OldMediaFile, backref='songs', + foreign_keys=[source_media_files_table.c.song_id], primaryjoin=source_songs_table.c.id == \ source_media_files_table.c.song_id) try: From 5804dade748154574e775035ca6a5483983f84e5 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 4 Dec 2011 14:42:39 +0000 Subject: [PATCH 07/26] Reduce recent file list duplication (Bug #892668) --- openlp/core/ui/mainwindow.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9d546629b..b0640513a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1312,7 +1312,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): settings.value(u'preview splitter geometry').toByteArray()) self.controlSplitter.restoreState( settings.value(u'mainwindow splitter geometry').toByteArray()) - settings.endGroup() def saveSettings(self): @@ -1388,6 +1387,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files', QtCore.QVariant(20)).toInt()[0] if filename: + # Add some cleanup to reduce duplication in the recent file list + filename = os.path.abspath(filename) + # abspath() only capitalises the drive letter if it wasn't provided + # in the given filename which then causes duplication. + if filename[1:3] == ':\\': + filename = filename[0].upper() + filename[1:] position = self.recentFiles.indexOf(filename) if position != -1: self.recentFiles.removeAt(position) From 06570a9941f89279f9252516cccccdd11d545814 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 4 Dec 2011 22:50:13 +0200 Subject: [PATCH 08/26] Fixed a minor bug where if you imported 2 OpenLP 2.0 databases in the same OpenLP session whose schemas were different, you'd get an error. --- openlp/plugins/songs/lib/olpimport.py | 74 +++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 598815c8f..7187950b7 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -30,7 +30,7 @@ song databases into the current installation database. """ import logging -from sqlalchemy import create_engine, MetaData +from sqlalchemy import create_engine, MetaData, Table from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \ sessionmaker from sqlalchemy.orm.exc import UnmappedClassError @@ -44,41 +44,6 @@ from songimport import SongImport log = logging.getLogger(__name__) -class OldAuthor(BaseModel): - """ - Author model - """ - pass - - -class OldBook(BaseModel): - """ - Book model - """ - pass - - -class OldMediaFile(BaseModel): - """ - MediaFile model - """ - pass - - -class OldSong(BaseModel): - """ - Song model - """ - pass - - -class OldTopic(BaseModel): - """ - Topic model - """ - pass - - class OpenLPSongImport(SongImport): """ The :class:`OpenLPSongImport` class provides OpenLP with the ability to @@ -101,6 +66,41 @@ class OpenLPSongImport(SongImport): """ Run the import for an OpenLP version 2 song database. """ + class OldAuthor(BaseModel): + """ + Author model + """ + pass + + + class OldBook(BaseModel): + """ + Book model + """ + pass + + + class OldMediaFile(BaseModel): + """ + MediaFile model + """ + pass + + + class OldSong(BaseModel): + """ + Song model + """ + pass + + + class OldTopic(BaseModel): + """ + Topic model + """ + pass + + if not self.importSource.endswith(u'.sqlite'): self.logError(self.importSource, translate('SongsPlugin.OpenLPSongImport', @@ -138,7 +138,7 @@ class OpenLPSongImport(SongImport): secondary=source_songs_topics_table) } if has_media_files: - if source_media_files_songs_table is not None: + if isinstance(source_media_files_songs_table, Table): song_props['media_files'] = relation(OldMediaFile, backref='songs', secondary=source_media_files_songs_table) From a54e7ff709c6863a3de684760ee267510f114e98 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sun, 4 Dec 2011 20:57:58 +0000 Subject: [PATCH 09/26] Fix non-ascii service filename loading --- openlp/core/ui/mainwindow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b0640513a..663f6c75a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -720,7 +720,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): args = [] for a in self.arguments: args.extend([a]) - self.serviceManagerContents.loadFile(unicode(args[0])) + self.serviceManagerContents.loadFile(unicode(args[0], + sys.getfilesystemencoding())) elif QtCore.QSettings().value( self.generalSettingsSection + u'/auto open', QtCore.QVariant(False)).toBool(): From 04d7669948400497e3b5e067893affaa63c14586 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 5 Dec 2011 21:40:56 +0000 Subject: [PATCH 10/26] Fix non-ascii file check on Macs --- openlp/core/ui/mainwindow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 663f6c75a..0974f53fb 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -720,8 +720,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): args = [] for a in self.arguments: args.extend([a]) - self.serviceManagerContents.loadFile(unicode(args[0], - sys.getfilesystemencoding())) + filename = args[0] + if not isinstance(filename, unicode): + filename = unicode(filename, sys.getfilesystemencoding()) + self.serviceManagerContents.loadFile(filename) elif QtCore.QSettings().value( self.generalSettingsSection + u'/auto open', QtCore.QVariant(False)).toBool(): From 1830cfbe9e1192bac2925bc7544807f85323a9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 6 Dec 2011 23:25:04 +0200 Subject: [PATCH 11/26] Ensure that action category names are unicode, to prevent warnings on comparison. --- openlp/core/utils/actions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 86ee69a48..26a0c48e8 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -149,6 +149,8 @@ class CategoryList(object): return self.__next__() def has_key(self, key): + if key != None and not isinstance(key, unicode): + key = unicode(key) for category in self.categories: if category.name == key: return True @@ -164,6 +166,8 @@ class CategoryList(object): self.add(name, weight) def add(self, name, weight=0, actions=None): + if name != None and not isinstance(name, unicode): + name = unicode(name) category = ActionCategory(name, weight) if actions: for action in actions: @@ -270,6 +274,8 @@ class ActionList(object): ``weight`` The category's weight (int). """ + if name != None and not isinstance(name, unicode): + name = unicode(name) if name in self.categories: # Only change the weight and resort the categories again. for category in self.categories: From b5dfba86fb42e7a4d56c98cba8e111ff0206fd61 Mon Sep 17 00:00:00 2001 From: rimach Date: Tue, 6 Dec 2011 22:42:34 +0100 Subject: [PATCH 12/26] bugfixing --- openlp/core/ui/media/mediacontroller.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index c4e3e7fa9..b58afeb1e 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -311,8 +311,13 @@ class MediaController(object): isValid = self.check_file_type(controller, display) display.override[u'theme'] = u'' display.override[u'video'] = True - controller.media_info.start_time = display.serviceItem.start_time - controller.media_info.end_time = display.serviceItem.end_time + if controller.media_info.is_background: + # ignore start/end time + controller.media_info.start_time = 0 + controller.media_info.end_time = 0 + else: + controller.media_info.start_time = display.serviceItem.start_time + controller.media_info.end_time = display.serviceItem.end_time elif controller.previewDisplay: display = controller.previewDisplay isValid = self.check_file_type(controller, display) From ef3e3252e77e3e329d89bdac90b8ae88e428982f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Wed, 7 Dec 2011 00:37:56 +0200 Subject: [PATCH 13/26] Comparison to None is discouraged --- openlp/core/utils/actions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 26a0c48e8..37c2676ac 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -149,7 +149,7 @@ class CategoryList(object): return self.__next__() def has_key(self, key): - if key != None and not isinstance(key, unicode): + if key and not isinstance(key, unicode): key = unicode(key) for category in self.categories: if category.name == key: @@ -166,7 +166,7 @@ class CategoryList(object): self.add(name, weight) def add(self, name, weight=0, actions=None): - if name != None and not isinstance(name, unicode): + if name and not isinstance(name, unicode): name = unicode(name) category = ActionCategory(name, weight) if actions: @@ -274,7 +274,7 @@ class ActionList(object): ``weight`` The category's weight (int). """ - if name != None and not isinstance(name, unicode): + if name and not isinstance(name, unicode): name = unicode(name) if name in self.categories: # Only change the weight and resort the categories again. From 66c183a6b8ee84f63de92a83680887a85cb4e699 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 7 Dec 2011 21:41:19 +0100 Subject: [PATCH 14/26] break instead of continue --- openlp/core/lib/pluginmanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index e29176386..b124dce9e 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -90,7 +90,7 @@ class PluginManager(object): thisdepth = len(path.split(os.sep)) if thisdepth - startdepth > 2: # skip anything lower down - continue + break modulename = os.path.splitext(path)[0] prefix = os.path.commonprefix([self.basepath, path]) # hack off the plugin base path From 1c79b2846123ab47b8c19429d433f749a78ecd5f Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Wed, 7 Dec 2011 21:56:06 +0000 Subject: [PATCH 15/26] Workaround justify and outline alignment problems --- openlp/core/lib/htmlbuilder.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 9bce2bcac..a9ef1a38b 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -85,6 +85,7 @@ sup { From c36a13d0a8e85b3c6a17b7f285c0ee503d597923 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Thu, 8 Dec 2011 19:49:43 +0000 Subject: [PATCH 22/26] Remove webkit version in js --- openlp/core/lib/htmlbuilder.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index fba1a25fa..29b8c3335 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -85,7 +85,6 @@ sup {