From 8e4f69383c8e010677f9f9253408c359001a20a4 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 29 Oct 2009 06:24:53 +0000 Subject: [PATCH] Style fixes --- openlp/core/ui/settingsform.py | 2 +- .../plugins/bibles/forms/bibleimportform.py | 37 ++++++++++++------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 02f812f9a..c90447c59 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -53,7 +53,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): def insertTab(self, tab, location): log.debug(u'Inserting %s tab' % tab.title()) - #13 : There are 3 tables currently and lcations starts at -10 + #13 : There are 3 tables currently and locations starts at -10 self.SettingsTabWidget.insertTab(location + 13, tab, tab.title()) def removeTab(self, name): diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index a46a7f9f6..3e8029dc6 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -50,6 +50,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): self.bible_type = None self.barmax = 0 self.tabWidget.setCurrentIndex(0) + self.cwBibleVersions = {} + self.bgBibleVersions = {} self.AddressEdit.setText(self.config.get_config(u'proxy_address', u'')) self.UsernameEdit.setText(self.config.get_config(u'proxy_username',u'')) self.PasswordEdit.setText(self.config.get_config(u'proxy_password',u'')) @@ -57,21 +59,25 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): filepath = os.path.split(os.path.abspath(__file__))[0] filepath = os.path.abspath(os.path.join(filepath, u'..', u'resources', u'crosswalkbooks.csv')) - fbibles=open(filepath, 'r') - self.cwBibleVersions = {} - for line in fbibles: - p = line.split(u',') - self.cwBibleVersions [p[0]] = p[1].replace(u'\n', u'') + try: + fbibles = open(filepath, 'r') + for line in fbibles: + p = line.split(u',') + self.cwBibleVersions[p[0]] = p[1].replace(u'\n', u'') + except: + log.exception(u'Crosswalk resources missing') #Load and store BibleGateway Bibles filepath = os.path.split(os.path.abspath(__file__))[0] filepath = os.path.abspath(os.path.join(filepath, u'..', u'resources', u'biblegateway.csv')) - fbibles=open(filepath, 'r') - self.bgBibleVersions = {} - for line in fbibles: - p = line.split(u',') - self.bgBibleVersions [p[0]] = p[1].replace(u'\n', u'') - self.loadBibleCombo(self.cwBibleVersions ) + try: + fbibles = open(filepath, 'r') + for line in fbibles: + p = line.split(u',') + self.bgBibleVersions[p[0]] = p[1].replace(u'\n', u'') + except: + log.exception(u'Biblegateway resources missing') + self.loadBibleCombo(self.cwBibleVersions) self.cwActive = True def loadBibleCombo(self, biblesList): @@ -117,7 +123,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def onVersesFileButtonClicked(self): filename = QtGui.QFileDialog.getOpenFileName( - self, self.trUtf8(u'Open file'), self.config.get_last_dir(1)) + self, self.trUtf8(u'Open Bible Verses file'), + self.config.get_last_dir(1)) if filename != u'': self.VerseLocationEdit.setText(filename) self.config.set_last_dir(filename, 1) @@ -125,7 +132,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def onBooksFileButtonClicked(self): filename = QtGui.QFileDialog.getOpenFileName( - self, self.trUtf8(u'Open file'), self.config.get_last_dir(2)) + self, self.trUtf8(u'Open Bible Books file'), + self.config.get_last_dir(2)) if filename != u'': self.BooksLocationEdit.setText(filename) self.config.set_last_dir(filename, 2) @@ -133,7 +141,8 @@ class BibleImportForm(QtGui.QDialog, Ui_BibleImportDialog): def onOsisFileButtonClicked(self): filename = QtGui.QFileDialog.getOpenFileName( - self, self.trUtf8(u'Open file'), self.config.get_last_dir(3)) + self, self.trUtf8(u'Open OSIS import file'), + self.config.get_last_dir(3)) if filename != u'': self.OSISLocationEdit.setText(filename) self.config.set_last_dir(filename, 3)