diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 361675490..ace2d4f24 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -590,7 +590,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): def onCopyrightInsertButtonTriggered(self): text = self.CopyrightEditItem.text() pos = self.CopyrightEditItem.cursorPosition() - text = text[:pos] + u'\xa9' + text[pos:] + text = text[:pos] + '\xa9' + text[pos:] self.CopyrightEditItem.setText(text) self.CopyrightEditItem.setFocus() self.CopyrightEditItem.setCursorPosition(pos + 1) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 15303ccf7..dddb23b4e 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -94,6 +94,10 @@ class VerseType(object): from manager import SongManager from songstab import SongsTab from mediaitem import SongMediaItem -from sofimport import SofImport -from oooimport import OooImport -from songimport import SongImport \ No newline at end of file +from songimport import SongImport +try: + from sofimport import SofImport + from oooimport import OooImport +except ImportError: + pass + diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 030a27f6b..80677b659 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -27,7 +27,7 @@ import re from PyQt4 import QtGui -from openlp.core.lib import SongXMLBuilder +from openlp.core.lib import SongXMLBuilder, translate from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib.db import Song, Author, Topic, Book @@ -63,10 +63,10 @@ class SongImport(object): self.verses = [] self.versecount = 0 self.choruscount = 0 - self.copyright_string = unicode(QtGui.QApplication.translate( - u'SongsPlugin.SongImport', u'copyright')) - self.copyright_symbol = unicode(QtGui.QApplication.translate( - u'SongsPlugin.SongImport', u'\xa9')) + self.copyright_string = unicode(translate( + 'SongsPlugin.SongImport', 'copyright')) + self.copyright_symbol = unicode(translate( + 'SongsPlugin.SongImport', '\xa9')) @staticmethod def process_songs_text(manager, text): diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 6d610282c..d128bc6a2 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -29,10 +29,15 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \ translate -from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab, \ - SofImport, OooImport +from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab from openlp.plugins.songs.lib.db import Song +try: + from openlp.plugins.songs.lib import SofImport, OooImport + OOo_available = True +except ImportError: + OOo_available = False + log = logging.getLogger(__name__) class SongsPlugin(Plugin): @@ -96,46 +101,48 @@ class SongsPlugin(Plugin): self.SongImportItem.setToolTip(translate('SongsPlugin', 'Import songs using the import wizard.')) import_menu.addAction(self.SongImportItem) - # Songs of Fellowship import menu item - will be removed and the - # functionality will be contained within the import wizard - self.ImportSofItem = QtGui.QAction(import_menu) - self.ImportSofItem.setObjectName(u'ImportSofItem') - self.ImportSofItem.setText( - translate('SongsPlugin', - 'Songs of Fellowship (temp menu item)')) - self.ImportSofItem.setToolTip( - translate('SongsPlugin', - 'Import songs from the VOLS1_2.RTF, sof3words' \ - + '.rtf and sof4words.rtf supplied with the music books')) - self.ImportSofItem.setStatusTip( - translate('SongsPlugin', - 'Import songs from the VOLS1_2.RTF, sof3words' \ - + '.rtf and sof4words.rtf supplied with the music books')) - import_menu.addAction(self.ImportSofItem) - # OpenOffice.org import menu item - will be removed and the - # functionality will be contained within the import wizard - self.ImportOooItem = QtGui.QAction(import_menu) - self.ImportOooItem.setObjectName(u'ImportOooItem') - self.ImportOooItem.setText( - translate('SongsPlugin', - 'Generic Document/Presentation Import ' - '(temp menu item)')) - self.ImportOooItem.setToolTip( - translate('SongsPlugin', - 'Import songs from ' - 'Word/Writer/Powerpoint/Impress')) - self.ImportOooItem.setStatusTip( - translate('SongsPlugin', - 'Import songs from ' - 'Word/Writer/Powerpoint/Impress')) - import_menu.addAction(self.ImportOooItem) # Signals and slots QtCore.QObject.connect(self.SongImportItem, QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked) - QtCore.QObject.connect(self.ImportSofItem, - QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick) - QtCore.QObject.connect(self.ImportOooItem, - QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick) + if OOo_available: + # Songs of Fellowship import menu item - will be removed and the + # functionality will be contained within the import wizard + self.ImportSofItem = QtGui.QAction(import_menu) + self.ImportSofItem.setObjectName(u'ImportSofItem') + self.ImportSofItem.setText( + translate('SongsPlugin', + 'Songs of Fellowship (temp menu item)')) + self.ImportSofItem.setToolTip( + translate('SongsPlugin', + 'Import songs from the VOLS1_2.RTF, sof3words' \ + + '.rtf and sof4words.rtf supplied with the music books')) + self.ImportSofItem.setStatusTip( + translate('SongsPlugin', + 'Import songs from the VOLS1_2.RTF, sof3words' \ + + '.rtf and sof4words.rtf supplied with the music books')) + import_menu.addAction(self.ImportSofItem) + # OpenOffice.org import menu item - will be removed and the + # functionality will be contained within the import wizard + self.ImportOooItem = QtGui.QAction(import_menu) + self.ImportOooItem.setObjectName(u'ImportOooItem') + self.ImportOooItem.setText( + translate('SongsPlugin', + 'Generic Document/Presentation Import ' + '(temp menu item)')) + self.ImportOooItem.setToolTip( + translate('SongsPlugin', + 'Import songs from ' + 'Word/Writer/Powerpoint/Impress')) + self.ImportOooItem.setStatusTip( + translate('SongsPlugin', + 'Import songs from ' + 'Word/Writer/Powerpoint/Impress')) + import_menu.addAction(self.ImportOooItem) + # Signals and slots + QtCore.QObject.connect(self.ImportSofItem, + QtCore.SIGNAL(u'triggered()'), self.onImportSofItemClick) + QtCore.QObject.connect(self.ImportOooItem, + QtCore.SIGNAL(u'triggered()'), self.onImportOooItemClick) def add_export_menu_item(self, export_menu): """