diff --git a/openlp/plugins/biblemanager/bibleManager.py b/openlp/plugins/biblemanager/bibleManager.py index ca4121e84..b2047887c 100644 --- a/openlp/plugins/biblemanager/bibleManager.py +++ b/openlp/plugins/biblemanager/bibleManager.py @@ -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): diff --git a/openlp/plugins/biblemanager/bibleOSISImpl.py b/openlp/plugins/biblemanager/bibleOSISImpl.py index c147c111b..29304342e 100644 --- a/openlp/plugins/biblemanager/bibleOSISImpl.py +++ b/openlp/plugins/biblemanager/bibleOSISImpl.py @@ -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) diff --git a/openlp/plugins/biblemanager/forms/bibleimportdialog.py b/openlp/plugins/biblemanager/forms/bibleimportdialog.py index 27b71c396..dceeb539d 100644 --- a/openlp/plugins/biblemanager/forms/bibleimportdialog.py +++ b/openlp/plugins/biblemanager/forms/bibleimportdialog.py @@ -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)) diff --git a/openlp/plugins/biblemanager/forms/bibleimportform.py b/openlp/plugins/biblemanager/forms/bibleimportform.py index e00bef527..0b4b0820a 100644 --- a/openlp/plugins/biblemanager/forms/bibleimportform.py +++ b/openlp/plugins/biblemanager/forms/bibleimportform.py @@ -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): diff --git a/openlp/plugins/biblemanager/forms/bibleimportprogressdialog.py b/openlp/plugins/biblemanager/forms/bibleimportprogressdialog.py new file mode 100644 index 000000000..0ce1bd76c --- /dev/null +++ b/openlp/plugins/biblemanager/forms/bibleimportprogressdialog.py @@ -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)) + diff --git a/openlp/plugins/biblemanager/forms/bibleimportprogressform.py b/openlp/plugins/biblemanager/forms/bibleimportprogressform.py new file mode 100644 index 000000000..ed44bab7b --- /dev/null +++ b/openlp/plugins/biblemanager/forms/bibleimportprogressform.py @@ -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() diff --git a/resources/forms/bibleimport.ui b/resources/forms/bibleimport.ui index 94580c179..1f4e58386 100644 --- a/resources/forms/bibleimport.ui +++ b/resources/forms/bibleimport.ui @@ -7,7 +7,7 @@ 0 0 494 - 734 + 658 @@ -17,7 +17,7 @@ 10 - 690 + 620 481 33 @@ -26,7 +26,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel + QDialogButtonBox::Cancel|QDialogButtonBox::Save @@ -41,26 +41,76 @@ 0 - + 0 0 481 - 338 + 369 - - - - CVS File Import + File Import Page - + - 10 - 10 + 8 + 74 + 451 + 71 + + + + OSIS Bible + + + + + 110 + 29 + 271 + 28 + + + + + + + 400 + 30 + 41 + 31 + + + + + + + + ../images/import_load.png../images/import_load.png + + + + + + 10 + 29 + 73 + 22 + + + + File Location: + + + + + + + 8 + 150 451 161 @@ -68,29 +118,6 @@ CVS Bible - - - - 20 - 30 - 71 - 17 - - - - Bible Name: - - - - - - 110 - 30 - 271 - 28 - - - @@ -117,7 +144,7 @@ - 390 + 400 70 41 31 @@ -157,7 +184,7 @@ - 390 + 400 110 41 31 @@ -172,94 +199,28 @@ - - - - - 0 - 0 - 481 - 338 - - - - OSIS XML Bible Import - - + - 10 - 10 - 451 - 135 + 120 + 20 + 271 + 28 - - OSIS Bible + + + + + 18 + 20 + 98 + 22 + + + + Bible Name: - - - - 119 - 39 - 271 - 28 - - - - - - - 119 - 69 - 271 - 28 - - - - - - - 400 - 70 - 41 - 31 - - - - - - - - ../images/import_load.png../images/import_load.png - - - - - - 13 - 69 - 73 - 22 - - - - File Location: - - - - - - 13 - 39 - 98 - 22 - - - - OSIS Bible Name: - - @@ -267,12 +228,12 @@ 0 0 - 481 - 338 + 246 + 265 - Web Bible Download + Web Bible Import page @@ -434,7 +395,7 @@ - 10 + 8 450 481 136 @@ -488,43 +449,18 @@ - + 10 590 - 481 - 92 + 54 + 17 - - Progress + + TextLabel - - - 8 - - - 8 - - - 8 - - - - - TextLabel - - - - - - - 24 - - - - @@ -561,5 +497,37 @@ + + BibleImportButtonBox + rejected() + BibleImportDialog + close() + + + 429 + 711 + + + 522 + 689 + + + + + BibleImportButtonBox + accepted() + BibleImportDialog + close() + + + 370 + 705 + + + 554 + 615 + + + diff --git a/resources/forms/bibleimportprogress.ui b/resources/forms/bibleimportprogress.ui new file mode 100644 index 000000000..dbe0f4f06 --- /dev/null +++ b/resources/forms/bibleimportprogress.ui @@ -0,0 +1,94 @@ + + + BibleImportProgressDialog + + + + 0 + 0 + 505 + 150 + + + + Dialog + + + + + 150 + 110 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel + + + + + + 10 + 10 + 481 + 64 + + + + Progress + + + + + 10 + 27 + 451 + 28 + + + + 24 + + + + + + + + buttonBox + accepted() + BibleImportProgressDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + BibleImportProgressDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +