diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 65bcc3991..32d9fddcc 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -160,11 +160,29 @@ class BiblePlugin(Plugin): self.listView.setGeometry(QtCore.QRect(10, 200, 256, 391)) self.listView.setObjectName("listView") self.MediaManagerItem.PageLayout.addWidget(self.listView) + + #QtCore.QObject.connect(self.QuickTab, QtCore.SIGNAL("triggered()"), self.onQuickTabClick) + QtCore.QObject.connect( self.SearchTabWidget, QtCore.SIGNAL("currentChanged ( QWidget * )" ), self.onQuickTabClick) + QtCore.QObject.connect(self.AdvancedVersionComboBox, QtCore.SIGNAL("activated(int)"), self.onAdvancedVersionComboBox) + self._initialiseform() return self.MediaManagerItem + def onAdvancedVersionComboBox(self): + print self.AdvancedVersionComboBox.currentText() + books = self.biblemanager.getBibleBooks(str(self.AdvancedVersionComboBox.currentText())) + self.AdvancedBookComboBox.clear() + for b in books: + self.AdvancedBookComboBox.addItem(b[0]) + + def onQuickTabClick(self): + print "onQuickTabClick" + print self.SearchTabWidget.currentIndex() + print self.SearchTabWidget.tabText(self.SearchTabWidget.currentIndex()) + pass + def onBibleNewClick(self): self.bibleimportform = BibleImportForm(self.biblemanager) self.bibleimportform.show() @@ -185,9 +203,7 @@ class BiblePlugin(Plugin): self.QuickVersionComboBox.addItem(b) self.AdvancedVersionComboBox.addItem(b) - self.AdvancedBookComboBox.addItem("Genesis") - self.AdvancedBookComboBox.addItem("Matthew") - self.AdvancedBookComboBox.addItem("Revelation") + for i in range(1, 10): self.AdvancedFromChapter.addItem(str(i)) diff --git a/openlp/plugins/bibles/forms/bibleimportdialog.py b/openlp/plugins/bibles/forms/bibleimportdialog.py index 7f33bb190..38f170620 100644 --- a/openlp/plugins/bibles/forms/bibleimportdialog.py +++ b/openlp/plugins/bibles/forms/bibleimportdialog.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'bibleimport.ui' # -# Created: Thu Dec 4 20:52:10 2008 +# Created: Sat Dec 6 16:19:54 2008 # by: PyQt4 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! @@ -12,9 +12,9 @@ from PyQt4 import QtCore, QtGui class Ui_BibleImportDialog(object): def setupUi(self, BibleImportDialog): BibleImportDialog.setObjectName("BibleImportDialog") - BibleImportDialog.resize(494, 658) + BibleImportDialog.resize(494, 725) self.BibleImportButtonBox = QtGui.QDialogButtonBox(BibleImportDialog) - self.BibleImportButtonBox.setGeometry(QtCore.QRect(10, 620, 481, 33)) + self.BibleImportButtonBox.setGeometry(QtCore.QRect(10, 690, 481, 33)) self.BibleImportButtonBox.setOrientation(QtCore.Qt.Horizontal) self.BibleImportButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) self.BibleImportButtonBox.setObjectName("BibleImportButtonBox") @@ -25,43 +25,51 @@ class Ui_BibleImportDialog(object): self.FileImportPage.setGeometry(QtCore.QRect(0, 0, 471, 361)) self.FileImportPage.setObjectName("FileImportPage") self.OSISGroupBox = QtGui.QGroupBox(self.FileImportPage) - self.OSISGroupBox.setGeometry(QtCore.QRect(8, 74, 451, 71)) + self.OSISGroupBox.setGeometry(QtCore.QRect(8, 65, 451, 81)) self.OSISGroupBox.setObjectName("OSISGroupBox") + self.gridLayout_2 = QtGui.QGridLayout(self.OSISGroupBox) + self.gridLayout_2.setMargin(8) + self.gridLayout_2.setSpacing(8) + self.gridLayout_2.setObjectName("gridLayout_2") + self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox) + self.LocatioLabel.setObjectName("LocatioLabel") + self.gridLayout_2.addWidget(self.LocatioLabel, 0, 0, 1, 1) self.OSISLocationEdit = QtGui.QLineEdit(self.OSISGroupBox) - self.OSISLocationEdit.setGeometry(QtCore.QRect(110, 29, 271, 28)) self.OSISLocationEdit.setObjectName("OSISLocationEdit") + self.gridLayout_2.addWidget(self.OSISLocationEdit, 0, 1, 1, 1) self.OsisFileButton = QtGui.QPushButton(self.OSISGroupBox) - self.OsisFileButton.setGeometry(QtCore.QRect(400, 30, 41, 31)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("../images/import_load.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.OsisFileButton.setIcon(icon) self.OsisFileButton.setObjectName("OsisFileButton") - self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox) - self.LocatioLabel.setGeometry(QtCore.QRect(10, 29, 73, 22)) - self.LocatioLabel.setObjectName("LocatioLabel") + self.gridLayout_2.addWidget(self.OsisFileButton, 0, 2, 1, 1) self.CVSGroupBox = QtGui.QGroupBox(self.FileImportPage) - self.CVSGroupBox.setGeometry(QtCore.QRect(8, 150, 451, 161)) + self.CVSGroupBox.setGeometry(QtCore.QRect(10, 170, 451, 191)) self.CVSGroupBox.setObjectName("CVSGroupBox") + self.gridLayout = QtGui.QGridLayout(self.CVSGroupBox) + self.gridLayout.setMargin(8) + self.gridLayout.setSpacing(8) + self.gridLayout.setObjectName("gridLayout") self.BooksLocationLabel = QtGui.QLabel(self.CVSGroupBox) - self.BooksLocationLabel.setGeometry(QtCore.QRect(10, 70, 101, 17)) self.BooksLocationLabel.setObjectName("BooksLocationLabel") + self.gridLayout.addWidget(self.BooksLocationLabel, 0, 0, 1, 1) + self.VerseLocationLabel = QtGui.QLabel(self.CVSGroupBox) + self.VerseLocationLabel.setObjectName("VerseLocationLabel") + self.gridLayout.addWidget(self.VerseLocationLabel, 4, 0, 1, 1) + self.VerseLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) + self.VerseLocationEdit.setObjectName("VerseLocationEdit") + self.gridLayout.addWidget(self.VerseLocationEdit, 4, 1, 1, 1) self.BooksLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) - self.BooksLocationEdit.setGeometry(QtCore.QRect(110, 70, 271, 28)) self.BooksLocationEdit.setObjectName("BooksLocationEdit") + self.gridLayout.addWidget(self.BooksLocationEdit, 0, 1, 1, 1) self.BooksFileButton = QtGui.QPushButton(self.CVSGroupBox) - self.BooksFileButton.setGeometry(QtCore.QRect(400, 70, 41, 31)) self.BooksFileButton.setIcon(icon) self.BooksFileButton.setObjectName("BooksFileButton") - self.VerseLocationLabel = QtGui.QLabel(self.CVSGroupBox) - self.VerseLocationLabel.setGeometry(QtCore.QRect(10, 110, 91, 17)) - self.VerseLocationLabel.setObjectName("VerseLocationLabel") - self.VerseLocationEdit = QtGui.QLineEdit(self.CVSGroupBox) - self.VerseLocationEdit.setGeometry(QtCore.QRect(110, 110, 271, 28)) - self.VerseLocationEdit.setObjectName("VerseLocationEdit") + self.gridLayout.addWidget(self.BooksFileButton, 0, 2, 1, 1) self.VersesFileButton = QtGui.QPushButton(self.CVSGroupBox) - self.VersesFileButton.setGeometry(QtCore.QRect(400, 110, 41, 31)) self.VersesFileButton.setIcon(icon) self.VersesFileButton.setObjectName("VersesFileButton") + self.gridLayout.addWidget(self.VersesFileButton, 4, 2, 1, 1) self.BibleNameEdit = QtGui.QLineEdit(self.FileImportPage) self.BibleNameEdit.setGeometry(QtCore.QRect(120, 20, 271, 28)) self.BibleNameEdit.setObjectName("BibleNameEdit") @@ -138,7 +146,7 @@ class Ui_BibleImportDialog(object): self.WebBibleLayout.addWidget(self.ProxyGroupBox) self.ImportToolBox.addItem(self.WebBiblePage, "") self.LicenceDetailsGroupBox = QtGui.QGroupBox(BibleImportDialog) - self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(8, 450, 481, 136)) + self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(10, 435, 471, 151)) self.LicenceDetailsGroupBox.setMinimumSize(QtCore.QSize(0, 123)) self.LicenceDetailsGroupBox.setObjectName("LicenceDetailsGroupBox") self.formLayout = QtGui.QFormLayout(self.LicenceDetailsGroupBox) @@ -163,9 +171,19 @@ class Ui_BibleImportDialog(object): self.PermisionEdit = QtGui.QLineEdit(self.LicenceDetailsGroupBox) self.PermisionEdit.setObjectName("PermisionEdit") self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PermisionEdit) - self.StatusLabel = QtGui.QLabel(BibleImportDialog) - self.StatusLabel.setGeometry(QtCore.QRect(10, 590, 54, 17)) - self.StatusLabel.setObjectName("StatusLabel") + self.MessageLabel = QtGui.QLabel(BibleImportDialog) + self.MessageLabel.setGeometry(QtCore.QRect(20, 670, 451, 17)) + self.MessageLabel.setObjectName("MessageLabel") + self.ProgressGroupBox = QtGui.QGroupBox(BibleImportDialog) + self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 600, 471, 70)) + self.ProgressGroupBox.setObjectName("ProgressGroupBox") + self.gridLayout_3 = QtGui.QGridLayout(self.ProgressGroupBox) + self.gridLayout_3.setObjectName("gridLayout_3") + self.progressBar = QtGui.QProgressBar(self.ProgressGroupBox) + self.progressBar.setProperty("value", QtCore.QVariant(0)) + self.progressBar.setInvertedAppearance(False) + self.progressBar.setObjectName("progressBar") + self.gridLayout_3.addWidget(self.progressBar, 0, 0, 1, 1) self.retranslateUi(BibleImportDialog) self.ImportToolBox.setCurrentIndex(0) @@ -177,9 +195,7 @@ class Ui_BibleImportDialog(object): self.LocatioLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "File Location:", None, QtGui.QApplication.UnicodeUTF8)) self.CVSGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "CVS Bible", None, QtGui.QApplication.UnicodeUTF8)) self.BooksLocationLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Books Location:", None, QtGui.QApplication.UnicodeUTF8)) - self.BooksFileButton.setText(QtGui.QApplication.translate("BibleImportDialog", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) self.VerseLocationLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Verse Location:", None, QtGui.QApplication.UnicodeUTF8)) - self.VersesFileButton.setText(QtGui.QApplication.translate("BibleImportDialog", "PushButton", None, QtGui.QApplication.UnicodeUTF8)) self.BibleNameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Bible Name:", None, QtGui.QApplication.UnicodeUTF8)) self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.FileImportPage), QtGui.QApplication.translate("BibleImportDialog", "File Import Page", None, QtGui.QApplication.UnicodeUTF8)) self.OptionsGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Download Options", None, QtGui.QApplication.UnicodeUTF8)) @@ -201,5 +217,6 @@ class Ui_BibleImportDialog(object): self.VersionNameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Version Name:", None, QtGui.QApplication.UnicodeUTF8)) self.CopyrightLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Copyright:", None, QtGui.QApplication.UnicodeUTF8)) self.PermisionLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Permission:", None, QtGui.QApplication.UnicodeUTF8)) - self.StatusLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8)) + self.ProgressGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Import Progress", None, QtGui.QApplication.UnicodeUTF8)) + self.progressBar.setFormat(QtGui.QApplication.translate("BibleImportDialog", "%p", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 130f5d7aa..e1d2de056 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -30,9 +30,7 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog): """ QDialog.__init__(self, parent) self.setupUi(self) - #self.biblemanager = biblemanager -# self.savebutton = self.BibleImportButtonBox.button(QtGui.QDialogButtonBox.Save) -# self.BibleImportButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid + self.biblemanager = biblemanager @pyqtSignature("") @@ -64,8 +62,8 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog): def on_BibleImportButtonBox_clicked(self,button): print button.text() if button.text() == "Save": - bipf = BibleImportProgressForm() - bipf.show() + #bipf = BibleImportProgressForm() + #bipf.show() if self.biblemanager != None: self.biblemanager.processDialog(bipf) self.biblemanager.registerOSISFileBible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText()) diff --git a/openlp/plugins/bibles/lib/bibleCommon.py b/openlp/plugins/bibles/lib/bibleCommon.py deleted file mode 100644 index 60cd43c85..000000000 --- a/openlp/plugins/bibles/lib/bibleCommon.py +++ /dev/null @@ -1,104 +0,0 @@ -""" -OpenLP - Open Source Lyrics Projection -Copyright (c) 2008 Raoul Snyman -Portions copyright (c) 2008 Martin Thompson, Tim Bentley - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA -""" - -import os, os.path -import sys -import urllib2 - -import logging -logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', - datefmt='%m-%d %H:%M', - filename='plugins.log', - filemode='w') - -class BibleCommon: - global log - log=logging.getLogger("BibleCommon") - log.info("BibleCommon") - def __init__(self): - """ - """ - def _getWebText(self, urlstring, proxyurl): - log.debug( "getWebText %s %s", proxyurl, urlstring) - - if proxyurl != "" or len(proxyurl) > 0 : - print "ProxyUrl " , proxyurl + " " + str(len(proxyurl)) - proxy_support = urllib2.ProxyHandler({'http': self.proxyurl}) - http_support = urllib2.HTTPHandler() - opener= urllib2.build_opener(proxy_support, http_support) - urllib2.install_opener(opener) - - xml_string = "" - req = urllib2.Request(urlstring) - req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)') - try: - handle = urllib2.urlopen(req) - xml_string = handle.read() - except IOError, e: - if hasattr(e, 'reason'): - log.error( 'Reason : ') - log.error( e.reason) - return xml_string - - def _cleanText(self, text): - """ - Clean up text and remove extra characters - after been downloaded from web - """ - #return text.rstrip() - # Remove Headings from the Text - i = text.find(" -1: - j=text.find("") - while x > -1: - y = text.find("") - text= text[:x] + text[y + 6:len(text)] - x = text.find("") - - # Static Clean ups - text= text.replace('\n', '') - text= text.replace('\r', '') - text= text.replace(' ', '') - text= text.replace('

