openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #04904
[Merge] lp:~googol-hush/openlp/bibles into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/bibles into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Hello!
I added a file extension filter. This means that the bible importers do not accept all file extensions any more.
--
https://code.launchpad.net/~googol-hush/openlp/bibles/+merge/44265
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/bibles into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2010-12-11 20:49:50 +0000
+++ openlp/core/ui/servicemanager.py 2010-12-20 19:02:13 +0000
@@ -625,9 +625,10 @@
log.debug(u'onSaveService %s' % quick)
if not quick or self.isNew:
filename = QtGui.QFileDialog.getSaveFileName(self,
- translate('OpenLP.ServiceManager', 'Save Service'),
- SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
- translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))
+ translate('OpenLP.ServiceManager', 'Save Service'),
+ SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
+ translate('OpenLP.ServiceManager',
+ 'OpenLP Service Files (*.osz)'))
else:
filename = os.path.join(SettingsManager.get_last_dir(
self.parent.serviceSettingsSection), self.serviceName)
=== modified file 'openlp/plugins/bibles/forms/bibleimportform.py'
--- openlp/plugins/bibles/forms/bibleimportform.py 2010-12-18 02:12:41 +0000
+++ openlp/plugins/bibles/forms/bibleimportform.py 2010-12-20 19:02:13 +0000
@@ -253,14 +253,15 @@
"""
self.getFileName(
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
- self.booksLocationEdit)
+ self.booksLocationEdit, u'CSV File (*.csv)')
def onCsvVersesFileButtonClicked(self):
"""
Show the file open dialog for the verses CSV file.
"""
self.getFileName(translate('BiblesPlugin.ImportWizardForm',
- 'Open Verses CSV File'), self.csvVerseLocationEdit)
+ 'Open Verses CSV File'), self.csvVerseLocationEdit,
+ u'CSV File (*.csv)')
def onOpenSongBrowseButtonClicked(self):
"""
@@ -276,7 +277,8 @@
"""
self.getFileName(
translate('BiblesPlugin.ImportWizardForm',
- 'Open openlp.org 1.x Bible'), self.openlp1LocationEdit)
+ 'Open openlp.org 1.x Bible'), self.openlp1LocationEdit,
+ u'openlp.org (*.bible)')
def onCurrentIdChanged(self, pageId):
if pageId == 3:
@@ -402,9 +404,25 @@
if books_file:
books_file.close()
- def getFileName(self, title, editbox):
- filename = QtGui.QFileDialog.getOpenFileName(self, title,
- SettingsManager.get_last_dir(self.bibleplugin.settingsSection, 1))
+ def getFileName(self, title, editbox, filter=u''):
+ """
+ Opens a QFileDialog and saves the filename to the given editbox.
+
+ ``title``
+ The title of the dialog (unicode).
+
+ ``editbox``
+ A editbox (QLineEdit).
+
+ ``filter``
+ The file extension filter. It should contain the file description as
+ well as the file extension. For example::
+
+ u'openlp.org (*.bible)'
+ """
+ path = os.path.os.path.dirname(SettingsManager.get_last_dir(
+ self.bibleplugin.settingsSection, 1))
+ filename = QtGui.QFileDialog.getOpenFileName(self, title, path, filter)
if filename:
editbox.setText(filename)
SettingsManager.set_last_dir(
Follow ups