From 03ba804be72bb09e8a2aa449e82c828832a785e2 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 27 Oct 2009 07:20:01 +0000 Subject: [PATCH] Biblegateway addition --- openlp/core/ui/mainwindow.py | 2 +- openlp/core/ui/plugindialog.py | 1 - openlp/plugins/audit/auditplugin.py | 14 +++---- .../plugins/bibles/forms/bibleimportdialog.py | 3 ++ openlp/plugins/bibles/lib/bibleHTTPimpl.py | 41 ++++++++++--------- openlp/plugins/bibles/lib/manager.py | 11 ++--- openlp/plugins/songs/forms/editsongform.py | 4 +- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index f78047712..4a79f6cae 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -529,7 +529,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): version = check_latest_version(self.generalConfig, applicationVersion) if applicationVersion != version: version_text = unicode(self.trUtf8(u'OpenLP version %s has been updated ' - u'to version %s')) + u'to version %s\nWould you like to get it?')) QtGui.QMessageBox.question(None, self.trUtf8(u'OpenLP Version Updated'), version_text % (applicationVersion, version), diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index f733b8e2f..2f3551f1a 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -105,4 +105,3 @@ class Ui_PluginViewDialog(object): self.StatusLabel.setText(self.trUtf8(u'Status:')) self.StatusComboBox.setItemText(0, self.trUtf8(u'Active')) self.StatusComboBox.setItemText(1, self.trUtf8(u'Inactive')) - diff --git a/openlp/plugins/audit/auditplugin.py b/openlp/plugins/audit/auditplugin.py index a02146022..99e8a6b5a 100644 --- a/openlp/plugins/audit/auditplugin.py +++ b/openlp/plugins/audit/auditplugin.py @@ -62,18 +62,18 @@ class AuditPlugin(Plugin): self.toolsMenu = tools_menu self.AuditMenu = QtGui.QMenu(tools_menu) self.AuditMenu.setObjectName(u'AuditMenu') - self.AuditMenu.setTitle(tools_menu.trUtf8(u'&Audit')) + self.AuditMenu.setTitle(tools_menu.trUtf8(u'&Song Usage')) #Audit Delete self.AuditDelete = QtGui.QAction(tools_menu) - self.AuditDelete.setText(tools_menu.trUtf8(u'Audit &Delete')) + self.AuditDelete.setText(tools_menu.trUtf8(u'&Delete recorded data')) self.AuditDelete.setStatusTip( - tools_menu.trUtf8(u'Delete all audit data to sepecified date')) + tools_menu.trUtf8(u'Delete sing usage to sepecified date')) self.AuditDelete.setObjectName(u'AuditDelete') #Audit Report self.AuditReport = QtGui.QAction(tools_menu) - self.AuditReport.setText(tools_menu.trUtf8(u'Au&dit &Extract')) + self.AuditReport.setText(tools_menu.trUtf8(u'&Extract recoreded data')) self.AuditReport.setStatusTip( - tools_menu.trUtf8(u'Generate Extracts on Audit Data')) + tools_menu.trUtf8(u'Generate Extracts on Song Usage')) self.AuditReport.setObjectName(u'AuditReport') #Audit activation AuditIcon = buildIcon(u':/tools/tools_alert.png') @@ -81,9 +81,9 @@ class AuditPlugin(Plugin): self.AuditStatus.setIcon(AuditIcon) self.AuditStatus.setCheckable(True) self.AuditStatus.setChecked(False) - self.AuditStatus.setText(tools_menu.trUtf8(u'A&udit Status')) + self.AuditStatus.setText(tools_menu.trUtf8(u'Song Usage Status')) self.AuditStatus.setStatusTip( - tools_menu.trUtf8(u'Start/Stop live song auditing')) + tools_menu.trUtf8(u'Start/Stop live song usage recording')) self.AuditStatus.setShortcut(u'F4') self.AuditStatus.setObjectName(u'AuditStatus') #Add Menus together diff --git a/openlp/plugins/bibles/forms/bibleimportdialog.py b/openlp/plugins/bibles/forms/bibleimportdialog.py index 1f275718a..8243fc72d 100644 --- a/openlp/plugins/bibles/forms/bibleimportdialog.py +++ b/openlp/plugins/bibles/forms/bibleimportdialog.py @@ -162,6 +162,7 @@ class Ui_BibleImportDialog(object): self.LocationComboBox = QtGui.QComboBox(self.OptionsGroupBox) self.LocationComboBox.setObjectName(u'LocationComboBox') self.LocationComboBox.addItem(QtCore.QString()) + self.LocationComboBox.addItem(QtCore.QString()) self.horizontalLayout_4.addWidget(self.LocationComboBox) self.verticalLayout.addLayout(self.horizontalLayout_4) self.horizontalLayout_5 = QtGui.QHBoxLayout() @@ -173,6 +174,7 @@ class Ui_BibleImportDialog(object): self.BibleComboBox.setObjectName(u'BibleComboBox') self.BibleComboBox.addItem(QtCore.QString()) self.BibleComboBox.setItemText(0, u'') + self.BibleComboBox.setItemText(1, u'') self.BibleComboBox.addItem(QtCore.QString()) self.BibleComboBox.addItem(QtCore.QString()) self.horizontalLayout_5.addWidget(self.BibleComboBox) @@ -246,6 +248,7 @@ class Ui_BibleImportDialog(object): self.OptionsGroupBox.setTitle(self.trUtf8(u'Download Options')) self.LocationLabel.setText(self.trUtf8(u'Location:')) self.LocationComboBox.setItemText(0, self.trUtf8(u'Crosswalk')) + self.LocationComboBox.setItemText(1, self.trUtf8(u'BibleGateway')) self.BibleLabel.setText(self.trUtf8(u'Bible:')) self.BibleComboBox.setItemText(1, self.trUtf8(u'NIV')) self.BibleComboBox.setItemText(2, self.trUtf8(u'KJV')) diff --git a/openlp/plugins/bibles/lib/bibleHTTPimpl.py b/openlp/plugins/bibles/lib/bibleHTTPimpl.py index 061d594e6..51c9b7c3f 100644 --- a/openlp/plugins/bibles/lib/bibleHTTPimpl.py +++ b/openlp/plugins/bibles/lib/bibleHTTPimpl.py @@ -50,38 +50,41 @@ class BGExtract(BibleCommon): """ log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter) + version=u'nasb' urlstring = \ u'http://www.biblegateway.com/passage/?search=%s %s&version=%s' % \ (bookname, unicode(chapter) , version) xml_string = self._get_web_text(urlstring, self.proxyurl) - VerseSearch = u'class=' + u'"' + u'sup' + u'"' + u'>' + #print xml_string + verseSearch = u' -1: # clear out string verseText = u'' - versePos = xml_string.find(u'', versePos) + 6 + i = xml_string.find(verseSearch, versePos + 1) + #print versePos, i, xml_string[versePos:i]#, xml_string if i == -1: - i = xml_string.find(u' 0 and j < i: i = j verseText = xml_string[versePos + 7 : i ] bible[verse] = self._clean_text(verseText) # store the verse versePos = -1 else: - i = xml_string[:i].rfind(u' - # Chop off verse 1 - xml_string = xml_string[i - 1 :len(xml_string)] - versePos = xml_string.find(VerseSearch) #look for the next verse + verseText = xml_string[versePos: i] + # Chop off verse and start again + xml_string = xml_string[i:] + #print "C", xml_string + versePos = xml_string.find(verseSearch) #look for the next verse bible[verse] = self._clean_text(verseText) # store the verse verse += 1 - return bible + return SearchResults(bookname, chapter, bible) class CWExtract(BibleCommon): global log @@ -107,8 +110,8 @@ class CWExtract(BibleCommon): ``chapter`` Chapter number """ - log.debug(u'get_bible_chapter %s,%s,%s,%s', - version, bookid, bookname, chapter) + log.debug(u'get_bible_chapter %s,%s,%s', + version, bookname, chapter) bookname = bookname.replace(u' ', u'') urlstring = u'http://bible.crosswalk.com/OnlineStudyBible/bible.cgi?word=%s+%d&version=%s'\ % (bookname, chapter, version) @@ -200,18 +203,18 @@ class BibleHTTPImpl(): log.debug(u'set_bible_source %s', biblesource) self.biblesource = biblesource - def get_bible_chapter(self, version, bookid, bookname, chapter): + def get_bible_chapter(self, version, bookname, chapter): """ Receive the request and call the relevant handler methods """ - log.debug(u'get_bible_chapter %s,%s,%s,%s', - version, bookid, bookname, chapter) + log.debug(u'get_bible_chapter %s,%s,%s', + version, bookname, chapter) log.debug(u'biblesource = %s', self.biblesource) try: if self.biblesource.lower() == u'crosswalk': ev = CWExtract(self.proxyurl) else: ev = BGExtract(self.proxyurl) - return ev.get_bible_chapter(self.bibleid, bookid, bookname, chapter) + return ev.get_bible_chapter(self.bibleid, bookname, chapter) except: log.exception("Failed to get bible chapter") diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index a259af0c2..9200a3b0a 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -351,10 +351,10 @@ class BibleManager(object): log.debug(u'get_verse_text : new book') for chapter in range(schapter, echapter + 1): self.media.setQuickMessage( - self.trUtf8(u'Downloading %s: %s') % (bookname, chapter)) + unicode(self.media.trUtf8(u'Downloading %s: %s')) % (bookname, chapter)) search_results = \ self.bible_http_cache[bible].get_bible_chapter( - bible, 0, bookname, chapter) + bible, bookname, chapter) if search_results.has_verselist() : ## We have found a book of the bible lets check to see ## if it was there. By reusing the returned book name @@ -380,7 +380,7 @@ class BibleManager(object): book.id, chapter) if v is None: self.media.setQuickMessage( - self.trUtf8(u'%Downloading %s: %s')\ + unicode(self.media.trUtf8(u'%Downloading %s: %s'))\ % (bookname, chapter)) self.bible_db_cache[bible].create_chapter( book.id, chapter, @@ -392,8 +392,9 @@ class BibleManager(object): book.id, chapter) if v is None: try: - self.media.setQuickMessage \ - (u'Downloading %s: %s'% (bookname, chapter)) + self.media.setQuickMessage =\ + unicode(self.media.trUtf8(u'Downloading %s: %s') + % (bookname, chapter)) search_results = \ self.bible_http_cache[bible].get_bible_chapter( bible, book.id, bookname, chapter) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 1144d2df9..9ddbeb4fe 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -65,6 +65,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered) QtCore.QObject.connect(self.VerseAddButton, QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked) + QtCore.QObject.connect(self.VerseListWidget, + QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onVerseEditButtonClicked) QtCore.QObject.connect(self.VerseEditButton, QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked) QtCore.QObject.connect(self.VerseEditAllButton, @@ -94,7 +96,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): QtCore.QObject.connect(self.VerseOrderEdit, QtCore.SIGNAL(u'lostFocus()'), self.onVerseOrderEditLostFocus) previewButton = QtGui.QPushButton() - previewButton.setText(self.trUtf8(u'Save & Preview')) + previewButton.setText(self.trUtf8(u'Save && Preview')) self.ButtonBox.addButton(previewButton, QtGui.QDialogButtonBox.ActionRole) QtCore.QObject.connect(self.ButtonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)