From d992fb1e0762e6e316e19f3b756a8f40b7bfa7ea Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 8 Aug 2010 16:38:51 +0200 Subject: [PATCH 1/8] First add and delete buttons working! --- openlp/plugins/songs/forms/songimportform.py | 48 ++++++++++++++----- .../plugins/songs/forms/songimportwizard.py | 2 + 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 9524e8981..025bf4011 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -37,12 +37,12 @@ log = logging.getLogger(__name__) class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): """ - This is the Bible Import Wizard, which allows easy importing of Bibles - into OpenLP from other formats like OSIS, CSV and OpenSong. + This is the Song Import Wizard, which allows easy importing of Songs + into OpenLP from other formats like OpenLyrics, OpenSong and CCLI. """ - log.info(u'BibleImportForm loaded') + log.info(u'SongImportForm loaded') - def __init__(self, parent, manager, songsplugin): + def __init__(self, parent, manager, plugin): """ Instantiate the wizard, and run any extra setup we need to. @@ -53,10 +53,10 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): The configuration object for storing and retrieving settings. ``manager`` - The Bible manager. + The songs manager. - ``bibleplugin`` - The Bible plugin. + ``plugin`` + The songs plugin. """ QtGui.QWizard.__init__(self, parent) self.setupUi(self) @@ -64,11 +64,14 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.finishButton = self.button(QtGui.QWizard.FinishButton) self.cancelButton = self.button(QtGui.QWizard.CancelButton) self.manager = manager - self.songsplugin = songsplugin + self.plugin = plugin #self.manager.set_process_dialog(self) -# QtCore.QObject.connect(self.OsisFileButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onOsisFileButtonClicked) + QtCore.QObject.connect(self.OpenLyricsAddButton, + QtCore.SIGNAL(u'clicked()'), + self.onOpenLyricsAddButtonClicked) + QtCore.QObject.connect(self.OpenLyricsRemoveButton, + QtCore.SIGNAL(u'clicked()'), + self.onOpenLyricsRemoveButtonClicked) # QtCore.QObject.connect(self.BooksFileButton, # QtCore.SIGNAL(u'clicked()'), # self.onBooksFileButtonClicked) @@ -146,6 +149,29 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): # Progress page return True + def getFiles(self, title, listbox): + filenames = QtGui.QFileDialog.getOpenFileNames(self, title, + SettingsManager.get_last_dir(self.plugin.settingsSection, 1)) + if filenames: + listbox.addItems(filenames) + #SettingsManager.set_last_dir( + # self.plugin.settingsSection, + # os.path.split(unicode(filenames[0]))[0], 1) + + def removeSelectedItems(self, listbox): + for item in listbox.selectedItems(): + item = listbox.takeItem(listbox.row(item)) + del item + + def onOpenLyricsAddButtonClicked(self): + self.getFiles( + translate('SongsPlugin.ImportWizard', 'Select OpenLyrics Files'), + self.OpenLyricsFileListWidget + ) + + def onOpenLyricsRemoveButtonClicked(self): + self.removeSelectedItems(self.OpenLyricsFileListWidget) + def onCancelButtonClicked(self, checked): """ Stop the import on pressing the cancel button. diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py index 4008526c1..48fef5774 100644 --- a/openlp/plugins/songs/forms/songimportwizard.py +++ b/openlp/plugins/songs/forms/songimportwizard.py @@ -104,6 +104,8 @@ class Ui_SongImportWizard(object): self.OpenLyricsLayout.setMargin(0) self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout') self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage) + self.OpenLyricsFileListWidget.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget') self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget) self.OpenLyricsButtonLayout = QtGui.QHBoxLayout() From 3d478ec975eb4a206ce4b6b4ecc03fa9925bacf0 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 20 Aug 2010 21:40:07 +0200 Subject: [PATCH 2/8] Song Wizard! --- openlp/plugins/songs/forms/songimportform.py | 189 +++++++-- .../plugins/songs/forms/songimportwizard.py | 362 +++++++++++++----- openlp/plugins/songs/lib/__init__.py | 38 +- 3 files changed, 438 insertions(+), 151 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 025bf4011..b2c7ee195 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -25,6 +25,7 @@ ############################################################################### import logging +import os from PyQt4 import QtCore, QtGui @@ -66,21 +67,36 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.manager = manager self.plugin = plugin #self.manager.set_process_dialog(self) - QtCore.QObject.connect(self.OpenLyricsAddButton, + QtCore.QObject.connect(self.openLP2BrowseButton, + QtCore.SIGNAL(u'clicked()'), + self.onOpenLP2BrowseButtonClicked) + QtCore.QObject.connect(self.openLP1BrowseButton, + QtCore.SIGNAL(u'clicked()'), + self.onOpenLP1BrowseButtonClicked) + QtCore.QObject.connect(self.openLyricsAddButton, QtCore.SIGNAL(u'clicked()'), self.onOpenLyricsAddButtonClicked) - QtCore.QObject.connect(self.OpenLyricsRemoveButton, + QtCore.QObject.connect(self.openLyricsRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onOpenLyricsRemoveButtonClicked) -# QtCore.QObject.connect(self.BooksFileButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onBooksFileButtonClicked) -# QtCore.QObject.connect(self.CsvVersesFileButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onCsvVersesFileButtonClicked) -# QtCore.QObject.connect(self.OpenSongBrowseButton, -# QtCore.SIGNAL(u'clicked()'), -# self.onOpenSongBrowseButtonClicked) + QtCore.QObject.connect(self.openSongAddButton, + QtCore.SIGNAL(u'clicked()'), + self.onOpenSongAddButtonClicked) + QtCore.QObject.connect(self.openSongRemoveButton, + QtCore.SIGNAL(u'clicked()'), + self.onOpenSongRemoveButtonClicked) + QtCore.QObject.connect(self.wordsOfWorshipAddButton, + QtCore.SIGNAL(u'clicked()'), + self.onWordsOfWorshipAddButtonClicked) + QtCore.QObject.connect(self.wordsOfWorshipRemoveButton, + QtCore.SIGNAL(u'clicked()'), + self.onWordsOfWorshipRemoveButtonClicked) + QtCore.QObject.connect(self.songsOfFellowshipBrowseButton, + QtCore.SIGNAL(u'clicked()'), + self.onSongsOfFellowshipBrowseButtonClicked) + QtCore.QObject.connect(self.genericBrowseButton, + QtCore.SIGNAL(u'clicked()'), + self.onGenericBrowseButtonClicked) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL(u'clicked(bool)'), self.onCancelButtonClicked) @@ -105,25 +121,55 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): elif self.currentId() == 1: # Select page source_format = self.field(u'source_format').toInt()[0] - if source_format == SongFormat.OpenLyrics: - if self.OpenLyricsFileListWidget.count() == 0: + if source_format == SongFormat.OpenLP2: + if self.openLP2FilenameEdit.text().isEmpty(): + QtGui.QMessageBox.critical(self, + translate('SongsPlugin.ImportWizardForm', + 'No OpenLP 2.0 Song Database Selected'), + translate('SongsPlugin.ImportWizardForm', + 'You need to select an OpenLP 2.0 song database ' + 'file to import from.')) + self.openLP2BrowseButton.setFocus() + return False + elif source_format == SongFormat.OpenLP1: + if self.openSongFilenameEdit.text().isEmpty(): + QtGui.QMessageBox.critical(self, + translate('SongsPlugin.ImportWizardForm', + 'No openlp.org 1.x Song Database Selected'), + translate('SongsPlugin.ImportWizardForm', + 'You need to select an openlp.org 1.x song ' + 'database file to import from.')) + self.openLP1BrowseButton.setFocus() + return False + elif source_format == SongFormat.OpenLyrics: + if self.openLyricsFileListWidget.count() == 0: QtGui.QMessageBox.critical(self, translate('SongsPlugin.ImportWizardForm', 'No OpenLyrics Files Selected'), translate('SongsPlugin.ImportWizardForm', 'You need to add at least one OpenLyrics ' 'song file to import from.')) - self.OpenLyricsAddButton.setFocus() + self.openLyricsAddButton.setFocus() return False elif source_format == SongFormat.OpenSong: - if self.OpenSongFileListWidget.count() == 0: + if self.openSongFileListWidget.count() == 0: QtGui.QMessageBox.critical(self, translate('SongsPlugin.ImportWizardForm', 'No OpenSong Files Selected'), translate('SongsPlugin.ImportWizardForm', 'You need to add at least one OpenSong ' 'song file to import from.')) - self.OpenSongAddButton.setFocus() + self.openSongAddButton.setFocus() + return False + elif source_format == SongFormat.WordsOfWorship: + if self.wordsOfWorshipListWidget.count() == 0: + QtGui.QMessageBox.critical(self, + translate('SongsPlugin.ImportWizardForm', + 'No Words of Worship Files Selected'), + translate('SongsPlugin.ImportWizardForm', + 'You need to add at least one Words of Worship ' + 'file to import from.')) + self.wordsOfWorshipAddButton.setFocus() return False elif source_format == SongFormat.CCLI: if self.CCLIFileListWidget.count() == 0: @@ -135,42 +181,108 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): 'to import from.')) self.CCLIAddButton.setFocus() return False - elif source_format == SongFormat.CSV: - if self.CSVFilenameEdit.text().isEmpty(): + elif source_format == SongFormat.SongsOfFellowship: + if self.songsOfFellowshipFilenameEdit.text().isEmpty(): QtGui.QMessageBox.critical(self, translate('SongsPlugin.ImportWizardForm', - 'No CSV File Selected'), + 'No Songs of Fellowship File Selected'), translate('SongsPlugin.ImportWizardForm', - 'You need to specify a CSV file to import from.')) - self.CSVFilenameEdit.setFocus() + 'You need to select a Songs of Fellowship file to ' + 'import from.')) + self.songsOfFellowshipBrowseButton.setFocus() + return False + elif source_format == SongFormat.Generic: + if self.genericFilenameEdit.text().isEmpty(): + QtGui.QMessageBox.critical(self, + translate('SongsPlugin.ImportWizardForm', + 'No Document/Presentation Selected'), + translate('SongsPlugin.ImportWizardForm', + 'You need to select a document/presentation file ' + 'to import from.')) + self.genericBrowseButton.setFocus() return False return True elif self.currentId() == 2: # Progress page return True + def getFileName(self, title, editbox): + filename = QtGui.QFileDialog.getOpenFileName(self, title, + SettingsManager.get_last_dir(self.plugin.settingsSection, 1)) + if filename: + editbox.setText(filename) + SettingsManager.set_last_dir( + self.plugin.settingsSection, + os.path.split(unicode(filename))[0], 1) + def getFiles(self, title, listbox): filenames = QtGui.QFileDialog.getOpenFileNames(self, title, SettingsManager.get_last_dir(self.plugin.settingsSection, 1)) if filenames: listbox.addItems(filenames) - #SettingsManager.set_last_dir( - # self.plugin.settingsSection, - # os.path.split(unicode(filenames[0]))[0], 1) + SettingsManager.set_last_dir( + self.plugin.settingsSection, + os.path.split(unicode(filenames[0]))[0], 1) def removeSelectedItems(self, listbox): for item in listbox.selectedItems(): item = listbox.takeItem(listbox.row(item)) del item + def onOpenLP2BrowseButtonClicked(self): + self.getFileName( + translate('SongsPlugin.ImportWizardForm', + 'Select OpenLP 2.0 Database File'), + self.openLP2FilenameEdit + ) + + def onOpenLP1BrowseButtonClicked(self): + self.getFileName( + translate('SongsPlugin.ImportWizardForm', + 'Select openlp.org 1.x Database File'), + self.openLP1FilenameEdit + ) + def onOpenLyricsAddButtonClicked(self): self.getFiles( - translate('SongsPlugin.ImportWizard', 'Select OpenLyrics Files'), - self.OpenLyricsFileListWidget + translate('SongsPlugin.ImportWizardForm', 'Select OpenLyrics Files'), + self.openLyricsFileListWidget ) def onOpenLyricsRemoveButtonClicked(self): - self.removeSelectedItems(self.OpenLyricsFileListWidget) + self.removeSelectedItems(self.openLyricsFileListWidget) + + def onOpenSongAddButtonClicked(self): + self.getFiles( + translate('SongsPlugin.ImportWizardForm', 'Select Open Song Files'), + self.openSongFileListWidget + ) + + def onOpenSongRemoveButtonClicked(self): + self.removeSelectedItems(self.openSongFileListWidget) + + def onWordsOfWorshipAddButtonClicked(self): + self.getFiles( + translate('SongsPlugin.ImportWizardForm', 'Select Words of Worship Files'), + self.wordsOfWorshipFileListWidget + ) + + def onWordsOfWorshipRemoveButtonClicked(self): + self.removeSelectedItems(self.wordsOfWorshipFileListWidget) + + def onSongsOfFellowshipBrowseButtonClicked(self): + self.getFileName( + translate('SongsPlugin.ImportWizardForm', + 'Select Songs of Fellowship File'), + self.songsOfFellowshipFilenameEdit + ) + + def onGenericBrowseButtonClicked(self): + self.getFileName( + translate('SongsPlugin.ImportWizardForm', + 'Select Document/Presentation File'), + self.genericFilenameEdit + ) def onCancelButtonClicked(self, checked): """ @@ -191,18 +303,15 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): def setDefaults(self): self.setField(u'source_format', QtCore.QVariant(0)) - self.OpenLyricsFileListWidget.clear() - self.OpenSongFileListWidget.clear() + self.openLP2FilenameEdit.setText(u'') + self.openLP1FilenameEdit.setText(u'') + self.openLyricsFileListWidget.clear() + self.openSongFileListWidget.clear() + self.wordsOfWorshipFileListWidget.clear() self.CCLIFileListWidget.clear() - self.CSVFilenameEdit.setText(u'') - - def getFileName(self, title, editbox): - filename = QtGui.QFileDialog.getOpenFileName(self, title, - SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1)) - if filename: - editbox.setText(filename) - SettingsManager.set_last_dir(self.songsplugin.settingsSection, - filename, 1) + self.songsOfFellowshipFilenameEdit.setText(u'') + self.genericFilenameEdit.setText(u'') +# self.CSVFilenameEdit.setText(u'') def incrementProgressBar(self, status_text): log.debug(u'IncrementBar %s', status_text) @@ -223,9 +332,9 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): pass # source_format = self.field(u'source_format').toInt()[0] # importer = None -# if bible_type == BibleFormat.OSIS: +# if bible_type == SongFormat.OSIS: # # Import an OSIS bible -# importer = self.manager.import_bible(BibleFormat.OSIS, +# importer = self.plugin.import_songs(BibleFormat.OSIS, # name=license_version, # filename=unicode(self.field(u'osis_location').toString()) # ) diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py index 48fef5774..8f6c0949b 100644 --- a/openlp/plugins/songs/forms/songimportwizard.py +++ b/openlp/plugins/songs/forms/songimportwizard.py @@ -29,12 +29,14 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate class Ui_SongImportWizard(object): - def setupUi(self, SongImportWizard): - SongImportWizard.setObjectName(u'SongImportWizard') - SongImportWizard.resize(550, 386) - SongImportWizard.setModal(True) - SongImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) - SongImportWizard.setOptions( + def setupUi(self, songImportWizard): + openIcon = build_icon(u':/general/general_open.png') + deleteIcon = build_icon(u':/general/general_delete.png') + songImportWizard.setObjectName(u'songImportWizard') + songImportWizard.resize(550, 386) + songImportWizard.setModal(True) + songImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) + songImportWizard.setOptions( QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage) @@ -64,7 +66,7 @@ class Ui_SongImportWizard(object): QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.WelcomeTextLayout.addItem(self.WelcomeBottomSpacer) self.WelcomeLayout.addLayout(self.WelcomeTextLayout) - SongImportWizard.addPage(self.WelcomePage) + songImportWizard.addPage(self.WelcomePage) self.SourcePage = QtGui.QWizardPage() self.SourcePage.setObjectName(u'SourcePage') self.SourceLayout = QtGui.QVBoxLayout(self.SourcePage) @@ -90,6 +92,11 @@ class Ui_SongImportWizard(object): self.FormatComboBox.addItem(u'') self.FormatComboBox.addItem(u'') self.FormatComboBox.addItem(u'') + self.FormatComboBox.addItem(u'') + self.FormatComboBox.addItem(u'') + self.FormatComboBox.addItem(u'') + self.FormatComboBox.addItem(u'') +# self.FormatComboBox.addItem(u'') self.FormatLayout.addWidget(self.FormatComboBox) self.FormatSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) @@ -97,60 +104,139 @@ class Ui_SongImportWizard(object): self.SourceLayout.addLayout(self.FormatLayout) self.FormatStackedWidget = QtGui.QStackedWidget(self.SourcePage) self.FormatStackedWidget.setObjectName(u'FormatStackedWidget') - self.OpenLyricsPage = QtGui.QWidget() - self.OpenLyricsPage.setObjectName(u'OpenLyricsPage') - self.OpenLyricsLayout = QtGui.QVBoxLayout(self.OpenLyricsPage) - self.OpenLyricsLayout.setSpacing(8) - self.OpenLyricsLayout.setMargin(0) - self.OpenLyricsLayout.setObjectName(u'OpenLyricsLayout') - self.OpenLyricsFileListWidget = QtGui.QListWidget(self.OpenLyricsPage) - self.OpenLyricsFileListWidget.setSelectionMode( + # OpenLP 2.0 + self.openLP2Page = QtGui.QWidget() + self.openLP2Page.setObjectName(u'openLP2Page') + self.openLP2Layout = QtGui.QFormLayout(self.openLP2Page) + self.openLP2Layout.setMargin(0) + self.openLP2Layout.setSpacing(8) + self.openLP2Layout.setObjectName(u'openLP2Layout') + self.openLP2FilenameLabel = QtGui.QLabel(self.openLP2Page) + self.openLP2FilenameLabel.setObjectName(u'openLP2FilenameLabel') + self.openLP2Layout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.openLP2FilenameLabel) + self.openLP2FileLayout = QtGui.QHBoxLayout() + self.openLP2FileLayout.setSpacing(8) + self.openLP2FileLayout.setObjectName(u'openLP2FileLayout') + self.openLP2FilenameEdit = QtGui.QLineEdit(self.openLP2Page) + self.openLP2FilenameEdit.setObjectName(u'openLP2FilenameEdit') + self.openLP2FileLayout.addWidget(self.openLP2FilenameEdit) + self.openLP2BrowseButton = QtGui.QToolButton(self.openLP2Page) + self.openLP2BrowseButton.setIcon(openIcon) + self.openLP2BrowseButton.setObjectName(u'openLP2BrowseButton') + self.openLP2FileLayout.addWidget(self.openLP2BrowseButton) + self.openLP2Layout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.openLP2FileLayout) + self.FormatStackedWidget.addWidget(self.openLP2Page) + # openlp.org 1.x + self.openLP1Page = QtGui.QWidget() + self.openLP1Page.setObjectName(u'openLP1Page') + self.openLP1Layout = QtGui.QFormLayout(self.openLP1Page) + self.openLP1Layout.setMargin(0) + self.openLP1Layout.setSpacing(8) + self.openLP1Layout.setObjectName(u'openLP1Layout') + self.openLP1FilenameLabel = QtGui.QLabel(self.openLP1Page) + self.openLP1FilenameLabel.setObjectName(u'openLP1FilenameLabel') + self.openLP1Layout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.openLP1FilenameLabel) + self.openLP1FileLayout = QtGui.QHBoxLayout() + self.openLP1FileLayout.setSpacing(8) + self.openLP1FileLayout.setObjectName(u'openLP1FileLayout') + self.openLP1FilenameEdit = QtGui.QLineEdit(self.openLP1Page) + self.openLP1FilenameEdit.setObjectName(u'openLP1FilenameEdit') + self.openLP1FileLayout.addWidget(self.openLP1FilenameEdit) + self.openLP1BrowseButton = QtGui.QToolButton(self.openLP1Page) + self.openLP1BrowseButton.setIcon(openIcon) + self.openLP1BrowseButton.setObjectName(u'openLP1BrowseButton') + self.openLP1FileLayout.addWidget(self.openLP1BrowseButton) + self.openLP1Layout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.openLP1FileLayout) + self.FormatStackedWidget.addWidget(self.openLP1Page) + # OpenLyrics + self.openLyricsPage = QtGui.QWidget() + self.openLyricsPage.setObjectName(u'OpenLyricsPage') + self.openLyricsLayout = QtGui.QVBoxLayout(self.openLyricsPage) + self.openLyricsLayout.setSpacing(8) + self.openLyricsLayout.setMargin(0) + self.openLyricsLayout.setObjectName(u'OpenLyricsLayout') + self.openLyricsFileListWidget = QtGui.QListWidget(self.openLyricsPage) + self.openLyricsFileListWidget.setSelectionMode( QtGui.QAbstractItemView.ExtendedSelection) - self.OpenLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget') - self.OpenLyricsLayout.addWidget(self.OpenLyricsFileListWidget) - self.OpenLyricsButtonLayout = QtGui.QHBoxLayout() - self.OpenLyricsButtonLayout.setSpacing(8) - self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout') - self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage) - openIcon = build_icon(u':/general/general_open.png') - self.OpenLyricsAddButton.setIcon(openIcon) - self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton') - self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton) - self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20, + self.openLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget') + self.openLyricsLayout.addWidget(self.openLyricsFileListWidget) + self.openLyricsButtonLayout = QtGui.QHBoxLayout() + self.openLyricsButtonLayout.setSpacing(8) + self.openLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout') + self.openLyricsAddButton = QtGui.QPushButton(self.openLyricsPage) + self.openLyricsAddButton.setIcon(openIcon) + self.openLyricsAddButton.setObjectName(u'OpenLyricsAddButton') + self.openLyricsButtonLayout.addWidget(self.openLyricsAddButton) + self.openLyricsButtonSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer) - self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage) - deleteIcon = build_icon(u':/general/general_delete.png') - self.OpenLyricsRemoveButton.setIcon(deleteIcon) - self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton') - self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton) - self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout) - self.FormatStackedWidget.addWidget(self.OpenLyricsPage) - self.OpenSongPage = QtGui.QWidget() - self.OpenSongPage.setObjectName(u'OpenSongPage') - self.OpenSongLayout = QtGui.QVBoxLayout(self.OpenSongPage) - self.OpenSongLayout.setSpacing(8) - self.OpenSongLayout.setMargin(0) - self.OpenSongLayout.setObjectName(u'OpenSongLayout') - self.OpenSongFileListWidget = QtGui.QListWidget(self.OpenSongPage) - self.OpenSongFileListWidget.setObjectName(u'OpenSongFileListWidget') - self.OpenSongLayout.addWidget(self.OpenSongFileListWidget) - self.OpenSongButtonLayout = QtGui.QHBoxLayout() - self.OpenSongButtonLayout.setSpacing(8) - self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout') - self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage) - self.OpenSongAddButton.setIcon(openIcon) - self.OpenSongAddButton.setObjectName(u'OpenSongAddButton') - self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton) - self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20, + self.openLyricsButtonLayout.addItem(self.openLyricsButtonSpacer) + self.openLyricsRemoveButton = QtGui.QPushButton(self.openLyricsPage) + self.openLyricsRemoveButton.setIcon(deleteIcon) + self.openLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton') + self.openLyricsButtonLayout.addWidget(self.openLyricsRemoveButton) + self.openLyricsLayout.addLayout(self.openLyricsButtonLayout) + self.FormatStackedWidget.addWidget(self.openLyricsPage) + # Open Song + self.openSongPage = QtGui.QWidget() + self.openSongPage.setObjectName(u'OpenSongPage') + self.openSongLayout = QtGui.QVBoxLayout(self.openSongPage) + self.openSongLayout.setSpacing(8) + self.openSongLayout.setMargin(0) + self.openSongLayout.setObjectName(u'OpenSongLayout') + self.openSongFileListWidget = QtGui.QListWidget(self.openSongPage) + self.openSongFileListWidget.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) + self.openSongFileListWidget.setObjectName(u'OpenSongFileListWidget') + self.openSongLayout.addWidget(self.openSongFileListWidget) + self.openSongButtonLayout = QtGui.QHBoxLayout() + self.openSongButtonLayout.setSpacing(8) + self.openSongButtonLayout.setObjectName(u'OpenSongButtonLayout') + self.openSongAddButton = QtGui.QPushButton(self.openSongPage) + self.openSongAddButton.setIcon(openIcon) + self.openSongAddButton.setObjectName(u'OpenSongAddButton') + self.openSongButtonLayout.addWidget(self.openSongAddButton) + self.openSongButtonSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer) - self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage) - self.OpenSongRemoveButton.setIcon(deleteIcon) - self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton') - self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton) - self.OpenSongLayout.addLayout(self.OpenSongButtonLayout) - self.FormatStackedWidget.addWidget(self.OpenSongPage) + self.openSongButtonLayout.addItem(self.openSongButtonSpacer) + self.openSongRemoveButton = QtGui.QPushButton(self.openSongPage) + self.openSongRemoveButton.setIcon(deleteIcon) + self.openSongRemoveButton.setObjectName(u'OpenSongRemoveButton') + self.openSongButtonLayout.addWidget(self.openSongRemoveButton) + self.openSongLayout.addLayout(self.openSongButtonLayout) + self.FormatStackedWidget.addWidget(self.openSongPage) + # Words of Worship + self.wordsOfWorshipPage = QtGui.QWidget() + self.wordsOfWorshipPage.setObjectName(u'wordsOfWorshipPage') + self.wordsOfWorshipLayout = QtGui.QVBoxLayout(self.wordsOfWorshipPage) + self.wordsOfWorshipLayout.setSpacing(8) + self.wordsOfWorshipLayout.setMargin(0) + self.wordsOfWorshipLayout.setObjectName(u'wordsOfWorshipLayout') + self.wordsOfWorshipFileListWidget = QtGui.QListWidget(self.wordsOfWorshipPage) + self.wordsOfWorshipFileListWidget.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) + self.wordsOfWorshipFileListWidget.setObjectName(u'wordsOfWorshipFileListWidget') + self.wordsOfWorshipLayout.addWidget(self.wordsOfWorshipFileListWidget) + self.wordsOfWorshipButtonLayout = QtGui.QHBoxLayout() + self.wordsOfWorshipButtonLayout.setSpacing(8) + self.wordsOfWorshipButtonLayout.setObjectName(u'wordsOfWorshipButtonLayout') + self.wordsOfWorshipAddButton = QtGui.QPushButton(self.wordsOfWorshipPage) + self.wordsOfWorshipAddButton.setIcon(openIcon) + self.wordsOfWorshipAddButton.setObjectName(u'wordsOfWorshipAddButton') + self.wordsOfWorshipButtonLayout.addWidget(self.wordsOfWorshipAddButton) + self.wordsOfWorshipButtonSpacer = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.wordsOfWorshipButtonLayout.addItem(self.wordsOfWorshipButtonSpacer) + self.wordsOfWorshipRemoveButton = QtGui.QPushButton(self.wordsOfWorshipPage) + self.wordsOfWorshipRemoveButton.setIcon(deleteIcon) + self.wordsOfWorshipRemoveButton.setObjectName(u'wordsOfWorshipRemoveButton') + self.wordsOfWorshipButtonLayout.addWidget(self.wordsOfWorshipRemoveButton) + self.wordsOfWorshipLayout.addLayout(self.wordsOfWorshipButtonLayout) + self.FormatStackedWidget.addWidget(self.wordsOfWorshipPage) + # CCLI File Import self.CCLIPage = QtGui.QWidget() self.CCLIPage.setObjectName(u'CCLIPage') self.CCLILayout = QtGui.QVBoxLayout(self.CCLIPage) @@ -158,6 +244,8 @@ class Ui_SongImportWizard(object): self.CCLILayout.setMargin(0) self.CCLILayout.setObjectName(u'CCLILayout') self.CCLIFileListWidget = QtGui.QListWidget(self.CCLIPage) + self.CCLIFileListWidget.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) self.CCLIFileListWidget.setObjectName(u'CCLIFileListWidget') self.CCLILayout.addWidget(self.CCLIFileListWidget) self.CCLIButtonLayout = QtGui.QHBoxLayout() @@ -176,31 +264,80 @@ class Ui_SongImportWizard(object): self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton) self.CCLILayout.addLayout(self.CCLIButtonLayout) self.FormatStackedWidget.addWidget(self.CCLIPage) - self.CSVPage = QtGui.QWidget() - self.CSVPage.setObjectName(u'CSVPage') - self.CSVLayout = QtGui.QFormLayout(self.CSVPage) - self.CSVLayout.setMargin(0) - self.CSVLayout.setSpacing(8) - self.CSVLayout.setObjectName(u'CSVLayout') - self.CSVFilenameLabel = QtGui.QLabel(self.CSVPage) - self.CSVFilenameLabel.setObjectName(u'CSVFilenameLabel') - self.CSVLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.CSVFilenameLabel) - self.CSVFileLayout = QtGui.QHBoxLayout() - self.CSVFileLayout.setSpacing(8) - self.CSVFileLayout.setObjectName(u'CSVFileLayout') - self.CSVFilenameEdit = QtGui.QLineEdit(self.CSVPage) - self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit') - self.CSVFileLayout.addWidget(self.CSVFilenameEdit) - self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage) - self.CSVBrowseButton.setIcon(openIcon) - self.CSVBrowseButton.setObjectName(u'CSVBrowseButton') - self.CSVFileLayout.addWidget(self.CSVBrowseButton) - self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.CSVFileLayout) - self.FormatStackedWidget.addWidget(self.CSVPage) + # Songs of Fellowship + self.songsOfFellowshipPage = QtGui.QWidget() + self.songsOfFellowshipPage.setObjectName(u'songsOfFellowshipPage') + self.songsOfFellowshipLayout = QtGui.QFormLayout(self.songsOfFellowshipPage) + self.songsOfFellowshipLayout.setMargin(0) + self.songsOfFellowshipLayout.setSpacing(8) + self.songsOfFellowshipLayout.setObjectName(u'songsOfFellowshipLayout') + self.songsOfFellowshipFilenameLabel = QtGui.QLabel(self.songsOfFellowshipPage) + self.songsOfFellowshipFilenameLabel.setObjectName(u'songsOfFellowshipFilenameLabel') + self.songsOfFellowshipLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.songsOfFellowshipFilenameLabel) + self.songsOfFellowshipFileLayout = QtGui.QHBoxLayout() + self.songsOfFellowshipFileLayout.setSpacing(8) + self.songsOfFellowshipFileLayout.setObjectName(u'songsOfFellowshipFileLayout') + self.songsOfFellowshipFilenameEdit = QtGui.QLineEdit(self.songsOfFellowshipPage) + self.songsOfFellowshipFilenameEdit.setObjectName(u'songsOfFellowshipFilenameEdit') + self.songsOfFellowshipFileLayout.addWidget(self.songsOfFellowshipFilenameEdit) + self.songsOfFellowshipBrowseButton = QtGui.QToolButton(self.songsOfFellowshipPage) + self.songsOfFellowshipBrowseButton.setIcon(openIcon) + self.songsOfFellowshipBrowseButton.setObjectName(u'songsOfFellowshipBrowseButton') + self.songsOfFellowshipFileLayout.addWidget(self.songsOfFellowshipBrowseButton) + self.songsOfFellowshipLayout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.songsOfFellowshipFileLayout) + self.FormatStackedWidget.addWidget(self.songsOfFellowshipPage) + # Generic Document/Presentation Import + self.genericPage = QtGui.QWidget() + self.genericPage.setObjectName(u'genericPage') + self.genericLayout = QtGui.QFormLayout(self.genericPage) + self.genericLayout.setMargin(0) + self.genericLayout.setSpacing(8) + self.genericLayout.setObjectName(u'genericLayout') + self.genericFilenameLabel = QtGui.QLabel(self.genericPage) + self.genericFilenameLabel.setObjectName(u'genericFilenameLabel') + self.genericLayout.setWidget(0, QtGui.QFormLayout.LabelRole, + self.genericFilenameLabel) + self.genericFileLayout = QtGui.QHBoxLayout() + self.genericFileLayout.setSpacing(8) + self.genericFileLayout.setObjectName(u'genericFileLayout') + self.genericFilenameEdit = QtGui.QLineEdit(self.genericPage) + self.genericFilenameEdit.setObjectName(u'genericFilenameEdit') + self.genericFileLayout.addWidget(self.genericFilenameEdit) + self.genericBrowseButton = QtGui.QToolButton(self.genericPage) + self.genericBrowseButton.setIcon(openIcon) + self.genericBrowseButton.setObjectName(u'genericBrowseButton') + self.genericFileLayout.addWidget(self.genericBrowseButton) + self.genericLayout.setLayout(0, QtGui.QFormLayout.FieldRole, + self.genericFileLayout) + self.FormatStackedWidget.addWidget(self.genericPage) +# Commented out for future use. +# self.CSVPage = QtGui.QWidget() +# self.CSVPage.setObjectName(u'CSVPage') +# self.CSVLayout = QtGui.QFormLayout(self.CSVPage) +# self.CSVLayout.setMargin(0) +# self.CSVLayout.setSpacing(8) +# self.CSVLayout.setObjectName(u'CSVLayout') +# self.CSVFilenameLabel = QtGui.QLabel(self.CSVPage) +# self.CSVFilenameLabel.setObjectName(u'CSVFilenameLabel') +# self.CSVLayout.setWidget(0, QtGui.QFormLayout.LabelRole, +# self.CSVFilenameLabel) +# self.CSVFileLayout = QtGui.QHBoxLayout() +# self.CSVFileLayout.setSpacing(8) +# self.CSVFileLayout.setObjectName(u'CSVFileLayout') +# self.CSVFilenameEdit = QtGui.QLineEdit(self.CSVPage) +# self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit') +# self.CSVFileLayout.addWidget(self.CSVFilenameEdit) +# self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage) +# self.CSVBrowseButton.setIcon(openIcon) +# self.CSVBrowseButton.setObjectName(u'CSVBrowseButton') +# self.CSVFileLayout.addWidget(self.CSVBrowseButton) +# self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, +# self.CSVFileLayout) +# self.FormatStackedWidget.addWidget(self.CSVPage) self.SourceLayout.addWidget(self.FormatStackedWidget) - SongImportWizard.addPage(self.SourcePage) + songImportWizard.addPage(self.SourcePage) self.ImportPage = QtGui.QWizardPage() self.ImportPage.setObjectName(u'ImportPage') self.ImportLayout = QtGui.QVBoxLayout(self.ImportPage) @@ -215,16 +352,16 @@ class Ui_SongImportWizard(object): self.ImportProgressBar.setInvertedAppearance(False) self.ImportProgressBar.setObjectName(u'ImportProgressBar') self.ImportLayout.addWidget(self.ImportProgressBar) - SongImportWizard.addPage(self.ImportPage) - self.retranslateUi(SongImportWizard) + songImportWizard.addPage(self.ImportPage) + self.retranslateUi(songImportWizard) self.FormatStackedWidget.setCurrentIndex(0) QtCore.QObject.connect(self.FormatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.FormatStackedWidget.setCurrentIndex) - QtCore.QMetaObject.connectSlotsByName(SongImportWizard) + QtCore.QMetaObject.connectSlotsByName(songImportWizard) - def retranslateUi(self, SongImportWizard): - SongImportWizard.setWindowTitle( + def retranslateUi(self, songImportWizard): + songImportWizard.setWindowTitle( translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) self.TitleLabel.setText( u'%s' % \ @@ -243,29 +380,60 @@ class Ui_SongImportWizard(object): self.FormatLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Format:')) self.FormatComboBox.setItemText(0, - translate('SongsPlugin.ImportWizardForm', 'OpenLyrics')) + translate('SongsPlugin.ImportWizardForm', 'OpenLP 2.0')) self.FormatComboBox.setItemText(1, - translate('SongsPlugin.ImportWizardForm', 'OpenSong')) + translate('SongsPlugin.ImportWizardForm', 'openlp.org 1.x')) self.FormatComboBox.setItemText(2, - translate('SongsPlugin.ImportWizardForm', 'CCLI')) + translate('SongsPlugin.ImportWizardForm', 'OpenLyrics')) self.FormatComboBox.setItemText(3, - translate('SongsPlugin.ImportWizardForm', 'CSV')) - self.OpenLyricsAddButton.setText( + translate('SongsPlugin.ImportWizardForm', 'OpenSong')) + self.FormatComboBox.setItemText(4, + translate('SongsPlugin.ImportWizardForm', 'Words of Worship')) + self.FormatComboBox.setItemText(5, + translate('SongsPlugin.ImportWizardForm', 'CCLI')) + self.FormatComboBox.setItemText(6, + translate('SongsPlugin.ImportWizardForm', 'Songs of Fellowship')) + self.FormatComboBox.setItemText(7, + translate('SongsPlugin.ImportWizardForm', + 'Generic Document/Presentation')) +# self.FormatComboBox.setItemText(8, +# translate('SongsPlugin.ImportWizardForm', 'CSV')) + self.openLP2FilenameLabel.setText( + translate('SongsPlugin.ImportWizardForm', 'Filename:')) + self.openLP2BrowseButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.openLP1FilenameLabel.setText( + translate('SongsPlugin.ImportWizardForm', 'Filename:')) + self.openLP1BrowseButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.openLyricsAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) - self.OpenLyricsRemoveButton.setText( + self.openLyricsRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) - self.OpenSongAddButton.setText( + self.openSongAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) - self.OpenSongRemoveButton.setText( + self.openSongRemoveButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) + self.wordsOfWorshipAddButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Add Files...')) + self.wordsOfWorshipRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) self.CCLIAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.CCLIRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) - self.CSVFilenameLabel.setText( + self.songsOfFellowshipFilenameLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Filename:')) - self.CSVBrowseButton.setText( + self.songsOfFellowshipBrowseButton.setText( translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.genericFilenameLabel.setText( + translate('SongsPlugin.ImportWizardForm', 'Filename:')) + self.genericBrowseButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Browse...')) +# self.CSVFilenameLabel.setText( +# translate('SongsPlugin.ImportWizardForm', 'Filename:')) +# self.CSVBrowseButton.setText( +# translate('SongsPlugin.ImportWizardForm', 'Browse...')) self.ImportPage.setTitle( translate('SongsPlugin.ImportWizardForm', 'Importing')) self.ImportPage.setSubTitle( diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index b8f4d9a05..396650ff2 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -26,7 +26,8 @@ from openlp.core.lib import translate -#from openlp.plugins.songs.lib import OpenLyricsSong, OpenSongSong, CCLISong, \ +from openlp.plugins.songs.lib import OpenLPSongImport, OpenSongImport, \ + OooImport, SofImport # CSVSong class SongFormat(object): @@ -36,10 +37,15 @@ class SongFormat(object): for importing. """ Unknown = -1 - OpenLyrics = 0 - OpenSong = 1 - CCLI = 2 - CSV = 3 + OpenLP2 = 0 + OpenLP1 = 1 + OpenLyrics = 2 + OpenSong = 3 + WordsOfWorship = 4 + CCLI = 5 + SongsOfFellowship = 6 + Generic = 7 + CSV = 8 @staticmethod def get_class(format): @@ -49,14 +55,14 @@ class SongFormat(object): ``format`` The song format. """ -# if format == SongFormat.OpenLyrics: -# return OpenLyricsSong -# elif format == SongFormat.OpenSong: -# return OpenSongSong -# elif format == SongFormat.CCLI: -# return CCLISong -# elif format == SongFormat.CSV: -# return CSVSong + if format == SongFormat.OpenLP2: + return OpenLPSongImport + elif format == SongFormat.OpenSong: + return OpenSongImport + elif format == SongFormat.SongsOfFellowship: + return SofImport + elif format == SongFormat.Generic: + return OooImport # else: return None @@ -66,10 +72,14 @@ class SongFormat(object): Return a list of the supported song formats. """ return [ + SongFormat.OpenLP2, + SongFormat.OpenLP1, SongFormat.OpenLyrics, SongFormat.OpenSong, + SongFormat.WordsOfWorship, SongFormat.CCLI, - SongFormat.CSV + SongFormat.SongsOfFellowship, + SongFormat.Generic ] class VerseType(object): From ef44dc72c68fcd12244dc336bd33d53ef41098ca Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 23 Aug 2010 21:29:39 +0200 Subject: [PATCH 3/8] Changed the Generic importer to multifile as well. --- openlp/plugins/songs/forms/songimportform.py | 41 +++++++---- .../plugins/songs/forms/songimportwizard.py | 72 ++++++++----------- openlp/plugins/songs/lib/olpimport.py | 1 + 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index a4f1aedc0..e310a2509 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -97,9 +97,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): QtCore.QObject.connect(self.songsOfFellowshipRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onSongsOfFellowshipRemoveButtonClicked) - QtCore.QObject.connect(self.genericBrowseButton, + QtCore.QObject.connect(self.genericAddButton, QtCore.SIGNAL(u'clicked()'), - self.onGenericBrowseButtonClicked) + self.onGenericAddButtonClicked) + QtCore.QObject.connect(self.genericRemoveButton, + QtCore.SIGNAL(u'clicked()'), + self.onGenericRemoveButtonClicked) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL(u'clicked(bool)'), self.onCancelButtonClicked) @@ -185,24 +188,24 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.ccliAddButton.setFocus() return False elif source_format == SongFormat.SongsOfFellowship: - if self.songsOfFellowshipFilenameEdit.text().isEmpty(): + if self.songsOfFellowshipFileListWidget.count() == 0: QtGui.QMessageBox.critical(self, translate('SongsPlugin.ImportWizardForm', 'No Songs of Fellowship File Selected'), translate('SongsPlugin.ImportWizardForm', - 'You need to select a Songs of Fellowship file to ' - 'import from.')) - self.songsOfFellowshipBrowseButton.setFocus() + 'You need to add at least one Songs of Fellowship ' + 'file to import from.')) + self.songsOfFellowshipAddButton.setFocus() return False elif source_format == SongFormat.Generic: - if self.genericFilenameEdit.text().isEmpty(): + if self.genericFileListWidget.count() == 0: QtGui.QMessageBox.critical(self, translate('SongsPlugin.ImportWizardForm', 'No Document/Presentation Selected'), translate('SongsPlugin.ImportWizardForm', - 'You need to select a document/presentation file ' - 'to import from.')) - self.genericBrowseButton.setFocus() + 'You need to add at least one document or ' + 'presentation file to import from.')) + self.genericAddButton.setFocus() return False return True elif self.currentId() == 2: @@ -292,13 +295,16 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): def onSongsOfFellowshipRemoveButtonClicked(self): self.removeSelectedItems(self.songsOfFellowshipFileListWidget) - def onGenericBrowseButtonClicked(self): - self.getFileName( + def onGenericAddButtonClicked(self): + self.getFiles( translate('SongsPlugin.ImportWizardForm', - 'Select Document/Presentation File'), - self.genericFilenameEdit + 'Select Document/Presentation Files'), + self.genericFileListWidget ) + def onGenericRemoveButtonClicked(self): + self.removeSelectedItems(self.genericFileListWidget) + def onCancelButtonClicked(self, checked): """ Stop the import on pressing the cancel button. @@ -325,7 +331,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.wordsOfWorshipFileListWidget.clear() self.ccliFileListWidget.clear() self.songsOfFellowshipFileListWidget.clear() - self.genericFilenameEdit.setText(u'') + self.genericFileListWidget.clear() #self.csvFilenameEdit.setText(u'') def incrementProgressBar(self, status_text): @@ -386,6 +392,11 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): importer = self.plugin.importSongs(SongFormat.SongsOfFellowship, filenames=self.getListOfFiles(self.songsOfFellowshipFileListWidget) ) + elif source_format == SongFormat.Generic: + # Import a generic document or presentatoin + importer = self.plugin.importSongs(SongFormat.Generic, + filenames=self.getListOfFiles(self.genericFileListWidget) + ) success = importer.do_import() if success: # reload songs diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py index 20de94721..f1898d107 100644 --- a/openlp/plugins/songs/forms/songimportwizard.py +++ b/openlp/plugins/songs/forms/songimportwizard.py @@ -291,46 +291,34 @@ class Ui_SongImportWizard(object): self.songsOfFellowshipRemoveButton.setObjectName(u'songsOfFellowshipRemoveButton') self.songsOfFellowshipButtonLayout.addWidget(self.songsOfFellowshipRemoveButton) self.songsOfFellowshipLayout.addLayout(self.songsOfFellowshipButtonLayout) -# self.songsOfFellowshipFilenameLabel = QtGui.QLabel(self.songsOfFellowshipPage) -# self.songsOfFellowshipFilenameLabel.setObjectName(u'songsOfFellowshipFilenameLabel') -# self.songsOfFellowshipLayout.setWidget(0, QtGui.QFormLayout.LabelRole, -# self.songsOfFellowshipFilenameLabel) -# self.songsOfFellowshipFileLayout = QtGui.QHBoxLayout() -# self.songsOfFellowshipFileLayout.setSpacing(8) -# self.songsOfFellowshipFileLayout.setObjectName(u'songsOfFellowshipFileLayout') -# self.songsOfFellowshipFilenameEdit = QtGui.QLineEdit(self.songsOfFellowshipPage) -# self.songsOfFellowshipFilenameEdit.setObjectName(u'songsOfFellowshipFilenameEdit') -# self.songsOfFellowshipFileLayout.addWidget(self.songsOfFellowshipFilenameEdit) -# self.songsOfFellowshipBrowseButton = QtGui.QToolButton(self.songsOfFellowshipPage) -# self.songsOfFellowshipBrowseButton.setIcon(openIcon) -# self.songsOfFellowshipBrowseButton.setObjectName(u'songsOfFellowshipBrowseButton') -# self.songsOfFellowshipFileLayout.addWidget(self.songsOfFellowshipBrowseButton) -# self.songsOfFellowshipLayout.setLayout(0, QtGui.QFormLayout.FieldRole, -# self.songsOfFellowshipFileLayout) self.formatStackedWidget.addWidget(self.songsOfFellowshipPage) # Generic Document/Presentation import self.genericPage = QtGui.QWidget() self.genericPage.setObjectName(u'genericPage') - self.genericLayout = QtGui.QFormLayout(self.genericPage) + self.genericLayout = QtGui.QVBoxLayout(self.genericPage) self.genericLayout.setMargin(0) self.genericLayout.setSpacing(8) self.genericLayout.setObjectName(u'genericLayout') - self.genericFilenameLabel = QtGui.QLabel(self.genericPage) - self.genericFilenameLabel.setObjectName(u'genericFilenameLabel') - self.genericLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.genericFilenameLabel) - self.genericFileLayout = QtGui.QHBoxLayout() - self.genericFileLayout.setSpacing(8) - self.genericFileLayout.setObjectName(u'genericFileLayout') - self.genericFilenameEdit = QtGui.QLineEdit(self.genericPage) - self.genericFilenameEdit.setObjectName(u'genericFilenameEdit') - self.genericFileLayout.addWidget(self.genericFilenameEdit) - self.genericBrowseButton = QtGui.QToolButton(self.genericPage) - self.genericBrowseButton.setIcon(openIcon) - self.genericBrowseButton.setObjectName(u'genericBrowseButton') - self.genericFileLayout.addWidget(self.genericBrowseButton) - self.genericLayout.setLayout(0, QtGui.QFormLayout.FieldRole, - self.genericFileLayout) + self.genericFileListWidget = QtGui.QListWidget(self.genericPage) + self.genericFileListWidget.setSelectionMode( + QtGui.QAbstractItemView.ExtendedSelection) + self.genericFileListWidget.setObjectName(u'genericFileListWidget') + self.genericLayout.addWidget(self.genericFileListWidget) + self.genericButtonLayout = QtGui.QHBoxLayout() + self.genericButtonLayout.setSpacing(8) + self.genericButtonLayout.setObjectName(u'genericButtonLayout') + self.genericAddButton = QtGui.QPushButton(self.genericPage) + self.genericAddButton.setIcon(openIcon) + self.genericAddButton.setObjectName(u'genericAddButton') + self.genericButtonLayout.addWidget(self.genericAddButton) + self.genericButtonSpacer = QtGui.QSpacerItem(40, 20, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.genericButtonLayout.addItem(self.genericButtonSpacer) + self.genericRemoveButton = QtGui.QPushButton(self.genericPage) + self.genericRemoveButton.setIcon(deleteIcon) + self.genericRemoveButton.setObjectName(u'genericRemoveButton') + self.genericButtonLayout.addWidget(self.genericRemoveButton) + self.genericLayout.addLayout(self.genericButtonLayout) self.formatStackedWidget.addWidget(self.genericPage) # Commented out for future use. # self.csvPage = QtGui.QWidget() @@ -382,18 +370,18 @@ class Ui_SongImportWizard(object): def retranslateUi(self, songImportWizard): songImportWizard.setWindowTitle( - translate('SongsPlugin.ImportWizardForm', 'Song import Wizard')) + translate('SongsPlugin.ImportWizardForm', 'Song Import Wizard')) self.titleLabel.setText( u'%s' % \ translate('SongsPlugin.ImportWizardForm', - 'Welcome to the Song import Wizard')) + 'Welcome to the Song Import Wizard')) self.informationLabel.setText( translate('SongsPlugin.ImportWizardForm', 'This wizard will help you to import songs from a variety of ' 'formats. Click the next button below to start the process by ' 'selecting a format to import from.')) self.sourcePage.setTitle( - translate('SongsPlugin.ImportWizardForm', 'Select import Source')) + translate('SongsPlugin.ImportWizardForm', 'Select Import Source')) self.sourcePage.setSubTitle( translate('SongsPlugin.ImportWizardForm', 'Select the import format, and where to import from.')) @@ -410,7 +398,7 @@ class Ui_SongImportWizard(object): self.formatComboBox.setItemText(4, translate('SongsPlugin.ImportWizardForm', 'Words of Worship')) self.formatComboBox.setItemText(5, - translate('SongsPlugin.ImportWizardForm', 'CCLI')) + translate('SongsPlugin.ImportWizardForm', 'CCLI/SongSelect')) self.formatComboBox.setItemText(6, translate('SongsPlugin.ImportWizardForm', 'Songs of Fellowship')) self.formatComboBox.setItemText(7, @@ -446,16 +434,16 @@ class Ui_SongImportWizard(object): translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.songsOfFellowshipRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) - self.genericFilenameLabel.setText( - translate('SongsPlugin.ImportWizardForm', 'Filename:')) - self.genericBrowseButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Browse...')) + self.genericAddButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Add Files...')) + self.genericRemoveButton.setText( + translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) # self.csvFilenameLabel.setText( # translate('SongsPlugin.ImportWizardForm', 'Filename:')) # self.csvBrowseButton.setText( # translate('SongsPlugin.ImportWizardForm', 'Browse...')) self.importPage.setTitle( - translate('SongsPlugin.ImportWizardForm', 'importing')) + translate('SongsPlugin.ImportWizardForm', 'Importing')) self.importPage.setSubTitle( translate('SongsPlugin.ImportWizardForm', 'Please wait while your songs are imported.')) diff --git a/openlp/plugins/songs/lib/olpimport.py b/openlp/plugins/songs/lib/olpimport.py index 39dd01916..a4c15718e 100644 --- a/openlp/plugins/songs/lib/olpimport.py +++ b/openlp/plugins/songs/lib/olpimport.py @@ -85,6 +85,7 @@ class OpenLPSongImport(SongImport): ``source_db`` The database providing the data to import. """ + SongImport.__init__(self, master_manager) self.master_manager = master_manager self.import_source = u'sqlite:///%s' % kwargs[u'filename'] log.debug(self.import_source) From 788e8a2b5570ffe1117ca940c165baa89171ffbd Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 24 Aug 2010 10:08:07 +0200 Subject: [PATCH 4/8] Fixed a problem with the getListOfFiles function which was returning a list of repr'd QListWidgetItems instead of a list of strings. Made a SongFormat.ccli -> SongFormat.CCLI after renaming some fields caught this too. --- openlp/plugins/songs/forms/songimportform.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index e310a2509..5bf0af06c 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -177,7 +177,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): 'file to import from.')) self.wordsOfWorshipAddButton.setFocus() return False - elif source_format == SongFormat.ccli: + elif source_format == SongFormat.CCLI: if self.ccliFileListWidget.count() == 0: QtGui.QMessageBox.critical(self, translate('SongsPlugin.ImportWizardForm', @@ -233,7 +233,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): def getListOfFiles(self, listbox): files = [] for row in range(0, listbox.count()): - files.append(unicode(listbox.item(row))) + files.append(unicode(listbox.item(row).text())) return files def removeSelectedItems(self, listbox): From 25f6bb33e7629b48af52296a62278f4a193d0b2a Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 24 Aug 2010 17:25:26 +0200 Subject: [PATCH 5/8] Made changes suggested/requested by Jonathan C. --- openlp/plugins/songs/forms/songimportform.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 5bf0af06c..b8d3085fd 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -311,7 +311,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): """ log.debug('Cancel button pressed!') if self.currentId() == 3: - Receiver.send_message(u'openlp_stop_song_import') + Receiver.send_message(u'song_stop_import') def onCurrentIdChanged(self, id): if id == 2: @@ -338,7 +338,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): log.debug(u'IncrementBar %s', status_text) self.importProgressLabel.setText(status_text) self.importProgressBar.setValue(self.importProgressBar.value() + 1) - Receiver.send_message(u'process_events') + Receiver.send_message(u'openlp_process_events') def preImport(self): self.finishButton.setVisible(False) @@ -347,7 +347,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.importProgressBar.setValue(0) self.importProgressLabel.setText( translate('SongsPlugin.ImportWizardForm', 'Starting import...')) - Receiver.send_message(u'process_events') + Receiver.send_message(u'openlp_process_events') def performImport(self): """ @@ -411,4 +411,4 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.importProgressBar.setValue(self.importProgressBar.maximum()) self.finishButton.setVisible(True) self.cancelButton.setVisible(False) - Receiver.send_message(u'process_events') + Receiver.send_message(u'openlp_process_events') From 70cd4bc7002c6969ced4f014aec1d023dc559ee7 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 24 Aug 2010 17:28:45 +0200 Subject: [PATCH 6/8] Added an extra argument to the incrementProgressBar function so that an increment can be specified (like 0, if you don't want an increment). --- openlp/plugins/songs/forms/songimportform.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index b8d3085fd..53b0a9804 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -334,10 +334,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.genericFileListWidget.clear() #self.csvFilenameEdit.setText(u'') - def incrementProgressBar(self, status_text): + def incrementProgressBar(self, status_text, increment=1): log.debug(u'IncrementBar %s', status_text) - self.importProgressLabel.setText(status_text) - self.importProgressBar.setValue(self.importProgressBar.value() + 1) + if increment > 0: + self.importProgressLabel.setText(status_text) + self.importProgressBar.setValue(self.importProgressBar.value() + + increment) Receiver.send_message(u'openlp_process_events') def preImport(self): From 78889633f67279ba75a5d379de9e6e144b1e8903 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 24 Aug 2010 17:31:33 +0200 Subject: [PATCH 7/8] Changed incrementProgressBar again slightly so that passing a blank string or None to the text will not update the text. --- openlp/plugins/songs/forms/songimportform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 53b0a9804..35829d7e6 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -336,8 +336,9 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): def incrementProgressBar(self, status_text, increment=1): log.debug(u'IncrementBar %s', status_text) - if increment > 0: + if status_text: self.importProgressLabel.setText(status_text) + if increment > 0: self.importProgressBar.setValue(self.importProgressBar.value() + increment) Receiver.send_message(u'openlp_process_events') From 8b141b0942ec99190f854415cbb948f08b70583e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 24 Aug 2010 21:08:57 +0200 Subject: [PATCH 8/8] Fixed the couple of issues Jon T. pointed out. --- openlp/plugins/songs/forms/songimportform.py | 20 +-- openlp/plugins/songs/lib/mediaitem.py | 4 +- openlp/plugins/songs/songsplugin.py | 141 +------------------ 3 files changed, 10 insertions(+), 155 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 35829d7e6..b997238a9 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -43,19 +43,13 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): """ log.info(u'SongImportForm loaded') - def __init__(self, parent, manager, plugin): + def __init__(self, parent, plugin): """ Instantiate the wizard, and run any extra setup we need to. ``parent`` The QWidget-derived parent of the wizard. - ``config`` - The configuration object for storing and retrieving settings. - - ``manager`` - The songs manager. - ``plugin`` The songs plugin. """ @@ -64,9 +58,7 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.registerFields() self.finishButton = self.button(QtGui.QWizard.FinishButton) self.cancelButton = self.button(QtGui.QWizard.CancelButton) - self.manager = manager self.plugin = plugin - #self.manager.set_process_dialog(self) QtCore.QObject.connect(self.openLP2BrowseButton, QtCore.SIGNAL(u'clicked()'), self.onOpenLP2BrowseButtonClicked) @@ -383,7 +375,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): elif source_format == SongFormat.WordsOfWorship: # Import Words Of Worship songs importer = self.plugin.importSongs(SongFormat.WordsOfWorship, - filenames=self.getListOfFiles(self.wordsOfWorshipFileListWidget) + filenames=self.getListOfFiles( + self.wordsOfWorshipFileListWidget) ) elif source_format == SongFormat.CCLI: # Import Words Of Worship songs @@ -393,7 +386,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): elif source_format == SongFormat.SongsOfFellowship: # Import a Songs of Fellowship RTF file importer = self.plugin.importSongs(SongFormat.SongsOfFellowship, - filenames=self.getListOfFiles(self.songsOfFellowshipFileListWidget) + filenames=self.getListOfFiles( + self.songsOfFellowshipFileListWidget) ) elif source_format == SongFormat.Generic: # Import a generic document or presentatoin @@ -403,10 +397,10 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): success = importer.do_import() if success: # reload songs - self.ImportProgressLabel.setText( + self.importProgressLabel.setText( translate('SongsPlugin.SongImportForm', 'Finished import.')) else: - self.ImportProgressLabel.setText( + self.importProgressLabel.setText( translate('SongsPlugin.SongImportForm', 'Your song import failed.')) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 831d7e31a..85ba1cf06 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -237,9 +237,9 @@ class SongMediaItem(MediaManagerItem): def onImportClick(self): if not hasattr(self, u'import_wizard'): - self.import_wizard = ImportWizardForm(self, self.parent.manager, - self.parent) + self.import_wizard = ImportWizardForm(self, self.parent) self.import_wizard.exec_() + Receiver.send_message(u'songs_load_list') def onNewClick(self): self.edit_song_form.newSong() diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 13be291cb..0064be23a 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -28,19 +28,12 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, build_icon, Receiver, translate +from openlp.core.lib import Plugin, build_icon, translate from openlp.core.lib.db import Manager from openlp.plugins.songs.lib import SongMediaItem, SongsTab from openlp.plugins.songs.lib.db import init_schema, Song from openlp.plugins.songs.lib.importer import SongFormat -#try: -# from openlp.plugins.songs.lib import SofImport, OooImport -# OOo_available = True -#except ImportError: -# OOo_available = False -#from openlp.plugins.songs.lib import OpenSongImport - log = logging.getLogger(__name__) class SongsPlugin(Plugin): @@ -99,76 +92,6 @@ class SongsPlugin(Plugin): # Signals and slots QtCore.QObject.connect(self.SongImportItem, QtCore.SIGNAL(u'triggered()'), self.onSongImportItemClicked) -# 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) -# # OpenSong import menu item - will be removed and the -# # functionality will be contained within the import wizard -# self.ImportOpenSongItem = QtGui.QAction(import_menu) -# self.ImportOpenSongItem.setObjectName(u'ImportOpenSongItem') -# self.ImportOpenSongItem.setText( -# translate('SongsPlugin', -# 'OpenSong (temp menu item)')) -# self.ImportOpenSongItem.setToolTip( -# translate('SongsPlugin', -# 'Import songs from OpenSong files' + -# '(either raw text or ZIPfiles)')) -# self.ImportOpenSongItem.setStatusTip( -# translate('SongsPlugin', -# 'Import songs from OpenSong files' + -# '(either raw text or ZIPfiles)')) -# import_menu.addAction(self.ImportOpenSongItem) -# QtCore.QObject.connect(self.ImportOpenSongItem, -# QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick) -# # OpenLP v2 import menu item - ditto above regarding refactoring into -# # an import wizard -# self.ImportOpenLPSongItem = QtGui.QAction(import_menu) -# self.ImportOpenLPSongItem.setObjectName(u'ImportOpenLPSongItem') -# self.ImportOpenLPSongItem.setText(translate('SongsPlugin', -# 'OpenLP v2 Songs (temporary)')) -# self.ImportOpenLPSongItem.setToolTip(translate('SongsPlugin', -# 'Import an OpenLP v2 song database')) -# self.ImportOpenLPSongItem.setStatusTip(translate('SongsPlugin', -# 'Import an OpenLP v2 song database')) -# import_menu.addAction(self.ImportOpenLPSongItem) -# QtCore.QObject.connect(self.ImportOpenLPSongItem, -# QtCore.SIGNAL(u'triggered()'), self.onImportOpenLPSongItemClick) def addExportMenuItem(self, export_menu): """ @@ -186,68 +109,6 @@ class SongsPlugin(Plugin): if self.mediaItem: self.mediaItem.onImportClick() -# def onImportSofItemClick(self): -# filenames = QtGui.QFileDialog.getOpenFileNames( -# None, translate('SongsPlugin', -# 'Open Songs of Fellowship file'), -# u'', u'Songs of Fellowship file (*.rtf *.RTF)') -# try: -# for filename in filenames: -# sofimport = SofImport(self.manager) -# sofimport.import_sof(unicode(filename)) -# except: -# log.exception('Could not import SoF file') -# QtGui.QMessageBox.critical(None, -# translate('SongsPlugin', 'Import Error'), -# translate('SongsPlugin', 'Error importing Songs of ' -# 'Fellowship file.\nOpenOffice.org must be installed' -# ' and you must be using an unedited copy of the RTF' -# ' included with the Songs of Fellowship Music Editions')) -# Receiver.send_message(u'songs_load_list') -# -# def onImportOpenSongItemClick(self): -# filenames = QtGui.QFileDialog.getOpenFileNames( -# None, translate('SongsPlugin', -# 'Open OpenSong file'), -# u'', u'All files (*.*)') -# try: -# for filename in filenames: -# importer = OpenSongImport(self.manager) -# importer.do_import(unicode(filename)) -# except: -# log.exception('Could not import OpenSong file') -# QtGui.QMessageBox.critical(None, -# translate('SongsPlugin', 'Import Error'), -# translate('SongsPlugin', 'Error importing OpenSong file')) -# Receiver.send_message(u'songs_load_list') -# -# def onImportOpenLPSongItemClick(self): -# filenames = QtGui.QFileDialog.getOpenFileNames(None, -# translate('SongsPlugin', 'Select OpenLP database(s) to import...'), -# u'', u'OpenLP databases (*.sqlite);;All Files (*)') -# try: -# for filename in filenames: -# db_url = u'sqlite:///%s' % filename -# importer = OpenLPSongImport(self.manager, db_url) -# importer.import_source_v2_db() -# QtGui.QMessageBox.information(None, translate('SongsPlugin', -# 'Database(s) imported'), translate('SongsPlugin', 'Your ' -# 'OpenLP v2 song databases have been successfully imported')) -# except: -# log.exception(u'Failed to import OpenLP v2 database(s)') -# QtGui.QMessageBox.critical(None, translate('SongsPlugin', -# 'Import Error'), translate('SongsPlugin', -# 'Error importing OpenLP v2 database(s)')) -# Receiver.send_message(u'songs_load_list') -# -# def onImportOooItemClick(self): -# filenames = QtGui.QFileDialog.getOpenFileNames( -# None, translate('SongsPlugin', 'Open documents or presentations'), -# '', u'All Files(*.*)') -# oooimport = OooImport(self.manager) -# oooimport.import_docs(filenames) -# 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 '