diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index c4b1181b1..c0472cce8 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -94,6 +94,7 @@ class UiStrings(object): self.NewService = translate('OpenLP.Ui', 'New Service') self.NewTheme = translate('OpenLP.Ui', 'New Theme') self.NextTrack = translate('OpenLP.Ui', 'Next Track') + self.NFdSs = translate('OpenLP.Ui', 'No Folder Selected', 'Singular') self.NFSs = translate('OpenLP.Ui', 'No File Selected', 'Singular') self.NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural') self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular') diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 5f81e670d..7382fb7e0 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -72,11 +72,14 @@ class WizardStrings(object): 'importer, you will need to install the "python-sqlite" ' 'module.') OpenTypeFile = unicode(translate('OpenLP.Ui', 'Open %s File')) + OpenTypeFolder = unicode(translate('OpenLP.Ui', 'Open %s Folder')) PercentSymbolFormat = unicode(translate('OpenLP.Ui', '%p%')) Ready = translate('OpenLP.Ui', 'Ready.') StartingImport = translate('OpenLP.Ui', 'Starting import...') YouSpecifyFile = unicode(translate('OpenLP.Ui', 'You need to specify at ' 'least one %s file to import from.', 'A file type e.g. OpenSong')) + YouSpecifyFolder = unicode(translate('OpenLP.Ui', 'You need to specify a ' + '%s folder to import from.', 'A file type e.g. OpenSong')) class OpenLPWizard(QtGui.QWizard): diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index d5f7715ea..063efe34e 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -105,6 +105,9 @@ class SongImportForm(OpenLPWizard): QtCore.QObject.connect(self.openLP1BrowseButton, QtCore.SIGNAL(u'clicked()'), self.onOpenLP1BrowseButtonClicked) + QtCore.QObject.connect(self.powerSongBrowseButton, + QtCore.SIGNAL(u'clicked()'), + self.onPowerSongBrowseButtonClicked) QtCore.QObject.connect(self.openLyricsAddButton, QtCore.SIGNAL(u'clicked()'), self.onOpenLyricsAddButtonClicked) @@ -171,12 +174,6 @@ class SongImportForm(OpenLPWizard): QtCore.QObject.connect(self.foilPresenterRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onFoilPresenterRemoveButtonClicked) - QtCore.QObject.connect(self.powerSongAddButton, - QtCore.SIGNAL(u'clicked()'), - self.onPowerSongAddButtonClicked) - QtCore.QObject.connect(self.powerSongRemoveButton, - QtCore.SIGNAL(u'clicked()'), - self.onPowerSongRemoveButtonClicked) def addCustomPages(self): """ @@ -224,7 +221,7 @@ class SongImportForm(OpenLPWizard): # Open Song self.addFileSelectItem(u'openSong', u'OpenSong') # PowerSong - self.addFileSelectItem(u'powerSong') + self.addFileSelectItem(u'powerSong', single_select=True) # SongBeamer self.addFileSelectItem(u'songBeamer') # Song Show Plus @@ -290,6 +287,9 @@ class SongImportForm(OpenLPWizard): translate('SongsPlugin.ImportWizardForm', 'Filename:')) self.openLP1BrowseButton.setText(UiStrings().Browse) self.openLP1DisabledLabel.setText(WizardStrings.NoSqlite) + self.powerSongFilenameLabel.setText( + translate('SongsPlugin.ImportWizardForm', 'Folder:')) + self.powerSongBrowseButton.setText(UiStrings().Browse) self.openLyricsAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.openLyricsRemoveButton.setText( @@ -315,10 +315,6 @@ class SongImportForm(OpenLPWizard): translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.dreamBeamRemoveButton.setText( translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) - self.powerSongAddButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Add Files...')) - self.powerSongRemoveButton.setText( - translate('SongsPlugin.ImportWizardForm', 'Remove File(s)')) self.songsOfFellowshipAddButton.setText( translate('SongsPlugin.ImportWizardForm', 'Add Files...')) self.songsOfFellowshipRemoveButton.setText( @@ -401,6 +397,12 @@ class SongImportForm(OpenLPWizard): WizardStrings.YouSpecifyFile % UiStrings().OLPV1) self.openLP1BrowseButton.setFocus() return False + elif source_format == SongFormat.PowerSong: + if self.powerSongFilenameEdit.text().isEmpty(): + critical_error_message_box(UiStrings().NFdSs, + WizardStrings.YouSpecifyFolder % WizardStrings.PS) + self.powerSongBrowseButton.setFocus() + return False elif source_format == SongFormat.OpenLyrics: if self.openLyricsFileListWidget.count() == 0: critical_error_message_box(UiStrings().NFSp, @@ -431,12 +433,6 @@ class SongImportForm(OpenLPWizard): WizardStrings.YouSpecifyFile % WizardStrings.DB) self.dreamBeamAddButton.setFocus() return False - elif source_format == SongFormat.PowerSong: - if self.powerSongFileListWidget.count() == 0: - critical_error_message_box(UiStrings().NFSp, - WizardStrings.YouSpecifyFile % WizardStrings.PS) - self.powerSongAddButton.setFocus() - return False elif source_format == SongFormat.SongsOfFellowship: if self.songsOfFellowshipFileListWidget.count() == 0: critical_error_message_box(UiStrings().NFSp, @@ -546,6 +542,13 @@ class SongImportForm(OpenLPWizard): 'openlp.org v1.x Databases') ) + def onPowerSongBrowseButtonClicked(self): + """ + Get PowerSong song database folder + """ + self.getFolder(WizardStrings.OpenTypeFolder % WizardStrings.PS, + self.powerSongFilenameEdit) + def onOpenLyricsAddButtonClicked(self): """ Get OpenLyrics song database files @@ -620,22 +623,6 @@ class SongImportForm(OpenLPWizard): """ self.removeSelectedItems(self.dreamBeamFileListWidget) - def onPowerSongAddButtonClicked(self): - """ - Get PowerSong song database files - """ - self.getFiles(WizardStrings.OpenTypeFile % WizardStrings.PS, - self.powerSongFileListWidget, u'%s (*.song)' - % translate('SongsPlugin.ImportWizardForm', - 'PowerSong 1.0 Song Files') - ) - - def onPowerSongRemoveButtonClicked(self): - """ - Remove selected PowerSong files from the import list - """ - self.removeSelectedItems(self.powerSongFileListWidget) - def onSongsOfFellowshipAddButtonClicked(self): """ Get Songs of Fellowship song database files @@ -748,12 +735,12 @@ class SongImportForm(OpenLPWizard): self.formatComboBox.setCurrentIndex(last_import_type) self.openLP2FilenameEdit.setText(u'') self.openLP1FilenameEdit.setText(u'') + self.powerSongFilenameEdit.setText(u'') self.openLyricsFileListWidget.clear() self.openSongFileListWidget.clear() self.wordsOfWorshipFileListWidget.clear() self.ccliFileListWidget.clear() self.dreamBeamFileListWidget.clear() - self.powerSongFileListWidget.clear() self.songsOfFellowshipFileListWidget.clear() self.genericFileListWidget.clear() self.easySlidesFilenameEdit.setText(u'') @@ -794,6 +781,11 @@ class SongImportForm(OpenLPWizard): filename=unicode(self.openLP1FilenameEdit.text()), plugin=self.plugin ) + elif source_format == SongFormat.PowerSong: + # Import PowerSong folder + importer = self.plugin.importSongs(SongFormat.PowerSong, + filename=unicode(self.powerSongFilenameEdit.text()) + ) elif source_format == SongFormat.OpenLyrics: # Import OpenLyrics songs importer = self.plugin.importSongs(SongFormat.OpenLyrics, @@ -821,12 +813,6 @@ class SongImportForm(OpenLPWizard): filenames=self.getListOfFiles( self.dreamBeamFileListWidget) ) - elif source_format == SongFormat.PowerSong: - # Import PowerSong songs - importer = self.plugin.importSongs(SongFormat.PowerSong, - filenames=self.getListOfFiles( - self.powerSongFileListWidget) - ) elif source_format == SongFormat.SongsOfFellowship: # Import a Songs of Fellowship RTF file importer = self.plugin.importSongs(SongFormat.SongsOfFellowship,