forked from openlp/openlp
Build dialog to add OSIS bible.
bzr-revno: 143
This commit is contained in:
parent
466a9b98bd
commit
aa55cd9af3
@ -50,6 +50,7 @@ class BibleManager():
|
||||
self.bibleDBCache = {} # dict of bible database classes
|
||||
self.bibleHTTPCache = {} # dict of bible http readers
|
||||
self.biblePath = ConfigHelper.getBiblePath()
|
||||
self.dialogobject = None
|
||||
#log.debug( self.biblePath )
|
||||
files = os.listdir(self.biblePath)
|
||||
for f in files:
|
||||
@ -66,6 +67,9 @@ class BibleManager():
|
||||
|
||||
log.debug( "Bible Initialised")
|
||||
|
||||
def processDialog(self, dialogobject):
|
||||
self.dialogobject = dialogobject
|
||||
|
||||
def registerHTTPBible(self, biblename, biblesource, proxyurl=None, proxyid=None, proxypass=None):
|
||||
"""
|
||||
Return a list of bibles from a given URL.
|
||||
@ -114,7 +118,7 @@ class BibleManager():
|
||||
nbible.createTables() # Create Database
|
||||
self.bibleDBCache[biblename] = nbible # cache the database for use later
|
||||
bcsv = BibleOSISImpl(nbible) # create the loader and pass in the database
|
||||
bcsv.loadData(osisfile)
|
||||
bcsv.loadData(osisfile, self.dialogobject)
|
||||
|
||||
|
||||
def loadBible(self,biblename):
|
||||
|
@ -45,11 +45,12 @@ class BibleOSISImpl():
|
||||
self.abbrevOfBible[p[0]] = p[2].replace('\n', '')
|
||||
|
||||
|
||||
def loadData(self, osisfile):
|
||||
self.bibledb.saveMeta("version", "Bible Version")
|
||||
def loadData(self, osisfile, dialogobject=None):
|
||||
self.bibledb.saveMeta("Version", "Bible Version")
|
||||
self.bibledb.saveMeta("Copyright", "(c) Some Bible company")
|
||||
self.bibledb.saveMeta("Permission", "You Have Some")
|
||||
|
||||
dialogobject.setMax(66)
|
||||
|
||||
osis=open(osisfile, 'r')
|
||||
|
||||
book_ptr = ""
|
||||
@ -90,6 +91,7 @@ class BibleOSISImpl():
|
||||
book_ptr = p[0]
|
||||
self.bibledb.createBook(int(p[1]), self.booksOfBible[p[0]] , self.abbrevOfBible[p[0]])
|
||||
id = self.bibledb.getBibleBookId(self.booksOfBible[p[0]])
|
||||
dialogobject.incrementBar()
|
||||
self.bibledb.addVerse(id[0], p[1], p[2], t)
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'bibleimport.ui'
|
||||
#
|
||||
# Created: Sat Nov 29 13:19:21 2008
|
||||
# Created: Sun Nov 30 14:32:39 2008
|
||||
# by: PyQt4 UI code generator 4.4.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -12,75 +12,65 @@ from PyQt4 import QtCore, QtGui
|
||||
class Ui_BibleImportDialog(object):
|
||||
def setupUi(self, BibleImportDialog):
|
||||
BibleImportDialog.setObjectName("BibleImportDialog")
|
||||
BibleImportDialog.resize(494, 734)
|
||||
BibleImportDialog.resize(494, 658)
|
||||
self.BibleImportButtonBox = QtGui.QDialogButtonBox(BibleImportDialog)
|
||||
self.BibleImportButtonBox.setGeometry(QtCore.QRect(10, 690, 481, 33))
|
||||
self.BibleImportButtonBox.setGeometry(QtCore.QRect(10, 620, 481, 33))
|
||||
self.BibleImportButtonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.BibleImportButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
|
||||
self.BibleImportButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
|
||||
self.BibleImportButtonBox.setObjectName("BibleImportButtonBox")
|
||||
self.ImportToolBox = QtGui.QToolBox(BibleImportDialog)
|
||||
self.ImportToolBox.setGeometry(QtCore.QRect(0, 0, 481, 431))
|
||||
self.ImportToolBox.setObjectName("ImportToolBox")
|
||||
self.CSVImportPage = QtGui.QWidget()
|
||||
self.CSVImportPage.setGeometry(QtCore.QRect(0, 0, 481, 338))
|
||||
self.CSVImportPage.setObjectName("CSVImportPage")
|
||||
self.groupBox_2 = QtGui.QGroupBox(self.CSVImportPage)
|
||||
self.groupBox_2.setGeometry(QtCore.QRect(10, 10, 451, 161))
|
||||
self.groupBox_2.setObjectName("groupBox_2")
|
||||
self.BibleNameLabel = QtGui.QLabel(self.groupBox_2)
|
||||
self.BibleNameLabel.setGeometry(QtCore.QRect(20, 30, 71, 17))
|
||||
self.BibleNameLabel.setObjectName("BibleNameLabel")
|
||||
self.BibleNameEdit = QtGui.QLineEdit(self.groupBox_2)
|
||||
self.BibleNameEdit.setGeometry(QtCore.QRect(110, 30, 271, 28))
|
||||
self.BibleNameEdit.setObjectName("BibleNameEdit")
|
||||
self.BooksLocationLabel = QtGui.QLabel(self.groupBox_2)
|
||||
self.BooksLocationLabel.setGeometry(QtCore.QRect(10, 70, 101, 17))
|
||||
self.BooksLocationLabel.setObjectName("BooksLocationLabel")
|
||||
self.BooksLocationEdit = QtGui.QLineEdit(self.groupBox_2)
|
||||
self.BooksLocationEdit.setGeometry(QtCore.QRect(110, 70, 271, 28))
|
||||
self.BooksLocationEdit.setObjectName("BooksLocationEdit")
|
||||
self.BooksFileButton = QtGui.QPushButton(self.groupBox_2)
|
||||
self.BooksFileButton.setGeometry(QtCore.QRect(390, 70, 41, 31))
|
||||
self.FileImportPage = QtGui.QWidget()
|
||||
self.FileImportPage.setGeometry(QtCore.QRect(0, 0, 481, 369))
|
||||
self.FileImportPage.setObjectName("FileImportPage")
|
||||
self.OSISGroupBox = QtGui.QGroupBox(self.FileImportPage)
|
||||
self.OSISGroupBox.setGeometry(QtCore.QRect(8, 74, 451, 71))
|
||||
self.OSISGroupBox.setObjectName("OSISGroupBox")
|
||||
self.OSISLocationEdit = QtGui.QLineEdit(self.OSISGroupBox)
|
||||
self.OSISLocationEdit.setGeometry(QtCore.QRect(110, 29, 271, 28))
|
||||
self.OSISLocationEdit.setObjectName("OSISLocationEdit")
|
||||
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.BooksFileButton.setIcon(icon)
|
||||
self.BooksFileButton.setObjectName("BooksFileButton")
|
||||
self.VerseLocationLabel = QtGui.QLabel(self.groupBox_2)
|
||||
self.VerseLocationLabel.setGeometry(QtCore.QRect(10, 110, 91, 17))
|
||||
self.VerseLocationLabel.setObjectName("VerseLocationLabel")
|
||||
self.VerseLocationEdit = QtGui.QLineEdit(self.groupBox_2)
|
||||
self.VerseLocationEdit.setGeometry(QtCore.QRect(110, 110, 271, 28))
|
||||
self.VerseLocationEdit.setObjectName("VerseLocationEdit")
|
||||
self.VersesFileButton = QtGui.QPushButton(self.groupBox_2)
|
||||
self.VersesFileButton.setGeometry(QtCore.QRect(390, 110, 41, 31))
|
||||
self.VersesFileButton.setIcon(icon)
|
||||
self.VersesFileButton.setObjectName("VersesFileButton")
|
||||
self.ImportToolBox.addItem(self.CSVImportPage, "")
|
||||
self.OSISImportPage = QtGui.QWidget()
|
||||
self.OSISImportPage.setGeometry(QtCore.QRect(0, 0, 481, 338))
|
||||
self.OSISImportPage.setObjectName("OSISImportPage")
|
||||
self.groupBox = QtGui.QGroupBox(self.OSISImportPage)
|
||||
self.groupBox.setGeometry(QtCore.QRect(10, 10, 451, 135))
|
||||
self.groupBox.setObjectName("groupBox")
|
||||
self.OSISBibleNameEdit = QtGui.QLineEdit(self.groupBox)
|
||||
self.OSISBibleNameEdit.setGeometry(QtCore.QRect(119, 39, 271, 28))
|
||||
self.OSISBibleNameEdit.setObjectName("OSISBibleNameEdit")
|
||||
self.OSISLocationEdit = QtGui.QLineEdit(self.groupBox)
|
||||
self.OSISLocationEdit.setGeometry(QtCore.QRect(119, 69, 271, 28))
|
||||
self.OSISLocationEdit.setObjectName("OSISLocationEdit")
|
||||
self.OsisFileButton = QtGui.QPushButton(self.groupBox)
|
||||
self.OsisFileButton.setGeometry(QtCore.QRect(400, 70, 41, 31))
|
||||
self.OsisFileButton.setIcon(icon)
|
||||
self.OsisFileButton.setObjectName("OsisFileButton")
|
||||
self.LocatioLabel = QtGui.QLabel(self.groupBox)
|
||||
self.LocatioLabel.setGeometry(QtCore.QRect(13, 69, 73, 22))
|
||||
self.LocatioLabel = QtGui.QLabel(self.OSISGroupBox)
|
||||
self.LocatioLabel.setGeometry(QtCore.QRect(10, 29, 73, 22))
|
||||
self.LocatioLabel.setObjectName("LocatioLabel")
|
||||
self.OSISNameLabel = QtGui.QLabel(self.groupBox)
|
||||
self.OSISNameLabel.setGeometry(QtCore.QRect(13, 39, 98, 22))
|
||||
self.OSISNameLabel.setObjectName("OSISNameLabel")
|
||||
self.ImportToolBox.addItem(self.OSISImportPage, "")
|
||||
self.CVSGroupBox = QtGui.QGroupBox(self.FileImportPage)
|
||||
self.CVSGroupBox.setGeometry(QtCore.QRect(8, 150, 451, 161))
|
||||
self.CVSGroupBox.setObjectName("CVSGroupBox")
|
||||
self.BooksLocationLabel = QtGui.QLabel(self.CVSGroupBox)
|
||||
self.BooksLocationLabel.setGeometry(QtCore.QRect(10, 70, 101, 17))
|
||||
self.BooksLocationLabel.setObjectName("BooksLocationLabel")
|
||||
self.BooksLocationEdit = QtGui.QLineEdit(self.CVSGroupBox)
|
||||
self.BooksLocationEdit.setGeometry(QtCore.QRect(110, 70, 271, 28))
|
||||
self.BooksLocationEdit.setObjectName("BooksLocationEdit")
|
||||
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.VersesFileButton = QtGui.QPushButton(self.CVSGroupBox)
|
||||
self.VersesFileButton.setGeometry(QtCore.QRect(400, 110, 41, 31))
|
||||
self.VersesFileButton.setIcon(icon)
|
||||
self.VersesFileButton.setObjectName("VersesFileButton")
|
||||
self.BibleNameEdit = QtGui.QLineEdit(self.FileImportPage)
|
||||
self.BibleNameEdit.setGeometry(QtCore.QRect(120, 20, 271, 28))
|
||||
self.BibleNameEdit.setObjectName("BibleNameEdit")
|
||||
self.BibleNameLabel = QtGui.QLabel(self.FileImportPage)
|
||||
self.BibleNameLabel.setGeometry(QtCore.QRect(18, 20, 98, 22))
|
||||
self.BibleNameLabel.setObjectName("BibleNameLabel")
|
||||
self.ImportToolBox.addItem(self.FileImportPage, "")
|
||||
self.WebBiblePage = QtGui.QWidget()
|
||||
self.WebBiblePage.setGeometry(QtCore.QRect(0, 0, 481, 338))
|
||||
self.WebBiblePage.setGeometry(QtCore.QRect(0, 0, 246, 265))
|
||||
self.WebBiblePage.setObjectName("WebBiblePage")
|
||||
self.WebBibleLayout = QtGui.QVBoxLayout(self.WebBiblePage)
|
||||
self.WebBibleLayout.setSpacing(8)
|
||||
@ -148,7 +138,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(10, 450, 481, 136))
|
||||
self.LicenceDetailsGroupBox.setGeometry(QtCore.QRect(8, 450, 481, 136))
|
||||
self.LicenceDetailsGroupBox.setMinimumSize(QtCore.QSize(0, 123))
|
||||
self.LicenceDetailsGroupBox.setObjectName("LicenceDetailsGroupBox")
|
||||
self.formLayout = QtGui.QFormLayout(self.LicenceDetailsGroupBox)
|
||||
@ -173,40 +163,29 @@ class Ui_BibleImportDialog(object):
|
||||
self.PermisionEdit = QtGui.QLineEdit(self.LicenceDetailsGroupBox)
|
||||
self.PermisionEdit.setObjectName("PermisionEdit")
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PermisionEdit)
|
||||
self.ProgressGroupBox = QtGui.QGroupBox(BibleImportDialog)
|
||||
self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 590, 481, 92))
|
||||
self.ProgressGroupBox.setObjectName("ProgressGroupBox")
|
||||
self.ProgressLayout = QtGui.QFormLayout(self.ProgressGroupBox)
|
||||
self.ProgressLayout.setMargin(8)
|
||||
self.ProgressLayout.setSpacing(8)
|
||||
self.ProgressLayout.setObjectName("ProgressLayout")
|
||||
self.ProgressStatusLabel = QtGui.QLabel(self.ProgressGroupBox)
|
||||
self.ProgressStatusLabel.setObjectName("ProgressStatusLabel")
|
||||
self.ProgressLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.ProgressStatusLabel)
|
||||
self.progressBar = QtGui.QProgressBar(self.ProgressGroupBox)
|
||||
self.progressBar.setProperty("value", QtCore.QVariant(24))
|
||||
self.progressBar.setObjectName("progressBar")
|
||||
self.ProgressLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.progressBar)
|
||||
self.StatusLabel = QtGui.QLabel(BibleImportDialog)
|
||||
self.StatusLabel.setGeometry(QtCore.QRect(10, 590, 54, 17))
|
||||
self.StatusLabel.setObjectName("StatusLabel")
|
||||
|
||||
self.retranslateUi(BibleImportDialog)
|
||||
self.ImportToolBox.setCurrentIndex(0)
|
||||
QtCore.QObject.connect(self.BibleImportButtonBox, QtCore.SIGNAL("accepted()"), BibleImportDialog.accept)
|
||||
QtCore.QObject.connect(self.BibleImportButtonBox, QtCore.SIGNAL("rejected()"), BibleImportDialog.reject)
|
||||
QtCore.QObject.connect(self.BibleImportButtonBox, QtCore.SIGNAL("rejected()"), BibleImportDialog.close)
|
||||
QtCore.QObject.connect(self.BibleImportButtonBox, QtCore.SIGNAL("accepted()"), BibleImportDialog.close)
|
||||
QtCore.QMetaObject.connectSlotsByName(BibleImportDialog)
|
||||
|
||||
def retranslateUi(self, BibleImportDialog):
|
||||
BibleImportDialog.setWindowTitle(QtGui.QApplication.translate("BibleImportDialog", "Bible Registration", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.groupBox_2.setTitle(QtGui.QApplication.translate("BibleImportDialog", "CVS Bible", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.BibleNameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Bible Name:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.OSISGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "OSIS Bible", None, QtGui.QApplication.UnicodeUTF8))
|
||||
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.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.CSVImportPage), QtGui.QApplication.translate("BibleImportDialog", "CVS File Import", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.groupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "OSIS Bible", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.LocatioLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "File Location:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.OSISNameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "OSIS Bible Name:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.OSISImportPage), QtGui.QApplication.translate("BibleImportDialog", "OSIS XML Bible Import", 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))
|
||||
self.LocationLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Location:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.LocationComboBox.setItemText(0, QtGui.QApplication.translate("BibleImportDialog", "BibleGateway", None, QtGui.QApplication.UnicodeUTF8))
|
||||
@ -221,11 +200,10 @@ class Ui_BibleImportDialog(object):
|
||||
self.AddressLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Proxy Address:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.UsernameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Username:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.PasswordLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Password:", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.WebBiblePage), QtGui.QApplication.translate("BibleImportDialog", "Web Bible Download", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ImportToolBox.setItemText(self.ImportToolBox.indexOf(self.WebBiblePage), QtGui.QApplication.translate("BibleImportDialog", "Web Bible Import page", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.LicenceDetailsGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Licence Details", None, QtGui.QApplication.UnicodeUTF8))
|
||||
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.ProgressGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Progress", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ProgressStatusLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.StatusLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
|
@ -6,6 +6,8 @@ Module implementing BibleImportDialog.
|
||||
import sys
|
||||
import os, os.path
|
||||
import sys
|
||||
import time
|
||||
|
||||
mypath=os.path.split(os.path.abspath(__file__))[0]
|
||||
sys.path.insert(0,(os.path.join(mypath, '..', '..', '..', '..')))
|
||||
|
||||
@ -14,6 +16,8 @@ from PyQt4.QtGui import QDialog
|
||||
from PyQt4.QtCore import pyqtSignature
|
||||
|
||||
from bibleimportdialog import Ui_BibleImportDialog
|
||||
from bibleimportprogressform import BibleImportProgressForm
|
||||
|
||||
from openlp.plugins.biblemanager.bibleManager import BibleManager
|
||||
|
||||
class BibleImportForm(QDialog, Ui_BibleImportDialog):
|
||||
@ -27,8 +31,9 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog):
|
||||
QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.biblemanager = biblemanager
|
||||
self.ProgressGroupBox.hide() # not wanted until we do some processing
|
||||
#self.CSVImportPage.SetEt
|
||||
self.savebutton = self.BibleImportButtonBox.button(QtGui.QDialogButtonBox.Save)
|
||||
self.BibleImportButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid
|
||||
|
||||
|
||||
@pyqtSignature("")
|
||||
def on_VersesFileButton_clicked(self):
|
||||
@ -44,6 +49,44 @@ class BibleImportForm(QDialog, Ui_BibleImportDialog):
|
||||
def on_OsisFileButton_clicked(self):
|
||||
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home')
|
||||
self.OSISLocationEdit.setText(filename)
|
||||
def on_OSISLocationEdit_lostFocus(self):
|
||||
self.validate()
|
||||
def on_BooksLocationEdit_lostFocus(self):
|
||||
self.validate()
|
||||
def on_CopyrightEdit_lostFocus(self):
|
||||
self.validate()
|
||||
def on_VersionNameEdit_lostFocus(self):
|
||||
self.validate()
|
||||
def on_PermisionEdit_lostFocus(self):
|
||||
self.validate()
|
||||
def on_BibleNameEdit_lostFocus(self):
|
||||
self.validate()
|
||||
def on_BibleImportButtonBox_clicked(self,button):
|
||||
print button.text()
|
||||
if button.text() == "Save":
|
||||
bipf = BibleImportProgressForm()
|
||||
bipf.show()
|
||||
self.biblemanager.processDialog(bipf)
|
||||
self.biblemanager.registerOSISFileBible(str(self.BibleNameEdit.displayText()), self.OSISLocationEdit.displayText())
|
||||
|
||||
|
||||
|
||||
def validate(self):
|
||||
valid = False
|
||||
validcount = 0
|
||||
if len(self.BibleNameEdit.displayText()) > 0:
|
||||
validcount += 1
|
||||
if len(self.OSISLocationEdit.displayText()) > 0:
|
||||
validcount += 1
|
||||
if len(self.BooksLocationEdit.displayText()) > 0:
|
||||
validcount += 1
|
||||
if len(self.VersionNameEdit.displayText()) > 0 and len(self.CopyrightEdit.displayText()) > 0 and len(self.PermisionEdit.displayText()) > 0:
|
||||
valid = True
|
||||
if validcount == 2 and valid:
|
||||
self.BibleImportButtonBox.addButton(self.savebutton, QtGui.QDialogButtonBox.AcceptRole) # hide the save button tile screen is valid
|
||||
else:
|
||||
self.BibleImportButtonBox.removeButton(self.savebutton) # hide the save button tile screen is valid
|
||||
|
||||
|
||||
|
||||
class runner(QtGui.QApplication):
|
||||
|
@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'bibleimportprogress.ui'
|
||||
#
|
||||
# Created: Sun Nov 30 16:19:26 2008
|
||||
# by: PyQt4 UI code generator 4.4.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
class Ui_BibleImportProgressDialog(object):
|
||||
def setupUi(self, BibleImportProgressDialog):
|
||||
BibleImportProgressDialog.setObjectName("BibleImportProgressDialog")
|
||||
BibleImportProgressDialog.resize(505, 150)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(BibleImportProgressDialog)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(150, 110, 341, 32))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.ProgressGroupBox = QtGui.QGroupBox(BibleImportProgressDialog)
|
||||
self.ProgressGroupBox.setGeometry(QtCore.QRect(10, 10, 481, 64))
|
||||
self.ProgressGroupBox.setObjectName("ProgressGroupBox")
|
||||
self.progressBar = QtGui.QProgressBar(self.ProgressGroupBox)
|
||||
self.progressBar.setGeometry(QtCore.QRect(10, 27, 451, 28))
|
||||
self.progressBar.setProperty("value", QtCore.QVariant(24))
|
||||
self.progressBar.setObjectName("progressBar")
|
||||
|
||||
self.retranslateUi(BibleImportProgressDialog)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), BibleImportProgressDialog.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), BibleImportProgressDialog.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(BibleImportProgressDialog)
|
||||
|
||||
def retranslateUi(self, BibleImportProgressDialog):
|
||||
BibleImportProgressDialog.setWindowTitle(QtGui.QApplication.translate("BibleImportProgressDialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ProgressGroupBox.setTitle(QtGui.QApplication.translate("BibleImportProgressDialog", "Progress", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
58
openlp/plugins/biblemanager/forms/bibleimportprogressform.py
Normal file
58
openlp/plugins/biblemanager/forms/bibleimportprogressform.py
Normal file
@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Module implementing BibleImportDialog.
|
||||
"""
|
||||
import sys
|
||||
import os, os.path
|
||||
import sys
|
||||
import time
|
||||
|
||||
mypath=os.path.split(os.path.abspath(__file__))[0]
|
||||
sys.path.insert(0,(os.path.join(mypath, '..', '..', '..', '..')))
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.QtGui import QDialog
|
||||
from PyQt4.QtCore import pyqtSignature
|
||||
|
||||
from bibleimportprogressdialog import Ui_BibleImportProgressDialog
|
||||
from openlp.plugins.biblemanager.bibleManager import BibleManager
|
||||
|
||||
class BibleImportProgressForm(QDialog, Ui_BibleImportProgressDialog):
|
||||
"""
|
||||
Class documentation goes here.
|
||||
"""
|
||||
def __init__(self, biblemanager = None, parent = None):
|
||||
"""
|
||||
Constructor
|
||||
"""
|
||||
QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self.biblemanager = biblemanager
|
||||
self.progressBar.setValue(0)
|
||||
self.progress = 0
|
||||
|
||||
def setMax(self, max):
|
||||
self.progressBar.setMaximum(max)
|
||||
|
||||
def incrementBar(self):
|
||||
self.progress +=1
|
||||
self.progressBar.setValue(self.progress)
|
||||
|
||||
|
||||
#self.ProgressGroupBox.hide() # not wanted until we do some processing
|
||||
def on_buttonBox_clicked(self,button):
|
||||
print button.text()
|
||||
|
||||
class runner(QtGui.QApplication):
|
||||
|
||||
def run(self):
|
||||
self.bm = BibleManager()
|
||||
self.bim = BibleImportProgressForm(self.bm)
|
||||
self.bim.show()
|
||||
self.processEvents()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = runner(sys.argv)
|
||||
app.run()
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>494</width>
|
||||
<height>734</height>
|
||||
<height>658</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -17,7 +17,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>690</y>
|
||||
<y>620</y>
|
||||
<width>481</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
@ -26,7 +26,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBox" name="ImportToolBox">
|
||||
@ -41,26 +41,76 @@
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="CSVImportPage">
|
||||
<widget class="QWidget" name="FileImportPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>481</width>
|
||||
<height>338</height>
|
||||
<height>369</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>CVS File Import</string>
|
||||
<string>File Import Page</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<widget class="QGroupBox" name="OSISGroupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<x>8</x>
|
||||
<y>74</y>
|
||||
<width>451</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>OSIS Bible</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="OSISLocationEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>29</y>
|
||||
<width>271</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="OsisFileButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>30</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>../images/import_load.png</normaloff>../images/import_load.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LocatioLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>29</y>
|
||||
<width>73</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="CVSGroupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>8</x>
|
||||
<y>150</y>
|
||||
<width>451</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
@ -68,29 +118,6 @@
|
||||
<property name="title">
|
||||
<string>CVS Bible</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="BibleNameLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bible Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="BibleNameEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>30</y>
|
||||
<width>271</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="BooksLocationLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -117,7 +144,7 @@
|
||||
<widget class="QPushButton" name="BooksFileButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<x>400</x>
|
||||
<y>70</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
@ -157,7 +184,7 @@
|
||||
<widget class="QPushButton" name="VersesFileButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<x>400</x>
|
||||
<y>110</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
@ -172,94 +199,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="OSISImportPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>481</width>
|
||||
<height>338</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>OSIS XML Bible Import</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<widget class="QLineEdit" name="BibleNameEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>451</width>
|
||||
<height>135</height>
|
||||
<x>120</x>
|
||||
<y>20</y>
|
||||
<width>271</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>OSIS Bible</string>
|
||||
</widget>
|
||||
<widget class="QLabel" name="BibleNameLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>18</x>
|
||||
<y>20</y>
|
||||
<width>98</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bible Name:</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="OSISBibleNameEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>119</x>
|
||||
<y>39</y>
|
||||
<width>271</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="OSISLocationEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>119</x>
|
||||
<y>69</y>
|
||||
<width>271</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="OsisFileButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>70</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>../images/import_load.png</normaloff>../images/import_load.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="LocatioLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>13</x>
|
||||
<y>69</y>
|
||||
<width>73</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>File Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="OSISNameLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>13</x>
|
||||
<y>39</y>
|
||||
<width>98</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OSIS Bible Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="WebBiblePage">
|
||||
@ -267,12 +228,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>481</width>
|
||||
<height>338</height>
|
||||
<width>246</width>
|
||||
<height>265</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Web Bible Download</string>
|
||||
<string>Web Bible Import page</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="WebBibleLayout">
|
||||
<property name="spacing">
|
||||
@ -434,7 +395,7 @@
|
||||
<widget class="QGroupBox" name="LicenceDetailsGroupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>8</x>
|
||||
<y>450</y>
|
||||
<width>481</width>
|
||||
<height>136</height>
|
||||
@ -488,43 +449,18 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="ProgressGroupBox">
|
||||
<widget class="QLabel" name="StatusLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>590</y>
|
||||
<width>481</width>
|
||||
<height>92</height>
|
||||
<width>54</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Progress</string>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="ProgressLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ProgressStatusLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
@ -561,5 +497,37 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>BibleImportButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>BibleImportDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>429</x>
|
||||
<y>711</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>522</x>
|
||||
<y>689</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>BibleImportButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>BibleImportDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>370</x>
|
||||
<y>705</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>554</x>
|
||||
<y>615</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
94
resources/forms/bibleimportprogress.ui
Normal file
94
resources/forms/bibleimportprogress.ui
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BibleImportProgressDialog</class>
|
||||
<widget class="QDialog" name="BibleImportProgressDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>505</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>110</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="ProgressGroupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>481</width>
|
||||
<height>64</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Progress</string>
|
||||
</property>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>27</y>
|
||||
<width>451</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>BibleImportProgressDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>BibleImportProgressDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user