', '') - text= text.replace('', '') - text= text.replace('', '') - text= text.replace('

', '') - text= text.replace('

', '') - text= text.replace('

', '') - text= text.replace('
', '') - text= text.replace('
', '') - text= text.replace(chr(189), '1/2') - text= text.replace(""", '"') - text= text.replace("'", "'") - - i = text.find("<") - while i > -1 : - j = text.find(">", i) - text= text[:i] + text[j+1:] - i = text.find("<") - - text= text.replace('>', '') - return text.rstrip() - - diff --git a/openlp/plugins/bibles/lib/bibleHTTPimpl.py b/openlp/plugins/bibles/lib/bibleHTTPimpl.py index 0bf12eace..5e90ef531 100644 --- a/openlp/plugins/bibles/lib/bibleHTTPimpl.py +++ b/openlp/plugins/bibles/lib/bibleHTTPimpl.py @@ -94,7 +94,7 @@ class CWExtract(BibleCommon): def getBibleChapter(self, version, bookid, bookname, chapter) : log.debug( "getBibleChapter %s,%s,%s,%s", version, bookid, bookname, chapter) """ - Access and decode bibles via the Crosswaly website + Access and decode bibles via the Crosswalk website Version - the version of the bible like niv for New International version bookid - not used bookname - text name of in english eg 'gen' for Genesis diff --git a/openlp/plugins/bibles/lib/biblemanager.py b/openlp/plugins/bibles/lib/biblemanager.py index 33ad44387..4ba3a133b 100644 --- a/openlp/plugins/bibles/lib/biblemanager.py +++ b/openlp/plugins/bibles/lib/biblemanager.py @@ -51,7 +51,7 @@ class BibleManager(): self.bibleDBCache = {} # dict of bible database classes self.bibleHTTPCache = {} # dict of bible http readers self.biblePath = path - self.bibleSuffix = "bible3a" + self.bibleSuffix = "bible3" self.dialogobject = None log.debug("Bible Path %s", self.biblePath ) @@ -76,12 +76,12 @@ class BibleManager(): def processDialog(self, dialogobject): self.dialogobject = dialogobject - def registerHTTPBible(self, biblename, biblesource, proxyurl=None, proxyid=None, proxypass=None): + def registerHTTPBible(self, biblename, biblesource, mode="lazy", proxyurl=None, proxyid=None, proxypass=None): """ Return a list of bibles from a given URL. The selected Bible can then be registered and LazyLoaded into a database """ - log.debug( "registerHTTPBible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass) + log.debug( "registerHTTPBible %s,%s,%s,%s,%s", biblename, biblesource, proxyurl, proxyid, proxypass, mode) if self._isNewBible(biblename): nbible = BibleDBImpl(biblename) # Create new Bible nbible.createTables() # Create Database diff --git a/resources/forms/bibleimport.ui b/resources/forms/bibleimport.ui index c99871073..865bb0592 100644 --- a/resources/forms/bibleimport.ui +++ b/resources/forms/bibleimport.ui @@ -6,7 +6,7 @@ 0 0 494 - 658 + 725 @@ -16,7 +16,7 @@ 10 - 620 + 690 481 33 @@ -56,147 +56,106 @@ 8 - 74 + 65 451 - 71 + 81 OSIS Bible - - - - 110 - 29 - 271 - 28 - + + + 8 - - - - - 400 - 30 - 41 - 31 - + + 8 - - - - - - ../images/import_load.png../images/import_load.png - - - - - - 10 - 29 - 73 - 22 - - - - File Location: - - + + + + File Location: + + + + + + + + + + + + + + ../images/import_load.png../images/import_load.png + + + + - 8 - 150 + 10 + 170 451 - 161 + 191 CVS Bible - - - - 10 - 70 - 101 - 17 - + + + 8 - - Books Location: + + 8 - - - - - 110 - 70 - 271 - 28 - - - - - - - 400 - 70 - 41 - 31 - - - - PushButton - - - - ../images/import_load.png../images/import_load.png - - - - - - 10 - 110 - 91 - 17 - - - - Verse Location: - - - - - - 110 - 110 - 271 - 28 - - - - - - - 400 - 110 - 41 - 31 - - - - PushButton - - - - ../images/import_load.png../images/import_load.png - - + + + + Books Location: + + + + + + + Verse Location: + + + + + + + + + + + + + + + + + ../images/import_load.png../images/import_load.png + + + + + + + + + + + ../images/import_load.png../images/import_load.png + + + + @@ -394,10 +353,10 @@ - 8 - 450 - 481 - 136 + 10 + 435 + 471 + 151 @@ -448,19 +407,47 @@ - + - 10 - 590 - 54 + 20 + 670 + 451 17 - TextLabel + + + + + 10 + 600 + 471 + 70 + + + + Import Progress + + + + + + 0 + + + false + + + %p + + + + +