From 54736fdac0875905f512df2239afc1d6d3c70315 Mon Sep 17 00:00:00 2001 From: Derek Scotney Date: Sat, 21 Aug 2010 17:33:31 +0200 Subject: [PATCH] Implementation of SongSelect file import --- openlp/plugins/songs/lib/__init__.py | 1 + openlp/plugins/songs/songsplugin.py | 31 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) mode change 100644 => 100755 openlp/plugins/songs/songsplugin.py diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index b8f4d9a05..0e5b0bfa8 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -144,6 +144,7 @@ from mediaitem import SongMediaItem from songimport import SongImport from opensongimport import OpenSongImport from olpimport import OpenLPSongImport +from songselectfileimport import SongSelectFileImport try: from sofimport import SofImport from oooimport import OooImport diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py old mode 100644 new mode 100755 index c09e7a1bb..80a459a80 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -41,6 +41,8 @@ except ImportError: from openlp.plugins.songs.lib import OpenSongImport +from openlp.plugins.songs.lib import SongSelectFileImport + log = logging.getLogger(__name__) class SongsPlugin(Plugin): @@ -169,6 +171,19 @@ class SongsPlugin(Plugin): import_menu.addAction(self.ImportOpenLPSongItem) QtCore.QObject.connect(self.ImportOpenLPSongItem, QtCore.SIGNAL(u'triggered()'), self.onImportOpenLPSongItemClick) + # SongSelect file import menu item + # an import wizard + self.ImportSongSelectSongItem = QtGui.QAction(import_menu) + self.ImportSongSelectSongItem.setObjectName(u'ImportSongSelectSongItem') + self.ImportSongSelectSongItem.setText(translate('SongsPlugin', + 'SongSelect File (temporary)')) + self.ImportSongSelectSongItem.setToolTip(translate('SongsPlugin', + 'Import a SongSelect song file')) + self.ImportSongSelectSongItem.setStatusTip(translate('SongsPlugin', + 'Import a SongSelect song file')) + import_menu.addAction(self.ImportSongSelectSongItem) + QtCore.QObject.connect(self.ImportSongSelectSongItem, + QtCore.SIGNAL(u'triggered()'), self.onImportSongSelectSongItemClick) def addExportMenuItem(self, export_menu): """ @@ -248,6 +263,22 @@ class SongsPlugin(Plugin): oooimport.import_docs(filenames) Receiver.send_message(u'songs_load_list') + def onImportSongSelectSongItemClick(self): + filenames = QtGui.QFileDialog.getOpenFileNames( + None, translate('SongsPlugin', + 'Open SongSelect file'), + u'', u'SongSelect files (*.usr *.txt)') + try: + for filename in filenames: + importer = SongSelectFileImport(self.manager) + importer.do_import(unicode(filename)) + except: + log.exception('Could not import SongSelect file') + QtGui.QMessageBox.critical(None, + translate('SongsPlugin', 'Import Error'), + translate('SongsPlugin', 'Error importing SongSelect file')) + Receiver.send_message(u'songs_load_list') + def about(self): about_text = translate('SongsPlugin', 'Songs Plugin' '
The songs plugin provides the ability to display and '