forked from openlp/openlp
Fix file extensions
bzr-revno: 1157
This commit is contained in:
commit
c6d408f0e1
@ -253,14 +253,16 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
|||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(
|
||||||
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
|
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
|
||||||
self.booksLocationEdit)
|
self.booksLocationEdit, u'%s (*.csv)'
|
||||||
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
def onCsvVersesFileButtonClicked(self):
|
def onCsvVersesFileButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Show the file open dialog for the verses CSV file.
|
Show the file open dialog for the verses CSV file.
|
||||||
"""
|
"""
|
||||||
self.getFileName(translate('BiblesPlugin.ImportWizardForm',
|
self.getFileName(translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Open Verses CSV File'), self.csvVerseLocationEdit)
|
'Open Verses CSV File'), self.csvVerseLocationEdit, u'%s (*.csv)'
|
||||||
|
% translate('BiblesPlugin.ImportWizardForm', 'CSV File'))
|
||||||
|
|
||||||
def onOpenSongBrowseButtonClicked(self):
|
def onOpenSongBrowseButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
@ -276,7 +278,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
|||||||
"""
|
"""
|
||||||
self.getFileName(
|
self.getFileName(
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
'Open openlp.org 1.x Bible'), self.openlp1LocationEdit)
|
'Open openlp.org 1.x Bible'), self.openlp1LocationEdit,
|
||||||
|
u'%s (*.bible)' % translate('BiblesPlugin.ImportWizardForm',
|
||||||
|
'openlp.org 1.x bible'))
|
||||||
|
|
||||||
def onCurrentIdChanged(self, pageId):
|
def onCurrentIdChanged(self, pageId):
|
||||||
if pageId == 3:
|
if pageId == 3:
|
||||||
@ -402,9 +406,29 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
|
|||||||
if books_file:
|
if books_file:
|
||||||
books_file.close()
|
books_file.close()
|
||||||
|
|
||||||
def getFileName(self, title, editbox):
|
def getFileName(self, title, editbox, filters=u''):
|
||||||
|
"""
|
||||||
|
Opens a QFileDialog and saves the filename to the given editbox.
|
||||||
|
|
||||||
|
``title``
|
||||||
|
The title of the dialog (unicode).
|
||||||
|
|
||||||
|
``editbox``
|
||||||
|
A editbox (QLineEdit).
|
||||||
|
|
||||||
|
``filters``
|
||||||
|
The file extension filters. It should contain the file description as
|
||||||
|
well as the file extension. For example::
|
||||||
|
|
||||||
|
u'openlp.org 1.x bible (*.bible)'
|
||||||
|
"""
|
||||||
|
if filters:
|
||||||
|
filters += u';;'
|
||||||
|
filters += u'%s (*)' % translate('BiblesPlugin.ImportWizardForm',
|
||||||
|
'All Files')
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||||
SettingsManager.get_last_dir(self.bibleplugin.settingsSection, 1))
|
os.path.dirname(SettingsManager.get_last_dir(
|
||||||
|
self.bibleplugin.settingsSection, 1)), filters)
|
||||||
if filename:
|
if filename:
|
||||||
editbox.setText(filename)
|
editbox.setText(filename)
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(
|
||||||
|
@ -152,101 +152,101 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
if self.openLP2FilenameEdit.text().isEmpty():
|
if self.openLP2FilenameEdit.text().isEmpty():
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No OpenLP 2.0 Song Database Selected'),
|
'No OpenLP 2.0 Song Database Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to select an OpenLP 2.0 song database '
|
'You need to select an OpenLP 2.0 song database '
|
||||||
'file to import from.'))
|
'file to import from.'))
|
||||||
self.openLP2BrowseButton.setFocus()
|
self.openLP2BrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenLP1:
|
elif source_format == SongFormat.OpenLP1:
|
||||||
if self.openLP1FilenameEdit.text().isEmpty():
|
if self.openLP1FilenameEdit.text().isEmpty():
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No openlp.org 1.x Song Database Selected'),
|
'No openlp.org 1.x Song Database Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to select an openlp.org 1.x song '
|
'You need to select an openlp.org 1.x song '
|
||||||
'database file to import from.'))
|
'database file to import from.'))
|
||||||
self.openLP1BrowseButton.setFocus()
|
self.openLP1BrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenLyrics:
|
elif source_format == SongFormat.OpenLyrics:
|
||||||
#if self.openLyricsFileListWidget.count() == 0:
|
# if self.openLyricsFileListWidget.count() == 0:
|
||||||
# QtGui.QMessageBox.critical(self,
|
# QtGui.QMessageBox.critical(self,
|
||||||
# translate('SongsPlugin.ImportWizardForm',
|
# translate('SongsPlugin.ImportWizardForm',
|
||||||
# 'No OpenLyrics Files Selected'),
|
# 'No OpenLyrics Files Selected'),
|
||||||
# translate('SongsPlugin.ImportWizardForm',
|
# translate('SongsPlugin.ImportWizardForm',
|
||||||
# 'You need to add at least one OpenLyrics '
|
# 'You need to add at least one OpenLyrics '
|
||||||
# 'song file to import from.'))
|
# 'song file to import from.'))
|
||||||
# self.openLyricsAddButton.setFocus()
|
# self.openLyricsAddButton.setFocus()
|
||||||
# return False
|
# return False
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.OpenSong:
|
elif source_format == SongFormat.OpenSong:
|
||||||
if self.openSongFileListWidget.count() == 0:
|
if self.openSongFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No OpenSong Files Selected'),
|
'No OpenSong Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to add at least one OpenSong '
|
'You need to add at least one OpenSong '
|
||||||
'song file to import from.'))
|
'song file to import from.'))
|
||||||
self.openSongAddButton.setFocus()
|
self.openSongAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.WordsOfWorship:
|
elif source_format == SongFormat.WordsOfWorship:
|
||||||
if self.wordsOfWorshipFileListWidget.count() == 0:
|
if self.wordsOfWorshipFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Words of Worship Files Selected'),
|
'No Words of Worship Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to add at least one Words of Worship '
|
'You need to add at least one Words of Worship '
|
||||||
'file to import from.'))
|
'file to import from.'))
|
||||||
self.wordsOfWorshipAddButton.setFocus()
|
self.wordsOfWorshipAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.CCLI:
|
elif source_format == SongFormat.CCLI:
|
||||||
if self.ccliFileListWidget.count() == 0:
|
if self.ccliFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No CCLI Files Selected'),
|
'No CCLI Files Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to add at least one CCLI file '
|
'You need to add at least one CCLI file '
|
||||||
'to import from.'))
|
'to import from.'))
|
||||||
self.ccliAddButton.setFocus()
|
self.ccliAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongsOfFellowship:
|
elif source_format == SongFormat.SongsOfFellowship:
|
||||||
if self.songsOfFellowshipFileListWidget.count() == 0:
|
if self.songsOfFellowshipFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Songs of Fellowship File Selected'),
|
'No Songs of Fellowship File Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to add at least one Songs of Fellowship '
|
'You need to add at least one Songs of Fellowship '
|
||||||
'file to import from.'))
|
'file to import from.'))
|
||||||
self.songsOfFellowshipAddButton.setFocus()
|
self.songsOfFellowshipAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.Generic:
|
elif source_format == SongFormat.Generic:
|
||||||
if self.genericFileListWidget.count() == 0:
|
if self.genericFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No Document/Presentation Selected'),
|
'No Document/Presentation Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to add at least one document or '
|
'You need to add at least one document or '
|
||||||
'presentation file to import from.'))
|
'presentation file to import from.'))
|
||||||
self.genericAddButton.setFocus()
|
self.genericAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.EasyWorship:
|
elif source_format == SongFormat.EasyWorship:
|
||||||
if self.ewFilenameEdit.text().isEmpty():
|
if self.ewFilenameEdit.text().isEmpty():
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No EasyWorship Song Database Selected'),
|
'No EasyWorship Song Database Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to select an EasyWorship song database '
|
'You need to select an EasyWorship song database '
|
||||||
'file to import from.'))
|
'file to import from.'))
|
||||||
self.ewBrowseButton.setFocus()
|
self.ewBrowseButton.setFocus()
|
||||||
return False
|
return False
|
||||||
elif source_format == SongFormat.SongBeamer:
|
elif source_format == SongFormat.SongBeamer:
|
||||||
if self.songBeamerFileListWidget.count() == 0:
|
if self.songBeamerFileListWidget.count() == 0:
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'No SongBeamer File Selected'),
|
'No SongBeamer File Selected'),
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'You need to add at least one SongBeamer '
|
'You need to add at least one SongBeamer '
|
||||||
'file to import from.'))
|
'file to import from.'))
|
||||||
self.songBeamerAddButton.setFocus()
|
self.songBeamerAddButton.setFocus()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -254,24 +254,57 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
# Progress page
|
# Progress page
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getFileName(self, title, editbox,
|
def getFileName(self, title, editbox, filters=u''):
|
||||||
filters = '%s (*)' % translate('SongsPlugin.ImportWizardForm',
|
"""
|
||||||
'All Files')):
|
Opens a QFileDialog and writes the filename to the given editbox.
|
||||||
|
|
||||||
|
``title``
|
||||||
|
The title of the dialog (unicode).
|
||||||
|
|
||||||
|
``editbox``
|
||||||
|
A editbox (QLineEdit).
|
||||||
|
|
||||||
|
``filters``
|
||||||
|
The file extension filters. It should contain the file descriptions
|
||||||
|
as well as the file extensions. For example::
|
||||||
|
|
||||||
|
u'OpenLP 2.0 Databases (*.sqlite)'
|
||||||
|
"""
|
||||||
|
if filters:
|
||||||
|
filters += u';;'
|
||||||
|
filters += u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files')
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
filename = QtGui.QFileDialog.getOpenFileName(self, title,
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
|
os.path.dirname(SettingsManager.get_last_dir(
|
||||||
filters)
|
self.plugin.settingsSection, 1)), filters)
|
||||||
if filename:
|
if filename:
|
||||||
editbox.setText(filename)
|
editbox.setText(filename)
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(self.plugin.settingsSection,
|
||||||
self.plugin.settingsSection,
|
|
||||||
os.path.split(unicode(filename))[0], 1)
|
os.path.split(unicode(filename))[0], 1)
|
||||||
|
|
||||||
def getFiles(self, title, listbox,
|
def getFiles(self, title, listbox, filters=u''):
|
||||||
filters = u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
|
"""
|
||||||
'All Files')):
|
Opens a QFileDialog and writes the filenames to the given listbox.
|
||||||
|
|
||||||
|
``title``
|
||||||
|
The title of the dialog (unicode).
|
||||||
|
|
||||||
|
``listbox``
|
||||||
|
A listbox (QListWidget).
|
||||||
|
|
||||||
|
``filters``
|
||||||
|
The file extension filters. It should contain the file descriptions
|
||||||
|
as well as the file extensions. For example::
|
||||||
|
|
||||||
|
u'SongBeamer files (*.sng)'
|
||||||
|
"""
|
||||||
|
if filters:
|
||||||
|
filters += u';;'
|
||||||
|
filters += u'%s (*)' % translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'All Files')
|
||||||
filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
|
filenames = QtGui.QFileDialog.getOpenFileNames(self, title,
|
||||||
SettingsManager.get_last_dir(self.plugin.settingsSection, 1),
|
os.path.dirname(SettingsManager.get_last_dir(
|
||||||
filters)
|
self.plugin.settingsSection, 1)), filters)
|
||||||
if filenames:
|
if filenames:
|
||||||
listbox.addItems(filenames)
|
listbox.addItems(filenames)
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(
|
||||||
@ -293,24 +326,18 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFileName(
|
self.getFileName(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select OpenLP 2.0 Database File'),
|
'Select OpenLP 2.0 Database File'),
|
||||||
self.openLP2FilenameEdit,
|
self.openLP2FilenameEdit, u'%s (*.sqlite)'
|
||||||
u'%s (*.sqlite);;%s (*)'
|
|
||||||
% (translate('SongsPlugin.ImportWizardForm',
|
% (translate('SongsPlugin.ImportWizardForm',
|
||||||
'OpenLP 2.0 Databases'),
|
'OpenLP 2.0 Databases'))
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'All Files'))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def onOpenLP1BrowseButtonClicked(self):
|
def onOpenLP1BrowseButtonClicked(self):
|
||||||
self.getFileName(
|
self.getFileName(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select openlp.org 1.x Database File'),
|
'Select openlp.org 1.x Database File'),
|
||||||
self.openLP1FilenameEdit,
|
self.openLP1FilenameEdit, u'%s (*.olp)'
|
||||||
u'%s (*.olp);;%s (*)'
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
% (translate('SongsPlugin.ImportWizardForm',
|
'openlp.org v1.x Databases')
|
||||||
'openlp.org v1.x Databases'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'All Files'))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#def onOpenLyricsAddButtonClicked(self):
|
#def onOpenLyricsAddButtonClicked(self):
|
||||||
@ -337,12 +364,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFiles(
|
self.getFiles(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select Words of Worship Files'),
|
'Select Words of Worship Files'),
|
||||||
self.wordsOfWorshipFileListWidget,
|
self.wordsOfWorshipFileListWidget, u'%s (*.wsg *.wow-song)'
|
||||||
u'%s (*.wsg *.wow-song);;%s (*)'
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
% (translate('SongsPlugin.ImportWizardForm',
|
'Words Of Worship Song Files')
|
||||||
'Words Of Worship Song Files'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'All Files'))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def onWordsOfWorshipRemoveButtonClicked(self):
|
def onWordsOfWorshipRemoveButtonClicked(self):
|
||||||
@ -362,12 +386,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFiles(
|
self.getFiles(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select Songs of Fellowship Files'),
|
'Select Songs of Fellowship Files'),
|
||||||
self.songsOfFellowshipFileListWidget,
|
self.songsOfFellowshipFileListWidget, u'%s (*.rtf)'
|
||||||
u'%s (*.rtf);;%s (*)'
|
% translate('SongsPlugin.ImportWizardForm',
|
||||||
% (translate('SongsPlugin.ImportWizardForm',
|
'Songs Of Felloship Song Files')
|
||||||
'Songs Of Felloship Song Files'),
|
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
|
||||||
'All Files'))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def onSongsOfFellowshipRemoveButtonClicked(self):
|
def onSongsOfFellowshipRemoveButtonClicked(self):
|
||||||
@ -394,7 +415,8 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
|
|||||||
self.getFiles(
|
self.getFiles(
|
||||||
translate('SongsPlugin.ImportWizardForm',
|
translate('SongsPlugin.ImportWizardForm',
|
||||||
'Select SongBeamer Files'),
|
'Select SongBeamer Files'),
|
||||||
self.songBeamerFileListWidget
|
self.songBeamerFileListWidget, u'%s (*.sng)' %
|
||||||
|
translate('SongsPlugin.ImportWizardForm', 'SongBeamer files')
|
||||||
)
|
)
|
||||||
|
|
||||||
def onSongBeamerRemoveButtonClicked(self):
|
def onSongBeamerRemoveButtonClicked(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user