diff --git a/copyright.txt b/copyright.txt index df5563844..b8385cc89 100644 --- a/copyright.txt +++ b/copyright.txt @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp.pyw b/openlp.pyw index 64ffb3321..cc58c6a21 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -5,8 +5,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/__init__.py b/openlp/__init__.py index 5f7608770..c0e8a73dc 100644 --- a/openlp/__init__.py +++ b/openlp/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 82a30b19f..b6efd5595 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index e627b1ad8..150ad2ea6 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -80,6 +80,9 @@ def get_text_file_string(text_file): content_string = 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): diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 86e0a0a30..2e7757324 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -358,10 +358,17 @@ class Manager(object): def delete_all_objects(self, object_class, filter_clause=None): """ - Delete all object records + Delete all object records. + This method should only be used for simple tables and not ones with + relationships. The relationships are not deleted from the database and + this will lead to database corruptions. ``object_class`` The type of object to delete + + ``filter_clause`` + The filter governing selection of objects to return. Defaults to + None. """ try: query = self.session.query(object_class) diff --git a/openlp/core/lib/dockwidget.py b/openlp/core/lib/dockwidget.py index 8c942171c..4f74784ad 100644 --- a/openlp/core/lib/dockwidget.py +++ b/openlp/core/lib/dockwidget.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 14b6126bc..e3914d98a 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -115,8 +115,12 @@ class EventReceiver(QtCore.QObject): ``slidecontroller_live_stop_loop`` Stop the loop on the main display. + **Servicemanager related signals** + ``servicemanager_new_service`` + A new service is being loaded or created. + ``servicemanager_previous_item`` Display the previous item in the service. diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index ea5547f27..bb5f1e716 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -149,11 +149,17 @@ class FormattingTags(object): tags = [] for tag in FormattingTags.html_expands: if not tag[u'protected'] and not tag.get(u'temporary'): - tags.append(tag) - # Remove key 'temporary' from tags. It is not needed to be saved. - for tag in tags: - if u'temporary' in tag: - del tag[u'temporary'] + # Using dict ensures that copy is made and encoding of values + # a little later does not affect tags in the original list + tags.append(dict(tag)) + tag = tags[-1] + # 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. QtCore.QSettings().setValue(u'displayTags/html_tags', QtCore.QVariant(cPickle.dumps(tags) if tags else u'')) @@ -171,9 +177,13 @@ class FormattingTags(object): user_expands = QtCore.QSettings().value(u'displayTags/html_tags', QtCore.QVariant(u'')).toString() # cPickle only accepts str not unicode strings - user_expands_string = str(unicode(user_expands).encode(u'utf8')) + user_expands_string = str(user_expands) if user_expands_string: user_tags = cPickle.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) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index e4cdecd72..dbdc1d104 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -129,10 +129,10 @@ sup { var match = /-webkit-text-fill-color:[^;\"]+/gi; if(timer != null) clearTimeout(timer); - /* - QtWebkit bug with outlines and justify causing outline alignment - problems. (Bug 859950) Surround each word with a to workaround, - but only in this scenario. + /* + QtWebkit bug with outlines and justify causing outline alignment + problems. (Bug 859950) Surround each word with a to workaround, + but only in this scenario. */ var txt = document.getElementById('lyricsmain'); if(window.getComputedStyle(txt).textAlign == 'justify'){ @@ -141,7 +141,7 @@ sup { txt = outline; if(window.getComputedStyle(txt).webkitTextStrokeWidth != '0px'){ newtext = newtext.replace(/(\s| )+(?![^<]*>)/g, - function(match) { + function(match) { return '' + match + ''; }); newtext = '' + newtext + ''; @@ -288,6 +288,9 @@ def build_background_css(item, width, height): background = u'background-color: black' if theme: if theme.background_type == \ + BackgroundType.to_string(BackgroundType.Transparent): + background = u'' + elif theme.background_type == \ BackgroundType.to_string(BackgroundType.Solid): background = u'background-color: %s' % theme.background_color else: diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 0dcc2246b..8fa2127ad 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py index 31be1f5be..67fa45f74 100644 --- a/openlp/core/lib/listwidgetwithdnd.py +++ b/openlp/core/lib/listwidgetwithdnd.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 1bddb2d93..d7b15a0cb 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -35,6 +35,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsManager, OpenLPToolbar, ServiceItem, \ StringContent, build_icon, translate, Receiver, ListWidgetWithDnD +from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings, context_menu_action, \ context_menu_separator, critical_error_message_box @@ -301,6 +302,40 @@ class MediaManagerItem(QtGui.QWidget): QtCore.SIGNAL('customContextMenuRequested(QPoint)'), self.contextMenu) + def addSearchToToolBar(self): + """ + Creates a search field with button and related signal handling. + """ + self.searchWidget = QtGui.QWidget(self) + self.searchWidget.setObjectName(u'searchWidget') + self.searchLayout = QtGui.QVBoxLayout(self.searchWidget) + self.searchLayout.setObjectName(u'searchLayout') + self.searchTextLayout = QtGui.QFormLayout() + self.searchTextLayout.setObjectName(u'searchTextLayout') + self.searchTextLabel = QtGui.QLabel(self.searchWidget) + self.searchTextLabel.setObjectName(u'searchTextLabel') + self.searchTextEdit = SearchEdit(self.searchWidget) + self.searchTextEdit.setObjectName(u'searchTextEdit') + self.searchTextLabel.setBuddy(self.searchTextEdit) + self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit) + self.searchLayout.addLayout(self.searchTextLayout) + self.searchButtonLayout = QtGui.QHBoxLayout() + self.searchButtonLayout.setObjectName(u'searchButtonLayout') + self.searchButtonLayout.addStretch() + self.searchTextButton = QtGui.QPushButton(self.searchWidget) + self.searchTextButton.setObjectName(u'searchTextButton') + self.searchButtonLayout.addWidget(self.searchTextButton) + self.searchLayout.addLayout(self.searchButtonLayout) + self.pageLayout.addWidget(self.searchWidget) + # Signals and slots + QtCore.QObject.connect(self.searchTextEdit, + QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick) + QtCore.QObject.connect(self.searchTextButton, + QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) + QtCore.QObject.connect(self.searchTextEdit, + QtCore.SIGNAL(u'textChanged(const QString&)'), + self.onSearchTextEditChanged) + def addCustomContextActions(self): """ Implement this method in your descendent media manager item to diff --git a/openlp/core/lib/mediaplayer.py b/openlp/core/lib/mediaplayer.py index 9a86f708b..e4c8dc88f 100644 --- a/openlp/core/lib/mediaplayer.py +++ b/openlp/core/lib/mediaplayer.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 624ce2083..f3bfb68c6 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index d63a37dde..80160911d 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 503c60b04..135bb9078 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index c172ba21d..c212dcc24 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index b12a27f1d..9878e1f24 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -119,6 +119,7 @@ class ServiceItem(object): self.image_border = u'#000000' self.background_audio = [] self.theme_overwritten = False + self.temporary_edit = False self._new_item() def _new_item(self): @@ -365,6 +366,7 @@ class ServiceItem(object): """ self._uuid = other._uuid self.notes = other.notes + self.temporary_edit = other.temporary_edit # Copy theme over if present. if other.theme is not None: self.theme = other.theme diff --git a/openlp/core/lib/settingsmanager.py b/openlp/core/lib/settingsmanager.py index 9bcbf2f07..c21b58a45 100644 --- a/openlp/core/lib/settingsmanager.py +++ b/openlp/core/lib/settingsmanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index f36f9f561..aaa1e5af4 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 25e4e24ae..38077a590 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 34a3b9d98..486f89b18 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -100,6 +100,7 @@ class BackgroundType(object): Solid = 0 Gradient = 1 Image = 2 + Transparent = 3 @staticmethod def to_string(background_type): @@ -112,6 +113,8 @@ class BackgroundType(object): return u'gradient' elif background_type == BackgroundType.Image: return u'image' + elif background_type == BackgroundType.Transparent: + return u'transparent' @staticmethod def from_string(type_string): @@ -124,6 +127,8 @@ class BackgroundType(object): return BackgroundType.Gradient elif type_string == u'image': return BackgroundType.Image + elif type_string == u'transparent': + return BackgroundType.Transparent class BackgroundGradientType(object): @@ -246,7 +251,7 @@ class ThemeXML(object): Add a transparent background. """ background = self.theme_xml.createElement(u'background') - background.setAttribute(u'mode', u'transparent') + background.setAttribute(u'type', u'transparent') self.theme.appendChild(background) def add_background_solid(self, bkcolor): @@ -487,25 +492,25 @@ class ThemeXML(object): return xml_iter = theme_xml.getiterator() for element in xml_iter: - parent = element.getparent() master = u'' + if element.tag == u'background': + if element.attrib: + for attr in element.attrib: + self._create_attr(element.tag, attr, \ + element.attrib[attr]) + parent = element.getparent() if parent is not None: - if element.getparent().tag == u'font': - master = element.getparent().tag + u'_' + \ - element.getparent().attrib[u'type'] + if parent.tag == u'font': + master = parent.tag + u'_' + parent.attrib[u'type'] # set up Outline and Shadow Tags and move to font_main - if element.getparent().tag == u'display': + if parent.tag == u'display': if element.tag.startswith(u'shadow') or \ element.tag.startswith(u'outline'): self._create_attr(u'font_main', element.tag, element.text) - master = element.getparent().tag - if element.getparent().tag == u'background': - master = element.getparent().tag - if element.getparent().attrib: - for attr in element.getparent().attrib: - self._create_attr(master, attr, \ - element.getparent().attrib[attr]) + master = parent.tag + if parent.tag == u'background': + master = parent.tag if master: self._create_attr(master, element.tag, element.text) if element.attrib: @@ -599,9 +604,13 @@ class ThemeXML(object): self.background_start_color, self.background_end_color, self.background_direction) - else: + elif self.background_type == \ + BackgroundType.to_string(BackgroundType.Image): filename = os.path.split(self.background_filename)[1] self.add_background_image(filename, self.background_border_color) + elif self.background_type == \ + BackgroundType.to_string(BackgroundType.Transparent): + self.add_background_transparent() self.add_font(self.font_main_name, self.font_main_color, self.font_main_size, diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index cf550d875..1418b501a 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 756df36c3..72bdd8b0c 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/theme/__init__.py b/openlp/core/theme/__init__.py index 44a937608..76223d78a 100644 --- a/openlp/core/theme/__init__.py +++ b/openlp/core/theme/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/theme/theme.py b/openlp/core/theme/theme.py index 48e364dbd..90ca6cf6c 100644 --- a/openlp/core/theme/theme.py +++ b/openlp/core/theme/theme.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index a24d357f0..e9c593337 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index 8216d3e7a..5032f0d40 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -126,7 +126,8 @@ class Ui_AboutDialog(object): u'Tim "TRB143" Bentley (Fedora and Android)', u'Matthias "matthub" Hub (Mac OS X)', u'Stevan "ElderP" Pettit (Windows)', - u'Raoul "superfly" Snyman (Ubuntu)'] + u'Raoul "superfly" Snyman (Ubuntu)', + u'Garrett "floft" Wilson (Arch Linux)'] translators = { u'af': [u'Johan "nuvolari" Mynhardt'], u'de': [u'Patrick "madmuffin" Br\xfcckner', @@ -226,8 +227,8 @@ class Ui_AboutDialog(object): self.aboutNotebook.indexOf(self.creditsTab), translate('OpenLP.AboutForm', 'Credits')) copyright = unicode(translate('OpenLP.AboutForm', - 'Copyright \xa9 2004-2011 %s\n' - 'Portions copyright \xa9 2004-2011 %s')) % (u'Raoul Snyman', + 'Copyright \xa9 2004-2012 %s\n' + 'Portions copyright \xa9 2004-2012 %s')) % (u'Raoul Snyman', u'Tim Bentley, Jonathan Corwin, Michael Gorven, Gerald Britton, ' u'Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin K\xf6hler, ' u'Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias ' diff --git a/openlp/core/ui/aboutform.py b/openlp/core/ui/aboutform.py index 4e031656c..e2ccbc3c3 100644 --- a/openlp/core/ui/aboutform.py +++ b/openlp/core/ui/aboutform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 43e2a9915..045d38a7e 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -29,7 +29,7 @@ The :mod:`advancedtab` provides an advanced settings facility. """ from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate, build_icon +from openlp.core.lib import SettingsTab, translate, build_icon, Receiver from openlp.core.lib.ui import UiStrings from openlp.core.utils import get_images_filter @@ -42,6 +42,7 @@ class AdvancedTab(SettingsTab): """ Initialise the settings tab """ + self.display_changed = False advancedTranslated = translate('OpenLP.AdvancedTab', 'Advanced') self.default_image = u':/graphics/openlp-splash-screen.png' self.default_color = u'#ffffff' @@ -122,6 +123,14 @@ class AdvancedTab(SettingsTab): self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox') self.hideMouseLayout.addWidget(self.hideMouseCheckBox) self.rightLayout.addWidget(self.hideMouseGroupBox) + self.x11GroupBox = QtGui.QGroupBox(self.leftColumn) + self.x11GroupBox.setObjectName(u'x11GroupBox') + self.x11Layout = QtGui.QVBoxLayout(self.x11GroupBox) + self.x11Layout.setObjectName(u'x11Layout') + self.x11BypassCheckBox = QtGui.QCheckBox(self.x11GroupBox) + self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox') + self.x11Layout.addWidget(self.x11BypassCheckBox) + self.rightLayout.addWidget(self.x11GroupBox) self.rightLayout.addStretch() QtCore.QObject.connect(self.defaultColorButton, @@ -130,6 +139,8 @@ class AdvancedTab(SettingsTab): QtCore.SIGNAL(u'pressed()'), self.onDefaultBrowseButtonPressed) QtCore.QObject.connect(self.defaultRevertButton, QtCore.SIGNAL(u'pressed()'), self.onDefaultRevertButtonPressed) + QtCore.QObject.connect(self.x11BypassCheckBox, + QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled) def retranslateUi(self): """ @@ -167,6 +178,10 @@ class AdvancedTab(SettingsTab): 'Browse for an image file to display.')) self.defaultRevertButton.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.')) + self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', + 'X11')) + self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab', + 'Bypass X11 Window Manager')) def load(self): """ @@ -198,6 +213,8 @@ class AdvancedTab(SettingsTab): QtCore.QVariant(True)).toBool()) self.hideMouseCheckBox.setChecked( settings.value(u'hide mouse', QtCore.QVariant(False)).toBool()) + self.x11BypassCheckBox.setChecked( + settings.value(u'x11 bypass wm', QtCore.QVariant(True)).toBool()) self.default_color = settings.value(u'default color', QtCore.QVariant(u'#ffffff')).toString() self.defaultFileEdit.setText(settings.value(u'default image', @@ -227,9 +244,14 @@ class AdvancedTab(SettingsTab): QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked())) settings.setValue(u'hide mouse', QtCore.QVariant(self.hideMouseCheckBox.isChecked())) + settings.setValue(u'x11 bypass wm', + QtCore.QVariant(self.x11BypassCheckBox.isChecked())) settings.setValue(u'default color', self.default_color) settings.setValue(u'default image', self.defaultFileEdit.text()) settings.endGroup() + if self.display_changed: + Receiver.send_message(u'config_screen_changed') + self.display_changed = False def onDefaultColorButtonPressed(self): new_color = QtGui.QColorDialog.getColor( @@ -252,3 +274,12 @@ class AdvancedTab(SettingsTab): def onDefaultRevertButtonPressed(self): self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png') self.defaultFileEdit.setFocus() + + def onX11BypassCheckBoxToggled(self, checked): + """ + Toggle X11 bypass flag on maindisplay depending on check box state. + + ``checked`` + The state of the check box (boolean). + """ + self.display_changed = True diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 6ed45c5d8..26f90e11f 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 0cda4bd60..d2469c092 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -32,7 +32,7 @@ import platform import sqlalchemy import BeautifulSoup from lxml import etree -from PyQt4 import Qt, QtCore, QtGui +from PyQt4 import Qt, QtCore, QtGui, QtWebKit try: from PyQt4.phonon import Phonon @@ -77,6 +77,11 @@ try: UNO_VERSION = node.getByName(u'ooSetupVersion') except ImportError: UNO_VERSION = u'-' +try: + WEBKIT_VERSION = QtWebKit.qWebKitVersion() +except AttributeError: + WEBKIT_VERSION = u'-' + from openlp.core.lib import translate, SettingsManager from openlp.core.lib.ui import UiStrings @@ -111,6 +116,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): u'Qt4: %s\n' % Qt.qVersion() + \ u'Phonon: %s\n' % PHONON_VERSION + \ u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \ + u'QtWebkit: %s\n' % WEBKIT_VERSION + \ u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \ u'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \ u'BeautifulSoup: %s\n' % BeautifulSoup.__version__ + \ diff --git a/openlp/core/ui/filerenamedialog.py b/openlp/core/ui/filerenamedialog.py index 6611a9df7..4822d4751 100644 --- a/openlp/core/ui/filerenamedialog.py +++ b/openlp/core/ui/filerenamedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -41,7 +41,7 @@ class Ui_FileRenameDialog(object): self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) self.fileNameEdit = QtGui.QLineEdit(fileRenameDialog) self.fileNameEdit.setValidator(QtGui.QRegExpValidator( - QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self)) + QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self)) self.fileNameEdit.setObjectName(u'fileNameEdit') self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.buttonBox = create_accept_reject_button_box(fileRenameDialog, True) diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index 0bdbdf892..3396d68cb 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 9a5a2ea9d..abee968f9 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -29,6 +29,7 @@ import io import logging import os import sys +import time import urllib import urllib2 from tempfile import gettempdir @@ -43,6 +44,29 @@ from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage log = logging.getLogger(__name__) +class ThemeScreenshotThread(QtCore.QThread): + """ + This thread downloads the theme screenshots. + """ + def __init__(self, parent): + QtCore.QThread.__init__(self, parent) + + def run(self): + themes = self.parent().config.get(u'themes', u'files') + themes = themes.split(u',') + config = self.parent().config + for theme in themes: + title = config.get(u'theme_%s' % theme, u'title') + 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(gettempdir(), u'openlp', screenshot)) + item = QtGui.QListWidgetItem(title, self.parent().themesListWidget) + item.setData(QtCore.Qt.UserRole, QtCore.QVariant(filename)) + item.setCheckState(QtCore.Qt.Unchecked) + item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) + + class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ This is the Theme Import Wizard, which allows easy creation and editing of @@ -125,21 +149,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): item.setCheckState(0, QtCore.Qt.Unchecked) item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) self.biblesTreeWidget.expandAll() - themes = self.config.get(u'themes', u'files') - themes = themes.split(u',') - for theme in themes: - title = self.config.get(u'theme_%s' % theme, u'title') - filename = self.config.get(u'theme_%s' % theme, u'filename') - screenshot = self.config.get(u'theme_%s' % theme, u'screenshot') - urllib.urlretrieve(u'%s%s' % (self.web, screenshot), - os.path.join(gettempdir(), u'openlp', screenshot)) - item = QtGui.QListWidgetItem(title, self.themesListWidget) - item.setData(QtCore.Qt.UserRole, - QtCore.QVariant(filename)) - item.setIcon(build_icon( - os.path.join(gettempdir(), u'openlp', screenshot))) - item.setCheckState(QtCore.Qt.Unchecked) - item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) + # Download the theme screenshots. + self.themeScreenshotThread = ThemeScreenshotThread(self) + self.themeScreenshotThread.start() Receiver.send_message(u'cursor_normal') def nextId(self): @@ -156,6 +168,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): return -1 elif self.currentId() == FirstTimePage.NoInternet: return FirstTimePage.Progress + elif self.currentId() == FirstTimePage.Themes: + Receiver.send_message(u'cursor_busy') + while not self.themeScreenshotThread.isFinished(): + time.sleep(0.1) + # Build the screenshot icons, as this can not be done in the thread. + self._buildThemeScreenshots() + Receiver.send_message(u'cursor_normal') + return FirstTimePage.Defaults else: return self.currentId() + 1 @@ -172,7 +192,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.hasRunWizard: self.noInternetLabel.setText(self.noInternetText) else: - self.noInternetLabel.setText(self.noInternetText + + self.noInternetLabel.setText(self.noInternetText + self.cancelWizardText) elif pageId == FirstTimePage.Defaults: self.themeComboBox.clear() @@ -264,6 +284,23 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.downloadCanceled: os.remove(fpath) + def _buildThemeScreenshots(self): + """ + This method builds the theme screenshots' icons for all items in the + ``self.themesListWidget``. + """ + themes = self.config.get(u'themes', u'files') + themes = themes.split(u',') + for theme in themes: + filename = self.config.get(u'theme_%s' % theme, u'filename') + screenshot = self.config.get(u'theme_%s' % theme, u'screenshot') + for index in xrange(self.themesListWidget.count()): + item = self.themesListWidget.item(index) + if item.data(QtCore.Qt.UserRole) == QtCore.QVariant(filename): + break + item.setIcon(build_icon( + os.path.join(gettempdir(), u'openlp', screenshot))) + def _getFileSize(self, url): site = urllib.urlopen(url) meta = site.info() @@ -273,7 +310,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): increment = (count * block_size) - self.previous_size self._incrementProgressBar(None, increment) self.previous_size = count * block_size - + def _incrementProgressBar(self, status_text, increment=1): """ Update the wizard progress page. @@ -421,6 +458,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.displayComboBox.currentIndex() != -1: QtCore.QSettings().setValue(u'General/monitor', QtCore.QVariant(self.displayComboBox.currentIndex())) + self.screens.set_current_display( + self.displayComboBox.currentIndex()) # Set Global Theme if self.themeComboBox.currentIndex() != -1: QtCore.QSettings().setValue(u'themes/global theme', diff --git a/openlp/core/ui/firsttimelanguagedialog.py b/openlp/core/ui/firsttimelanguagedialog.py index 172fd3e0f..b021c9d8e 100644 --- a/openlp/core/ui/firsttimelanguagedialog.py +++ b/openlp/core/ui/firsttimelanguagedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py index dcde212eb..3ffbc1b00 100644 --- a/openlp/core/ui/firsttimelanguageform.py +++ b/openlp/core/ui/firsttimelanguageform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 0f152a396..e402134c6 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/formattingtagdialog.py b/openlp/core/ui/formattingtagdialog.py index 186f4739b..b73816635 100644 --- a/openlp/core/ui/formattingtagdialog.py +++ b/openlp/core/ui/formattingtagdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index e7435e5b7..d99758476 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index be02b3caa..d86c122b7 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index e439b1db1..8a43ccc36 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -28,13 +28,16 @@ The :mod:`maindisplay` module provides the functionality to display screens and play multimedia within OpenLP. """ +import cgi import logging +import os +import sys from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL from PyQt4.phonon import Phonon from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ - translate, PluginManager + translate, PluginManager, expand_tags from openlp.core.ui import HideMode, ScreenList, AlertLocation @@ -45,7 +48,7 @@ log = logging.getLogger(__name__) class Display(QtGui.QGraphicsView): """ - This is a general display screen class. Here the general display settings + This is a general display screen class. Here the general display settings will done. It will be used as specialized classes by Main Display and Preview display. """ @@ -60,13 +63,18 @@ class Display(QtGui.QGraphicsView): self.controller = controller self.screen = {} self.plugins = PluginManager.get_instance().plugins - self.setViewport(QtOpenGL.QGLWidget()) + # FIXME: On Mac OS X (tested on 10.7) the display screen is corrupt with + # OpenGL. Only white blank screen is shown on the 2nd monitor all the + # time. We need to investigate more how to use OpenGL properly on Mac OS + # X. + if sys.platform != 'darwin': + self.setViewport(QtOpenGL.QGLWidget()) def setup(self): """ Set up and build the screen base """ - log.debug(u'Start Display base setup (live = %s)' % self.isLive) + log.debug(u'Start Display base setup (live = %s)' % self.isLive) self.setGeometry(self.screen[u'size']) log.debug(u'Setup webView') self.webView = QtWebKit.QWebView(self) @@ -74,6 +82,10 @@ class Display(QtGui.QGraphicsView): self.screen[u'size'].width(), self.screen[u'size'].height()) self.webView.settings().setAttribute( QtWebKit.QWebSettings.PluginsEnabled, True) + palette = self.webView.palette() + palette.setBrush(QtGui.QPalette.Base, QtCore.Qt.transparent) + self.webView.page().setPalette(palette) + self.webView.setAttribute(QtCore.Qt.WA_OpaquePaintEvent, False) self.page = self.webView.page() self.frame = self.page.mainFrame() if self.isLive and log.getEffectiveLevel() == logging.DEBUG: @@ -120,10 +132,19 @@ class MainDisplay(Display): self.audioPlayer = None self.firstTime = True self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') - self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | - QtCore.Qt.WindowStaysOnTopHint | - QtCore.Qt.X11BypassWindowManagerHint) + windowFlags = QtCore.Qt.FramelessWindowHint | QtCore.Qt.Tool | \ + QtCore.Qt.WindowStaysOnTopHint + if QtCore.QSettings().value(u'advanced/x11 bypass wm', + QtCore.QVariant(True)).toBool(): + windowFlags = windowFlags | QtCore.Qt.X11BypassWindowManagerHint + # FIXME: QtCore.Qt.SplashScreen is workaround to make display screen + # stay always on top on Mac OS X. For details see bug 906926. + # It needs more investigation to fix it properly. + if sys.platform == 'darwin': + windowFlags = windowFlags | QtCore.Qt.SplashScreen + self.setWindowFlags(windowFlags) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) + self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) if self.isLive: QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay) @@ -222,16 +243,17 @@ class MainDisplay(Display): The text to be displayed. """ log.debug(u'alert to display') + # First we convert <>& marks to html variants, then apply + # formattingtags, finally we double all backslashes for JavaScript. + text_prepared = expand_tags(cgi.escape(text)) \ + .replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') if self.height() != self.screen[u'size'].height() or \ not self.isVisible(): shrink = True - js = u'show_alert("%s", "%s")' % ( - text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'), - u'top') + js = u'show_alert("%s", "%s")' % (text_prepared, u'top') else: shrink = False - js = u'show_alert("%s", "")' % ( - text.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) + js = u'show_alert("%s", "")' % text_prepared height = self.frame.evaluateJavaScript(js) if shrink: if text: @@ -332,13 +354,7 @@ class MainDisplay(Display): self.setVisible(True) else: self.setVisible(True) - preview = QtGui.QPixmap(self.screen[u'size'].width(), - self.screen[u'size'].height()) - painter = QtGui.QPainter(preview) - painter.setRenderHint(QtGui.QPainter.Antialiasing) - self.frame.render(painter) - painter.end() - return preview + return QtGui.QPixmap.grabWidget(self) def buildHtml(self, serviceItem, image=None): """ @@ -402,6 +418,11 @@ class MainDisplay(Display): Store the images so they can be replaced when required """ log.debug(u'hideDisplay mode = %d', mode) + if self.screens.display_count == 1: + # Only make visible if setting enabled + if not QtCore.QSettings().value(u'general/display on monitor', + QtCore.QVariant(True)).toBool(): + return if mode == HideMode.Screen: self.frame.evaluateJavaScript(u'show_blank("desktop");') self.setVisible(False) @@ -422,6 +443,11 @@ class MainDisplay(Display): Make the stored images None to release memory. """ log.debug(u'showDisplay') + if self.screens.display_count == 1: + # Only make visible if setting enabled + if not QtCore.QSettings().value(u'general/display on monitor', + QtCore.QVariant(True)).toBool(): + return self.frame.evaluateJavaScript('show_blank("show");') if self.isHidden(): self.setVisible(True) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 07c90e62f..3490dfada 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index b58afeb1e..1a4b3a2cd 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -219,6 +219,7 @@ class MediaController(object): # Build the seekSlider. controller.seekSlider = QtGui.QSlider(QtCore.Qt.Horizontal) controller.seekSlider.setMaximum(1000) + controller.seekSlider.setTracking(False) controller.seekSlider.setToolTip(translate( 'OpenLP.SlideController', 'Video position.')) controller.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) @@ -231,6 +232,7 @@ class MediaController(object): controller.volumeSlider.setTickPosition(QtGui.QSlider.TicksAbove) controller.volumeSlider.setMinimum(0) controller.volumeSlider.setMaximum(100) + controller.volumeSlider.setTracking(True) controller.volumeSlider.setToolTip(translate( 'OpenLP.SlideController', 'Audio Volume.')) controller.volumeSlider.setValue(controller.media_info.volume) @@ -242,9 +244,9 @@ class MediaController(object): controller.mediabar.setVisible(False) # Signals QtCore.QObject.connect(controller.seekSlider, - QtCore.SIGNAL(u'sliderMoved(int)'), controller.sendToPlugins) + QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins) QtCore.QObject.connect(controller.volumeSlider, - QtCore.SIGNAL(u'sliderMoved(int)'), controller.sendToPlugins) + QtCore.SIGNAL(u'valueChanged(int)'), controller.sendToPlugins) def setup_special_controls(self, controller, control_panel): """ @@ -316,7 +318,8 @@ class MediaController(object): 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.start_time = \ + display.serviceItem.start_time controller.media_info.end_time = display.serviceItem.end_time elif controller.previewDisplay: display = controller.previewDisplay diff --git a/openlp/core/ui/mediadockmanager.py b/openlp/core/ui/mediadockmanager.py index cc6cc92bc..1b8666cd3 100644 --- a/openlp/core/ui/mediadockmanager.py +++ b/openlp/core/ui/mediadockmanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index 3fc4bf34b..a9a38a9eb 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 6933bd8fc..435181568 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index 8287ef02a..6d39fea55 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 4d1dc71c8..3e650765d 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py index 5b81c8be8..d576f0e58 100644 --- a/openlp/core/ui/screen.py +++ b/openlp/core/ui/screen.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -222,6 +222,21 @@ class ScreenList(object): log.debug(u'reset_current_display') self.set_current_display(self.current[u'number']) + def which_screen(self, window): + """ + Return the screen number that the centre of the passed window is in. + + ``window`` + A QWidget we are finding the location of. + """ + x = window.x() + (window.width() / 2) + y = window.y() + (window.height() / 2) + for screen in self.screen_list: + size = screen[u'size'] + if x >= size.x() and x <= (size.x() + size.width()) \ + and y >= size.y() and y <= (size.y() + size.height()): + return screen[u'number'] + def _load_screen_settings(self): """ Loads the screen size and the monitor number from the settings. diff --git a/openlp/core/ui/serviceitemeditdialog.py b/openlp/core/ui/serviceitemeditdialog.py index d821430b2..362687137 100644 --- a/openlp/core/ui/serviceitemeditdialog.py +++ b/openlp/core/ui/serviceitemeditdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/serviceitemeditform.py b/openlp/core/ui/serviceitemeditform.py index 974133c3d..3541870ba 100644 --- a/openlp/core/ui/serviceitemeditform.py +++ b/openlp/core/ui/serviceitemeditform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 0480cb70b..e23e68ef5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -37,14 +37,13 @@ log = logging.getLogger(__name__) from PyQt4 import QtCore, QtGui from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, \ - ItemCapabilities, SettingsManager, translate + ItemCapabilities, SettingsManager, translate, str_to_bool from openlp.core.lib.theme import ThemeLevel from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ context_menu_action, context_menu_separator, find_and_set_in_combo_box from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm -from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ - split_filename +from openlp.core.utils import AppLocation, delete_file, split_filename from openlp.core.utils.actions import ActionList, CategoryOrder class ServiceManagerList(QtGui.QTreeWidget): @@ -465,6 +464,7 @@ class ServiceManager(QtGui.QWidget): self.setModified(False) QtCore.QSettings(). \ setValue(u'servicemanager/last file',QtCore.QVariant(u'')) + Receiver.send_message(u'servicemanager_new_service') def saveFile(self): """ @@ -595,7 +595,10 @@ class ServiceManager(QtGui.QWidget): self.mainwindow.finishedProgressBar() Receiver.send_message(u'cursor_normal') if success: - shutil.copy(temp_file_name, path_file_name) + try: + shutil.copy(temp_file_name, path_file_name) + except: + return self.saveFileAs() self.mainwindow.addRecentFile(path_file_name) self.setModified(False) try: @@ -635,8 +638,11 @@ class ServiceManager(QtGui.QWidget): try: zip = zipfile.ZipFile(fileName) for zipinfo in zip.infolist(): - ucsfile = file_is_unicode(zipinfo.filename) - if not ucsfile: + try: + ucsfile = zipinfo.filename.decode(u'utf-8') + except UnicodeDecodeError: + log.exception(u'Filename "%s" is not valid UTF-8' % + zipinfo.filename.decode(u'utf-8', u'replace')) critical_error_message_box( message=translate('OpenLP.ServiceManager', 'File is not a valid service.\n' @@ -663,13 +669,14 @@ class ServiceManager(QtGui.QWidget): serviceItem.renderer = self.mainwindow.renderer serviceItem.set_from_service(item, self.servicePath) self.validateItem(serviceItem) - self.loadItem_uuid = 0 + self.load_item_uuid = 0 if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem) # if the item has been processed - if serviceItem._uuid == self.loadItem_uuid: - serviceItem.edit_id = int(self.loadItem_editId) + if serviceItem._uuid == self.load_item_uuid: + serviceItem.edit_id = int(self.load_item_edit_id) + serviceItem.temporary_edit = self.load_item_temporary self.addServiceItem(serviceItem, repaint=False) delete_file(p_file) self.setFileName(fileName) @@ -999,6 +1006,17 @@ class ServiceManager(QtGui.QWidget): painter.drawImage(0, 0, overlay) painter.end() treewidgetitem.setIcon(0, build_icon(icon)) + elif serviceitem.temporary_edit: + icon = QtGui.QImage(serviceitem.icon) + icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, + QtCore.Qt.SmoothTransformation) + overlay = QtGui.QImage(':/general/general_export.png') + overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, + QtCore.Qt.SmoothTransformation) + painter = QtGui.QPainter(icon) + painter.drawImage(40, 0, overlay) + painter.end() + treewidgetitem.setIcon(0, build_icon(icon)) else: treewidgetitem.setIcon(0, serviceitem.iconic_representation) else: @@ -1006,6 +1024,11 @@ class ServiceManager(QtGui.QWidget): build_icon(u':/general/general_delete.png')) treewidgetitem.setText(0, serviceitem.get_display_title()) tips = [] + if serviceitem.temporary_edit: + tips.append(u'%s: %s' % + (unicode(translate('OpenLP.ServiceManager', 'Edit')), + (unicode(translate('OpenLP.ServiceManager', + 'Service copy only'))))) if serviceitem.theme and serviceitem.theme != -1: tips.append(u'%s: %s' % (unicode(translate('OpenLP.ServiceManager', 'Slide theme')), @@ -1127,8 +1150,9 @@ class ServiceManager(QtGui.QWidget): Triggered from plugins to update service items. Save the values as they will be used as part of the service load """ - editId, self.loadItem_uuid = message.split(u':') - self.loadItem_editId = int(editId) + edit_id, self.load_item_uuid, temporary = message.split(u':') + self.load_item_edit_id = int(edit_id) + self.load_item_temporary = str_to_bool(temporary) def replaceServiceItem(self, newItem): """ diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index ddfcb3381..392a6f32d 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 643ab0a6e..8d692de7b 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index b25a3a856..0aa5d44d0 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index a9b9b22cf..eaee35afa 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index 1eccddc95..211946793 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -344,8 +344,11 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): if category.name is None: continue for action in category.actions: - if self.changedActions .has_key(action): + if action in self.changedActions: + old_shortcuts = map(unicode, + map(QtGui.QKeySequence.toString, action.shortcuts())) action.setShortcuts(self.changedActions[action]) + self.action_list.update_shortcut_map(action, old_shortcuts) settings.setValue( action.objectName(), QtCore.QVariant(action.shortcuts())) settings.endGroup() @@ -452,7 +455,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): those shortcuts which are not saved yet but already assigned (as changes are applied when closing the dialog). """ - if self.changedActions.has_key(action): + if action in self.changedActions: return self.changedActions[action] return action.shortcuts() diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index cd4663297..dcdb3fdc7 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -95,7 +95,7 @@ class SlideController(Controller): u'Edit Song', ] self.nextPreviousList = [ - u'Previous Slide', + u'Previous Slide', u'Next Slide' ] self.timer_id = 0 @@ -114,8 +114,8 @@ class SlideController(Controller): self.typeLabel.setText(UiStrings().Live) self.split = 1 self.typePrefix = u'live' - self.keypress_queue = deque() - self.keypress_loop = False + self.keypress_queue = deque() + self.keypress_loop = False else: self.typeLabel.setText(UiStrings().Preview) self.split = 0 @@ -187,7 +187,7 @@ class SlideController(Controller): translate('OpenLP.SlideController', 'Hide'), self.toolbar)) self.blankScreen = shortcut_action(self.hideMenu, u'blankScreen', [QtCore.Qt.Key_Period], self.onBlankDisplay, - u':/slides/slide_blank.png', False, + u':/slides/slide_blank.png', False, unicode(UiStrings().LiveToolbar)) self.blankScreen.setText( translate('OpenLP.SlideController', 'Blank Screen')) @@ -412,6 +412,9 @@ class SlideController(Controller): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), self.receiveSpinDelay) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'slidecontroller_toggle_display'), + self.toggleDisplay) self.toolbar.makeWidgetsInvisible(self.loopList) else: QtCore.QObject.connect(self.previewListWidget, @@ -570,6 +573,21 @@ class SlideController(Controller): self.display.setVisible(False) self.mediaController.video_stop([self]) + def toggleDisplay(self, action): + """ + Toggle the display settings triggered from remote messages. + """ + if action == u'blank' or action == u'hide': + self.onBlankDisplay(True) + elif action == u'theme': + self.onThemeDisplay(True) + elif action == u'desktop': + self.onHideDisplay(True) + elif action == u'show': + self.onBlankDisplay(False) + self.onThemeDisplay(False) + self.onHideDisplay(False) + def servicePrevious(self): """ Live event to select the previous service item from the service manager. @@ -618,8 +636,8 @@ class SlideController(Controller): self.previewSizeChanged() self.previewDisplay.setup() serviceItem = ServiceItem() - self.previewDisplay.webView.setHtml(build_html(serviceItem, - self.previewDisplay.screen, None, self.isLive, None, + self.previewDisplay.webView.setHtml(build_html(serviceItem, + self.previewDisplay.screen, None, self.isLive, None, plugins=PluginManager.get_instance().plugins)) self.mediaController.setup_display(self.previewDisplay) if self.serviceItem: @@ -938,7 +956,8 @@ class SlideController(Controller): display_type = QtCore.QSettings().value( self.parent().generalSettingsSection + u'/screen blank', QtCore.QVariant(u'')).toString() - if not self.display.primary: + if self.screens.which_screen(self.window()) != \ + self.screens.which_screen(self.display): # Order done to handle initial conversion if display_type == u'themed': self.onThemeDisplay(True) @@ -949,7 +968,7 @@ class SlideController(Controller): else: Receiver.send_message(u'live_display_show') else: - Receiver.send_message(u'live_display_hide', HideMode.Screen) + self.liveEscape() def onSlideBlank(self): """ diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index 036daf968..7ab2d9798 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/starttimedialog.py b/openlp/core/ui/starttimedialog.py index 61e4eb662..236795b01 100644 --- a/openlp/core/ui/starttimedialog.py +++ b/openlp/core/ui/starttimedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index 45c0b70b7..61c57e417 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 9ccd91d08..face5938f 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -359,11 +359,15 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.gradientEndButton.setStyleSheet(u'background-color: %s' % self.theme.background_end_color) self.setField(u'background_type', QtCore.QVariant(1)) - else: + elif self.theme.background_type == \ + BackgroundType.to_string(BackgroundType.Image): self.imageColorButton.setStyleSheet(u'background-color: %s' % self.theme.background_border_color) self.imageFileEdit.setText(self.theme.background_filename) self.setField(u'background_type', QtCore.QVariant(2)) + elif self.theme.background_type == \ + BackgroundType.to_string(BackgroundType.Transparent): + self.setField(u'background_type', QtCore.QVariant(3)) if self.theme.background_direction == \ BackgroundGradientType.to_string(BackgroundGradientType.Horizontal): self.setField(u'gradient', QtCore.QVariant(0)) diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py index 56bfe79bb..26346392b 100644 --- a/openlp/core/ui/themelayoutdialog.py +++ b/openlp/core/ui/themelayoutdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py index 57d8bd952..1a28a5397 100644 --- a/openlp/core/ui/themelayoutform.py +++ b/openlp/core/ui/themelayoutform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 596bce5d9..3585e5c97 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -30,6 +30,7 @@ import zipfile import shutil import logging import locale +import re from xml.etree.ElementTree import ElementTree, XML from PyQt4 import QtCore, QtGui @@ -43,8 +44,7 @@ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ context_menu_action, context_menu_separator from openlp.core.theme import Theme from openlp.core.ui import FileRenameForm, ThemeForm -from openlp.core.utils import AppLocation, delete_file, file_is_unicode, \ - get_filesystem_encoding +from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding log = logging.getLogger(__name__) @@ -147,6 +147,7 @@ class ThemeManager(QtGui.QWidget): check_directory_exists(self.thumbPath) self.themeForm.path = self.path self.oldBackgroundImage = None + self.bad_v1_name_chars = re.compile(r'[%+\[\]]') # Last little bits of setting up self.configUpdated() @@ -524,46 +525,50 @@ class ThemeManager(QtGui.QWidget): filexml = None try: zip = zipfile.ZipFile(filename) - themename = None - for file in zip.namelist(): - ucsfile = file_is_unicode(file) - if not ucsfile: - critical_error_message_box( - message=translate('OpenLP.ThemeManager', - 'File is not a valid theme.\n' - 'The content encoding is not UTF-8.')) - continue - osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile)) - theme_dir = None - if osfile.endswith(os.path.sep): - theme_dir = os.path.join(dir, osfile) - check_directory_exists(theme_dir) - else: - fullpath = os.path.join(dir, osfile) - names = osfile.split(os.path.sep) - if len(names) > 1: - # not preview file - if themename is None: - themename = names[0] - if theme_dir is None: - theme_dir = os.path.join(dir, names[0]) - check_directory_exists(theme_dir) - if os.path.splitext(ucsfile)[1].lower() in [u'.xml']: - xml_data = zip.read(file) - xml_data = file_is_unicode(xml_data) - if not xml_data: - break - filexml = self._checkVersionAndConvert(xml_data) - outfile = open(fullpath, u'w') - outfile.write(filexml.encode(u'utf-8')) - else: - outfile = open(fullpath, u'wb') - outfile.write(zip.read(file)) - except (IOError, NameError, zipfile.BadZipfile): - critical_error_message_box( - translate('OpenLP.ThemeManager', 'Validation Error'), - translate('OpenLP.ThemeManager', 'File is not a valid theme.')) + xmlfile = filter(lambda name: + os.path.splitext(name)[1].lower() == u'.xml', zip.namelist()) + if len(xmlfile) != 1: + log.exception(u'Theme contains "%s" XML files' % len(xmlfile)) + raise Exception(u'validation') + xml_tree = ElementTree(element=XML(zip.read(xmlfile[0]))).getroot() + v1_background = xml_tree.find(u'BackgroundType') + if v1_background is not None: + (themename, filexml, outfile) = self.unzipVersion122(dir, zip, + xmlfile[0], xml_tree, v1_background, outfile) + else: + themename = xml_tree.find(u'name').text.strip() + for name in zip.namelist(): + try: + uname = unicode(name, u'utf-8') + except UnicodeDecodeError: + log.exception(u'Theme file contains non utf-8 filename' + u' "%s"' % name.decode(u'utf-8', u'replace')) + raise Exception(u'validation') + uname = unicode(QtCore.QDir.toNativeSeparators(uname)) + splitname = uname.split(os.path.sep) + if splitname[-1] == u'' or len(splitname) == 1: + # is directory or preview file + continue + fullname = os.path.join(dir, uname) + check_directory_exists(os.path.dirname(fullname)) + if os.path.splitext(uname)[1].lower() == u'.xml': + filexml = unicode(zip.read(name), u'utf-8') + outfile = open(fullname, u'w') + outfile.write(filexml.encode(u'utf-8')) + else: + outfile = open(fullname, u'wb') + outfile.write(zip.read(name)) + outfile.close() + except (IOError, zipfile.BadZipfile): log.exception(u'Importing theme from zip failed %s' % filename) + raise Exception(u'validation') + except Exception as info: + if unicode(info) == u'validation': + critical_error_message_box(translate('OpenLP.ThemeManager', + 'Validation Error'), translate('OpenLP.ThemeManager', + 'File is not a valid theme.')) + else: + raise finally: # Close the files, to be able to continue creating the theme. if zip: @@ -584,6 +589,36 @@ class ThemeManager(QtGui.QWidget): log.exception(u'Theme file does not contain XML data %s' % filename) + def unzipVersion122(self, dir, zip, xmlfile, xml_tree, background, outfile): + """ + Unzip openlp.org 1.2x theme file and upgrade the theme xml. When calling + this method, please keep in mind, that some parameters are redundant. + """ + themename = xml_tree.find(u'Name').text.strip() + themename = self.bad_v1_name_chars.sub(u'', themename) + themedir = os.path.join(dir, themename) + check_directory_exists(themedir) + filexml = unicode(zip.read(xmlfile), u'utf-8') + filexml = self._migrateVersion122(filexml) + outfile = open(os.path.join(themedir, themename + u'.xml'), u'w') + outfile.write(filexml.encode(u'utf-8')) + outfile.close() + if background.text.strip() == u'2': + imagename = xml_tree.find(u'BackgroundParameter1').text.strip() + # image file has same extension and is in subfolder + imagefile = filter(lambda name: os.path.splitext(name)[1].lower() + == os.path.splitext(imagename)[1].lower() and name.find(r'/'), + zip.namelist()) + if len(imagefile) >= 1: + outfile = open(os.path.join(themedir, imagename), u'wb') + outfile.write(zip.read(imagefile[0])) + outfile.close() + else: + log.exception(u'Theme file does not contain image file "%s"' % + imagename.decode(u'utf-8', u'replace')) + raise Exception(u'validation') + return (themename, filexml, outfile) + def checkIfThemeExists(self, themeName): """ Check if theme already exists and displays error message @@ -620,7 +655,7 @@ class ThemeManager(QtGui.QWidget): """ name = theme.theme_name theme_pretty_xml = theme.extract_formatted_xml() - log.debug(u'saveTheme %s %s', name, theme_pretty_xml) + log.debug(u'saveTheme %s %s', name, theme_pretty_xml.decode(u'utf-8')) theme_dir = os.path.join(self.path, name) check_directory_exists(theme_dir) theme_file = os.path.join(theme_dir, name + u'.xml') @@ -694,22 +729,6 @@ class ThemeManager(QtGui.QWidget): image = os.path.join(self.path, theme + u'.png') return image - def _checkVersionAndConvert(self, xml_data): - """ - Check if a theme is from OpenLP version 1 - - ``xml_data`` - Theme XML to check the version of - """ - log.debug(u'checkVersion1 ') - theme = xml_data.encode(u'ascii', u'xmlcharrefreplace') - tree = ElementTree(element=XML(theme)).getroot() - # look for old version 1 tags - if tree.find(u'BackgroundType') is None: - return xml_data - else: - return self._migrateVersion122(xml_data) - def _createThemeFromXml(self, themeXml, path): """ Return a theme object using information parsed from XML @@ -774,7 +793,7 @@ class ThemeManager(QtGui.QWidget): """ theme = Theme(xml_data) newtheme = ThemeXML() - newtheme.theme_name = theme.Name + newtheme.theme_name = self.bad_v1_name_chars.sub(u'', theme.Name) if theme.BackgroundType == 0: newtheme.background_type = \ BackgroundType.to_string(BackgroundType.Solid) @@ -794,10 +813,13 @@ class ThemeManager(QtGui.QWidget): unicode(theme.BackgroundParameter1.name()) newtheme.background_end_color = \ unicode(theme.BackgroundParameter2.name()) - else: + elif theme.BackgroundType == 2: newtheme.background_type = \ BackgroundType.to_string(BackgroundType.Image) newtheme.background_filename = unicode(theme.BackgroundParameter1) + elif theme.BackgroundType == 3: + newtheme.background_type = \ + BackgroundType.to_string(BackgroundType.Transparent) newtheme.font_main_name = theme.FontName newtheme.font_main_color = unicode(theme.FontColor.name()) newtheme.font_main_size = theme.FontProportion * 3 diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 572efdf4b..3439ade28 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 1135db274..fc471ded6 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -54,7 +54,7 @@ class Ui_ThemeWizard(object): self.backgroundLabel = QtGui.QLabel(self.backgroundPage) self.backgroundLabel.setObjectName(u'BackgroundLabel') self.backgroundComboBox = QtGui.QComboBox(self.backgroundPage) - self.backgroundComboBox.addItems([u'', u'', u'']) + self.backgroundComboBox.addItems([u'', u'', u'', u'']) self.backgroundComboBox.setObjectName(u'BackgroundComboBox') self.backgroundTypeLayout.addRow(self.backgroundLabel, self.backgroundComboBox) @@ -126,6 +126,12 @@ class Ui_ThemeWizard(object): self.imageLayout.addRow(self.imageLabel, self.imageFileLayout) self.imageLayout.setItem(2, QtGui.QFormLayout.LabelRole, self.spacer) self.backgroundStack.addWidget(self.imageWidget) + self.transparentWidget = QtGui.QWidget(self.backgroundPage) + self.transparentWidget.setObjectName(u'TransparentWidget') + self.transparentLayout = QtGui.QFormLayout(self.transparentWidget) + self.transparentLayout.setMargin(0) + self.transparentLayout.setObjectName(u'TransparentLayout') + self.backgroundStack.addWidget(self.transparentWidget) self.backgroundLayout.addLayout(self.backgroundStack) themeWizard.addPage(self.backgroundPage) # Main Area Page @@ -432,6 +438,8 @@ class Ui_ThemeWizard(object): translate('OpenLP.ThemeWizard', 'Gradient')) self.backgroundComboBox.setItemText( BackgroundType.Image, UiStrings().Image) + self.backgroundComboBox.setItemText(BackgroundType.Transparent, + translate('OpenLP.ThemeWizard', 'Transparent')) self.colorLabel.setText(translate('OpenLP.ThemeWizard', 'Color:')) self.gradientStartLabel.setText( translate(u'OpenLP.ThemeWizard', 'Starting color:')) diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 9d8a106ed..91aa42e43 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -47,7 +47,7 @@ class WizardStrings(object): CCLI = u'CCLI/SongSelect' CSV = u'CSV' EW = u'EasyWorship' - ES = u'EasiSlides' + ES = u'EasySlides' FP = u'Foilpresenter' OL = u'OpenLyrics' OS = u'OpenSong' diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index fbf185474..9fa5bcd77 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -455,26 +455,6 @@ def get_web_page(url, header=None, update_openlp=False): log.debug(page) return page -def file_is_unicode(filename): - """ - Checks if a file is valid unicode and returns the unicode decoded file or - None. - - ``filename`` - File to check is valid unicode. - """ - if not filename: - return None - ucsfile = None - try: - ucsfile = filename.decode(u'utf-8') - except UnicodeDecodeError: - log.exception(u'Filename "%s" is not valid UTF-8' % - filename.decode(u'utf-8', u'replace')) - if not ucsfile: - return None - return ucsfile - def get_uno_command(): """ Returns the UNO command to launch an openoffice.org instance. @@ -507,5 +487,5 @@ from actions import ActionList __all__ = [u'AppLocation', u'get_application_version', u'check_latest_version', u'add_actions', u'get_filesystem_encoding', u'LanguageManager', - u'ActionList', u'get_web_page', u'file_is_unicode', u'get_uno_command', - u'get_uno_instance', u'delete_file', u'clean_filename'] + u'ActionList', u'get_web_page', u'get_uno_command', u'get_uno_instance', + u'delete_file', u'clean_filename'] diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 8b807bf9e..d363f1426 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -188,6 +188,7 @@ class ActionList(object): actions or categories. """ instance = None + shortcut_map = {} def __init__(self): self.categories = CategoryList() @@ -224,17 +225,45 @@ class ActionList(object): self.categories[category].actions.append(action) else: self.categories[category].actions.add(action, weight) - if not category: - # Stop here, as this action is not configurable. - return # Load the shortcut from the config. settings = QtCore.QSettings() settings.beginGroup(u'shortcuts') shortcuts = settings.value(action.objectName(), QtCore.QVariant(action.shortcuts())).toStringList() + settings.endGroup() + if not shortcuts: + action.setShortcuts([]) + return + # We have to do this to ensure that the loaded shortcut list e. g. + # STRG+O (German) is converted to CTRL+O, which is only done when we + # convert the strings in this way (QKeySequence -> QString -> unicode). + shortcuts = map(QtGui.QKeySequence, shortcuts) + shortcuts = map(unicode, map(QtGui.QKeySequence.toString, shortcuts)) + # Check the alternate shortcut first, to avoid problems when the + # alternate shortcut becomes the primary shortcut after removing the + # (initial) primary shortcut due to conflicts. + if len(shortcuts) == 2: + existing_actions = ActionList.shortcut_map.get(shortcuts[1], []) + # Check for conflicts with other actions considering the shortcut + # context. + if self._is_shortcut_available(existing_actions, action): + actions = ActionList.shortcut_map.get(shortcuts[1], []) + actions.append(action) + ActionList.shortcut_map[shortcuts[1]] = actions + else: + shortcuts.remove(shortcuts[1]) + # Check the primary shortcut. + existing_actions = ActionList.shortcut_map.get(shortcuts[0], []) + # Check for conflicts with other actions considering the shortcut + # context. + if self._is_shortcut_available(existing_actions, action): + actions = ActionList.shortcut_map.get(shortcuts[0], []) + actions.append(action) + ActionList.shortcut_map[shortcuts[0]] = actions + else: + shortcuts.remove(shortcuts[0]) action.setShortcuts( [QtGui.QKeySequence(shortcut) for shortcut in shortcuts]) - settings.endGroup() def remove_action(self, action, category=None): """ @@ -242,7 +271,7 @@ class ActionList(object): automatically removed. ``action`` - The QAction object to be removed. + The ``QAction`` object to be removed. ``category`` The name (unicode string) of the category, which contains the @@ -254,6 +283,15 @@ class ActionList(object): # Remove empty categories. if len(self.categories[category].actions) == 0: self.categories.remove(category) + shortcuts = map(unicode, + map(QtGui.QKeySequence.toString, action.shortcuts())) + for shortcut in shortcuts: + # Remove action from the list of actions which are using this + # shortcut. + ActionList.shortcut_map[shortcut].remove(action) + # Remove empty entries. + if not ActionList.shortcut_map[shortcut]: + del ActionList.shortcut_map[shortcut] def add_category(self, name, weight): """ @@ -275,6 +313,60 @@ class ActionList(object): return self.categories.add(name, weight) + def update_shortcut_map(self, action, old_shortcuts): + """ + Remove the action for the given ``old_shortcuts`` from the + ``shortcut_map`` to ensure its up-to-dateness. + + **Note**: The new action's shortcuts **must** be assigned to the given + ``action`` **before** calling this method. + + ``action`` + The action whose shortcuts are supposed to be updated in the + ``shortcut_map``. + + ``old_shortcuts`` + A list of unicode keysequences. + """ + for old_shortcut in old_shortcuts: + # Remove action from the list of actions which are using this + # shortcut. + ActionList.shortcut_map[old_shortcut].remove(action) + # Remove empty entries. + if not ActionList.shortcut_map[old_shortcut]: + del ActionList.shortcut_map[old_shortcut] + new_shortcuts = map(unicode, + map(QtGui.QKeySequence.toString, action.shortcuts())) + # Add the new shortcuts to the map. + for new_shortcut in new_shortcuts: + existing_actions = ActionList.shortcut_map.get(new_shortcut, []) + existing_actions.append(action) + ActionList.shortcut_map[new_shortcut] = existing_actions + + def _is_shortcut_available(self, existing_actions, action): + """ + Checks if the given ``action`` may use its assigned shortcut(s) or not. + Returns ``True`` or ``False. + + ``existing_actions`` + A list of actions which already use a particular shortcut. + + ``action`` + The action which wants to use a particular shortcut. + """ + for existing_action in existing_actions: + if action is existing_action: + continue + if existing_action.parent() is action.parent(): + return False + if existing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, + QtCore.Qt.ApplicationShortcut]: + return False + if action.shortcutContext() in [QtCore.Qt.WindowShortcut, + QtCore.Qt.ApplicationShortcut]: + return False + return True + class CategoryOrder(object): """ diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index 7b57ee2bc..929105ad2 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/__init__.py b/openlp/plugins/__init__.py index 48fe8cb77..63bbf5147 100644 --- a/openlp/plugins/__init__.py +++ b/openlp/plugins/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/__init__.py b/openlp/plugins/alerts/__init__.py index 006db9361..6c511cb8b 100644 --- a/openlp/plugins/alerts/__init__.py +++ b/openlp/plugins/alerts/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index ba2af74e8..e67ef0686 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/forms/__init__.py b/openlp/plugins/alerts/forms/__init__.py index 3b11d7c92..ab18207e3 100644 --- a/openlp/plugins/alerts/forms/__init__.py +++ b/openlp/plugins/alerts/forms/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index e42680165..6cd59f9a2 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index 45d283f28..188914c5d 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/lib/__init__.py b/openlp/plugins/alerts/lib/__init__.py index 780f295a8..f9c6e626d 100644 --- a/openlp/plugins/alerts/lib/__init__.py +++ b/openlp/plugins/alerts/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index e73273fe7..7c92df75e 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 90e06caab..fc7c74ea5 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/alerts/lib/db.py b/openlp/plugins/alerts/lib/db.py index b5c4f8d60..7cc1227e6 100644 --- a/openlp/plugins/alerts/lib/db.py +++ b/openlp/plugins/alerts/lib/db.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/__init__.py b/openlp/plugins/bibles/__init__.py index d468ae0dc..202cd0edd 100644 --- a/openlp/plugins/bibles/__init__.py +++ b/openlp/plugins/bibles/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 68b4d1ce8..2f9a4fd6d 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/forms/__init__.py b/openlp/plugins/bibles/forms/__init__.py index 5b19d9f24..89bfbfff3 100644 --- a/openlp/plugins/bibles/forms/__init__.py +++ b/openlp/plugins/bibles/forms/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 7577e86a3..ee7b5a063 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 322e3219a..7c7f14979 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Jonathan Corwin, Michael # # Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, Armin Köhler, # # Andreas Preikschat, Mattias Põldaru, Christian Richter, Philip Ridout, # # Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # diff --git a/openlp/plugins/bibles/forms/booknamedialog.py b/openlp/plugins/bibles/forms/booknamedialog.py index e9211b3d5..4b67fa826 100644 --- a/openlp/plugins/bibles/forms/booknamedialog.py +++ b/openlp/plugins/bibles/forms/booknamedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Jonathan Corwin, Michael # # Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, # # Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon # # Tibble, Carsten Tinggaard, Frode Woldsund # diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index b07f28bf1..e786d720a 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Jonathan Corwin, Michael # # Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, # # Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon # # Tibble, Carsten Tinggaard, Frode Woldsund # diff --git a/openlp/plugins/bibles/forms/languagedialog.py b/openlp/plugins/bibles/forms/languagedialog.py index 5c1325a54..390977ee9 100644 --- a/openlp/plugins/bibles/forms/languagedialog.py +++ b/openlp/plugins/bibles/forms/languagedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Jonathan Corwin, Michael # # Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, # # Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon # # Tibble, Carsten Tinggaard, Frode Woldsund # diff --git a/openlp/plugins/bibles/forms/languageform.py b/openlp/plugins/bibles/forms/languageform.py index c5069815b..cf027341d 100644 --- a/openlp/plugins/bibles/forms/languageform.py +++ b/openlp/plugins/bibles/forms/languageform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Jonathan Corwin, Michael # # Gorven, Scott Guerrieri, Meinert Jordan, Armin Köhler, Andreas Preikschat, # # Christian Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon # # Tibble, Carsten Tinggaard, Frode Woldsund # diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py index 7e40b6230..0539aef0c 100644 --- a/openlp/plugins/bibles/lib/__init__.py +++ b/openlp/plugins/bibles/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 4a24c146d..8402d6e11 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index 6735a7344..cd4b921a1 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -28,17 +28,7 @@ The :mod:`cvsbible` modules provides a facility to import bibles from a set of CSV files. -The module expects two mandatory files containing the books and the verses and -will accept an optional third file containing the testaments. - -The format of the testament file is: - - , - - For example: - - 1,Old Testament - 2,New Testament +The module expects two mandatory files containing the books and the verses. The format of the books file is: @@ -110,6 +100,9 @@ class CSVBible(BibleDB): try: details = get_file_encoding(self.booksfile) books_file = open(self.booksfile, 'r') + if not books_file.read(3) == '\xEF\xBB\xBF': + # no BOM was found + books_file.seek(0) books_reader = csv.reader(books_file, delimiter=',', quotechar='"') for line in books_reader: if self.stop_import_flag: @@ -144,6 +137,9 @@ class CSVBible(BibleDB): book_ptr = None details = get_file_encoding(self.versesfile) verse_file = open(self.versesfile, 'rb') + if not verse_file.read(3) == '\xEF\xBB\xBF': + # no BOM was found + verse_file.seek(0) verse_reader = csv.reader(verse_file, delimiter=',', quotechar='"') for line in verse_reader: if self.stop_import_flag: diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 243e7f967..5f3b7a6c9 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 228d4758c..72ffed487 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -92,6 +92,15 @@ class BGExtract(object): if headings: for heading in headings: heading.extract() + chapter_notes = soup.findAll('div', 'footnotes') + if chapter_notes: + log.debug('Found chapter notes') + for note in chapter_notes: + note.extract() + note_comments = soup.findAll(text=u'end of footnotes') + if note_comments: + for comment in note_comments: + comment.extract() cleanup = [(re.compile('\s+'), lambda match: ' ')] verses = BeautifulSoup(str(soup), markupMassage=cleanup) verse_list = {} diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 934aa2d90..873b42cee 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 31effe189..d7b3fff01 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index b822b9b9d..25aa109de 100644 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -27,6 +27,7 @@ import logging import sqlite +import sys from openlp.core.lib import Receiver from openlp.core.ui.wizard import WizardStrings @@ -53,9 +54,14 @@ class OpenLP1Bible(BibleDB): connection = None cursor = None try: - connection = sqlite.connect(self.filename) + connection = sqlite.connect( + self.filename.encode(sys.getfilesystemencoding())) cursor = connection.cursor() - except: + except sqlite.DatabaseError: + log.exception(u'File "%s" is encrypted or not a sqlite database, ' + 'therefore not an openlp.org 1.x database either' % self.filename) + # Please add an user error here! + # This file is not an openlp.org 1.x bible database. return False #Create the bible language language_id = self.get_language(bible_name) @@ -63,7 +69,14 @@ class OpenLP1Bible(BibleDB): log.exception(u'Importing books from "%s" failed' % self.filename) return False # Create all books. - cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book') + try: + cursor.execute( + u'SELECT id, testament_id, name, abbreviation FROM book') + except sqlite.DatabaseError as error: + log.exception(u'DatabaseError: %s' % error) + # Please add an user error here! + # This file is not an openlp.org 1.x bible database. + return False books = cursor.fetchall() self.wizard.progressBar.setMaximum(len(books) + 1) for book in books: diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 16820229c..ab03ef22f 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index b802cda85..3fac48f19 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -78,8 +78,7 @@ class OSISBible(BibleDB): fbibles = open(filepath, u'r') for line in fbibles: book = line.split(u',') - self.books[book[0]] = (book[1].lstrip().rstrip(), - book[2].lstrip().rstrip()) + self.books[book[0]] = (book[1].strip(), book[2].strip()) except IOError: log.exception(u'OSIS bible import failed') finally: diff --git a/openlp/plugins/bibles/lib/versereferencelist.py b/openlp/plugins/bibles/lib/versereferencelist.py index a1727655e..73710468b 100644 --- a/openlp/plugins/bibles/lib/versereferencelist.py +++ b/openlp/plugins/bibles/lib/versereferencelist.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/__init__.py b/openlp/plugins/custom/__init__.py index 3446f597e..2d28ae53c 100644 --- a/openlp/plugins/custom/__init__.py +++ b/openlp/plugins/custom/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index e9260f926..51206901d 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/forms/__init__.py b/openlp/plugins/custom/forms/__init__.py index e901095c2..71605ebd7 100644 --- a/openlp/plugins/custom/forms/__init__.py +++ b/openlp/plugins/custom/forms/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 3eee1cfd4..1d79968f5 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index a85daa38b..6a72907a9 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index 759f6b19d..a616075c0 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index 71696ebc1..d7d022a66 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/lib/__init__.py b/openlp/plugins/custom/lib/__init__.py index 0e343b6cc..c7737441d 100644 --- a/openlp/plugins/custom/lib/__init__.py +++ b/openlp/plugins/custom/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 8a7762f37..0466cf696 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/lib/customxmlhandler.py b/openlp/plugins/custom/lib/customxmlhandler.py index ff9fab7a7..a2210f8c6 100644 --- a/openlp/plugins/custom/lib/customxmlhandler.py +++ b/openlp/plugins/custom/lib/customxmlhandler.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/lib/db.py b/openlp/plugins/custom/lib/db.py index 0cefaf012..b8d96ecea 100644 --- a/openlp/plugins/custom/lib/db.py +++ b/openlp/plugins/custom/lib/db.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 59d6b4fb6..584f22e7b 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -33,7 +33,6 @@ from sqlalchemy.sql import or_, func from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ check_item_selected, translate -from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import UiStrings from openlp.plugins.custom.forms import EditCustomForm from openlp.plugins.custom.lib import CustomXMLParser @@ -70,35 +69,8 @@ class CustomMediaItem(MediaManagerItem): def addEndHeaderBar(self): self.addToolbarSeparator() - self.searchWidget = QtGui.QWidget(self) - self.searchWidget.setObjectName(u'searchWidget') - self.searchLayout = QtGui.QVBoxLayout(self.searchWidget) - self.searchLayout.setObjectName(u'searchLayout') - self.searchTextLayout = QtGui.QFormLayout() - self.searchTextLayout.setObjectName(u'searchTextLayout') - self.searchTextLabel = QtGui.QLabel(self.searchWidget) - self.searchTextLabel.setObjectName(u'searchTextLabel') - self.searchTextEdit = SearchEdit(self.searchWidget) - self.searchTextEdit.setObjectName(u'searchTextEdit') - self.searchTextLabel.setBuddy(self.searchTextEdit) - self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit) - self.searchLayout.addLayout(self.searchTextLayout) - self.searchButtonLayout = QtGui.QHBoxLayout() - self.searchButtonLayout.setObjectName(u'searchButtonLayout') - self.searchButtonLayout.addStretch() - self.searchTextButton = QtGui.QPushButton(self.searchWidget) - self.searchTextButton.setObjectName(u'searchTextButton') - self.searchButtonLayout.addWidget(self.searchTextButton) - self.searchLayout.addLayout(self.searchButtonLayout) - self.pageLayout.addWidget(self.searchWidget) + self.addSearchToToolBar() # Signals and slots - QtCore.QObject.connect(self.searchTextEdit, - QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick) - QtCore.QObject.connect(self.searchTextButton, - QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) - QtCore.QObject.connect(self.searchTextEdit, - QtCore.SIGNAL(u'textChanged(const QString&)'), - self.onSearchTextEditChanged) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.QObject.connect(self.searchTextEdit, diff --git a/openlp/plugins/images/__init__.py b/openlp/plugins/images/__init__.py index b95ac000d..d724ebd57 100644 --- a/openlp/plugins/images/__init__.py +++ b/openlp/plugins/images/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 4b5a6f3c0..5997498d7 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/images/lib/__init__.py b/openlp/plugins/images/lib/__init__.py index e216623cd..08396a358 100644 --- a/openlp/plugins/images/lib/__init__.py +++ b/openlp/plugins/images/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 1aa39b63c..be54e207c 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index b1e815a3a..92779b991 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/media/__init__.py b/openlp/plugins/media/__init__.py index 32cff0c44..8625277ca 100644 --- a/openlp/plugins/media/__init__.py +++ b/openlp/plugins/media/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/media/lib/__init__.py b/openlp/plugins/media/lib/__init__.py index 25b8d531a..02a589ce6 100644 --- a/openlp/plugins/media/lib/__init__.py +++ b/openlp/plugins/media/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 0d5d8eeff..111a86209 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -54,7 +54,7 @@ class MediaMediaItem(MediaManagerItem): self.iconPath = u'images/image' self.background = False self.previewFunction = CLAPPERBOARD - self.Automatic = u'' + self.automatic = u'' MediaManagerItem.__init__(self, parent, plugin, icon) self.singleServiceItem = False self.hasSearch = True @@ -101,7 +101,7 @@ class MediaMediaItem(MediaManagerItem): self.replaceAction.setToolTip(UiStrings().ReplaceLiveBG) self.resetAction.setText(UiStrings().ResetBG) self.resetAction.setToolTip(UiStrings().ResetLiveBG) - self.Automatic = translate('MediaPlugin.MediaItem', + self.automatic = translate('MediaPlugin.MediaItem', 'Automatic') self.displayTypeLabel.setText( translate('MediaPlugin.MediaItem', 'Use Player:')) @@ -253,7 +253,7 @@ class MediaMediaItem(MediaManagerItem): # load the drop down selection self.displayTypeComboBox.addItem(title) if self.displayTypeComboBox.count() > 1: - self.displayTypeComboBox.insertItem(0, self.Automatic) + self.displayTypeComboBox.insertItem(0, self.automatic) self.displayTypeComboBox.setCurrentIndex(0) if QtCore.QSettings().value(self.settingsSection + u'/override player', QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 4e39bc419..aed6b96cc 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -35,7 +35,8 @@ class MediaTab(SettingsTab): MediaTab is the Media settings tab in the settings dialog. """ def __init__(self, parent, title, visible_title, media_players, icon_path): - self.media_players = media_players + self.mediaPlayers = media_players + self.savedUsedPlayers = None SettingsTab.__init__(self, parent, title, visible_title, icon_path) def setupUi(self): @@ -45,13 +46,13 @@ class MediaTab(SettingsTab): self.mediaPlayerGroupBox.setObjectName(u'mediaPlayerGroupBox') self.mediaPlayerLayout = QtGui.QVBoxLayout(self.mediaPlayerGroupBox) self.mediaPlayerLayout.setObjectName(u'mediaPlayerLayout') - self.PlayerCheckBoxes = {} - for key in self.media_players: - player = self.media_players[key] + self.playerCheckBoxes = {} + for key, player in self.mediaPlayers.iteritems(): + player = self.mediaPlayers[key] checkbox = QtGui.QCheckBox(self.mediaPlayerGroupBox) checkbox.setEnabled(player.available) checkbox.setObjectName(player.name + u'CheckBox') - self.PlayerCheckBoxes[player.name] = checkbox + self.playerCheckBoxes[player.name] = checkbox self.mediaPlayerLayout.addWidget(checkbox) self.leftLayout.addWidget(self.mediaPlayerGroupBox) self.playerOrderGroupBox = QtGui.QGroupBox(self.leftColumn) @@ -88,19 +89,19 @@ class MediaTab(SettingsTab): self.orderingButtonLayout.addWidget(self.orderingUpButton) self.playerOrderLayout.addWidget(self.orderingButtonsWidget) self.leftLayout.addWidget(self.playerOrderGroupBox) - self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn) - self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox') - self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox) - self.AdvancedLayout.setObjectName(u'AdvancedLayout') - self.OverridePlayerCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) - self.OverridePlayerCheckBox.setObjectName(u'OverridePlayerCheckBox') - self.AdvancedLayout.addWidget(self.OverridePlayerCheckBox) - self.leftLayout.addWidget(self.AdvancedGroupBox) + self.advancedGroupBox = QtGui.QGroupBox(self.leftColumn) + self.advancedGroupBox.setObjectName(u'advancedGroupBox') + self.advancedLayout = QtGui.QVBoxLayout(self.advancedGroupBox) + self.advancedLayout.setObjectName(u'advancedLayout') + self.overridePlayerCheckBox = QtGui.QCheckBox(self.advancedGroupBox) + self.overridePlayerCheckBox.setObjectName(u'overridePlayerCheckBox') + self.advancedLayout.addWidget(self.overridePlayerCheckBox) + self.leftLayout.addWidget(self.advancedGroupBox) self.leftLayout.addStretch() self.rightLayout.addStretch() - for key in self.media_players: - player = self.media_players[key] - checkbox = self.PlayerCheckBoxes[player.name] + for key in self.mediaPlayers: + player = self.mediaPlayers[key] + checkbox = self.playerCheckBoxes[player.name] QtCore.QObject.connect(checkbox, QtCore.SIGNAL(u'stateChanged(int)'), self.onPlayerCheckBoxChanged) @@ -112,9 +113,9 @@ class MediaTab(SettingsTab): def retranslateUi(self): self.mediaPlayerGroupBox.setTitle( translate('MediaPlugin.MediaTab', 'Available Media Players')) - for key in self.media_players: - player = self.media_players[key] - checkbox = self.PlayerCheckBoxes[player.name] + for key in self.mediaPlayers: + player = self.mediaPlayers[key] + checkbox = self.playerCheckBoxes[player.name] if player.available: checkbox.setText(player.name) else: @@ -127,8 +128,8 @@ class MediaTab(SettingsTab): translate('MediaPlugin.MediaTab', 'Down')) self.orderingUpButton.setText( translate('MediaPlugin.MediaTab', 'Up')) - self.AdvancedGroupBox.setTitle(UiStrings().Advanced) - self.OverridePlayerCheckBox.setText( + self.advancedGroupBox.setTitle(UiStrings().Advanced) + self.overridePlayerCheckBox.setText( translate('MediaPlugin.MediaTab', 'Allow media player to be overriden')) @@ -138,18 +139,19 @@ class MediaTab(SettingsTab): if player not in self.usedPlayers: self.usedPlayers.append(player) else: - self.usedPlayers.takeAt(self.usedPlayers.indexOf(player)) + if player in self.usedPlayers: + self.usedPlayers.takeAt(self.usedPlayers.indexOf(player)) self.updatePlayerList() def updatePlayerList(self): self.playerOrderlistWidget.clear() for player in self.usedPlayers: - if player in self.PlayerCheckBoxes.keys(): + if player in self.playerCheckBoxes.keys(): if len(self.usedPlayers) == 1: - # at least one media player have to stay active - self.PlayerCheckBoxes[u'%s' % player].setEnabled(False) + # At least one media player has to stay active + self.playerCheckBoxes[u'%s' % player].setEnabled(False) else: - self.PlayerCheckBoxes[u'%s' % player].setEnabled(True) + self.playerCheckBoxes[u'%s' % player].setEnabled(True) self.playerOrderlistWidget.addItem(player) def onOrderingUpButtonPressed(self): @@ -169,37 +171,43 @@ class MediaTab(SettingsTab): self.usedPlayers.move(currentRow, currentRow + 1) def load(self): + if self.savedUsedPlayers: + self.usedPlayers = self.savedUsedPlayers + self.savedUsedPlayers = None self.usedPlayers = QtCore.QSettings().value( self.settingsSection + u'/players', QtCore.QVariant(u'webkit')).toString().split(u',') - for key in self.media_players: - player = self.media_players[key] - checkbox = self.PlayerCheckBoxes[player.name] + self.savedUsedPlayers = self.usedPlayers + for key in self.mediaPlayers: + player = self.mediaPlayers[key] + checkbox = self.playerCheckBoxes[player.name] if player.available and player.name in self.usedPlayers: checkbox.setChecked(True) + else: + checkbox.setChecked(False) self.updatePlayerList() - self.OverridePlayerCheckBox.setChecked(QtCore.QSettings().value( + self.overridePlayerCheckBox.setChecked(QtCore.QSettings().value( self.settingsSection + u'/override player', QtCore.QVariant(QtCore.Qt.Unchecked)).toInt()[0]) def save(self): override_changed = False player_string_changed = False - oldPlayerString = QtCore.QSettings().value( + old_players = QtCore.QSettings().value( self.settingsSection + u'/players', QtCore.QVariant(u'webkit')).toString() - newPlayerString = self.usedPlayers.join(u',') - if oldPlayerString != newPlayerString: + new_players = self.usedPlayers.join(u',') + if old_players != new_players: # clean old Media stuff QtCore.QSettings().setValue(self.settingsSection + u'/players', - QtCore.QVariant(newPlayerString)) + QtCore.QVariant(new_players)) player_string_changed = True override_changed = True setting_key = self.settingsSection + u'/override player' if QtCore.QSettings().value(setting_key) != \ - self.OverridePlayerCheckBox.checkState(): + self.overridePlayerCheckBox.checkState(): QtCore.QSettings().setValue(setting_key, - QtCore.QVariant(self.OverridePlayerCheckBox.checkState())) + QtCore.QVariant(self.overridePlayerCheckBox.checkState())) override_changed = True if override_changed: Receiver.send_message(u'mediaitem_media_rebuild') diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 2825d899e..cd3f8b3dd 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -27,6 +27,8 @@ import logging +from PyQt4 import QtCore + from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.plugins.media.lib import MediaMediaItem, MediaTab @@ -117,3 +119,29 @@ class MediaPlugin(Plugin): Add html code to htmlbuilder """ return self.mediaController.get_media_display_html() + + def appStartup(self): + """ + Do a couple of things when the app starts up. In this particular case + we want to check if we have the old "Use Phonon" setting, and convert + it to "enable Phonon" and "make it the first one in the list". + """ + settings = QtCore.QSettings() + settings.beginGroup(self.settingsSection) + if settings.contains(u'use phonon'): + log.info(u'Found old Phonon setting') + players = self.mediaController.mediaPlayers.keys() + has_phonon = u'phonon' in players + if settings.value(u'use phonon').toBool() and has_phonon: + log.debug(u'Converting old setting to new setting') + new_players = [] + if players: + new_players = [player for player in players \ + if player != u'phonon'] + new_players.insert(0, u'phonon') + self.mediaController.mediaPlayers[u'phonon'].isActive = True + settings.setValue(u'players', \ + QtCore.QVariant(u','.join(new_players))) + self.settings_tab.load() + settings.remove(u'use phonon') + settings.endGroup() diff --git a/openlp/plugins/presentations/__init__.py b/openlp/plugins/presentations/__init__.py index d7cb7afe5..96f5e9539 100644 --- a/openlp/plugins/presentations/__init__.py +++ b/openlp/plugins/presentations/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/__init__.py b/openlp/plugins/presentations/lib/__init__.py index 3c4e0499d..1092a7458 100644 --- a/openlp/plugins/presentations/lib/__init__.py +++ b/openlp/plugins/presentations/lib/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 8355da5a8..3e6c5450a 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 6dc57373a..03fdadb1b 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 0f38cf02f..1b795624b 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index 8f551e411..da828b436 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index cd940da5c..4f3e43c6d 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py index 50cf515dc..f41a228b0 100644 --- a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py +++ b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 7ff04179f..7702f19cd 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index c11f36c20..93174b3da 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # @@ -40,6 +40,7 @@ class PresentationTab(SettingsTab): """ self.controllers = controllers SettingsTab.__init__(self, parent, title, visible_title, icon_path) + self.activated = False def setupUi(self): """ @@ -110,8 +111,12 @@ class PresentationTab(SettingsTab): def save(self): """ - Save the settings. + Save the settings. If the tab hasn't been made visible to the user + then there is nothing to do, so exit. This removes the need to + start presentation applications unnecessarily. """ + if not self.activated: + return changed = False for key in self.controllers: controller = self.controllers[key] @@ -140,6 +145,7 @@ class PresentationTab(SettingsTab): """ Tab has just been made visible to the user """ + self.activated = True for key in self.controllers: controller = self.controllers[key] checkbox = self.PresenterCheckboxes[controller.name] diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index e35659638..7121aff27 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/remotes/__init__.py b/openlp/plugins/remotes/__init__.py index ab1d8adbc..7012c14d4 100644 --- a/openlp/plugins/remotes/__init__.py +++ b/openlp/plugins/remotes/__init__.py @@ -4,8 +4,8 @@ ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2008-2011 Raoul Snyman # -# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Copyright (c) 2008-2012 Raoul Snyman # +# Portions copyright (c) 2008-2012 Tim Bentley, Gerald Britton, Jonathan # # Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # # Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # # Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index 1339e9dda..fb88ee0dc 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -58,7 +58,7 @@
- ${back} + ${back}

${service_manager}

${refresh}
@@ -89,7 +89,7 @@
- ${back} + ${back}

${slide_controller}

${refresh}
@@ -120,7 +120,7 @@
- ${back} + ${back}

${alerts}

@@ -133,7 +133,7 @@