Hook things together !

Plugin initalise biblemanger
Plugin calls Dialog with biblemamager on register bible

bzr-revno: 141
This commit is contained in:
Tim Bentley 2008-11-29 07:56:21 +00:00
parent 2e3ff9706f
commit 08b5acb83f
4 changed files with 268 additions and 14 deletions

View File

@ -22,10 +22,16 @@ from PyQt4 import QtCore, QtGui
from openlp.core.resources import * from openlp.core.resources import *
from openlp.core import Plugin from openlp.core import Plugin
from openlp.plugins.biblemanager.biblemanager import BibleManager
from openlp.plugins.biblemanager.bibleimportform import BibleImportForm
class BiblePlugin(Plugin): class BiblePlugin(Plugin):
def __init__(self): def __init__(self):
# Call the parent constructor # Call the parent constructor
Plugin.__init__(self, 'Bible', '1.9.0') Plugin.__init__(self, 'Bible', '1.9.0')
#Register the bible Manager
self.biblemanager = BibleManager()
# Create the plugin icon # Create the plugin icon
self.Icon = QtGui.QIcon() self.Icon = QtGui.QIcon()
self.Icon.addPixmap(QtGui.QPixmap(':/media/media_Bible.png'), self.Icon.addPixmap(QtGui.QPixmap(':/media/media_Bible.png'),
@ -36,7 +42,7 @@ class BiblePlugin(Plugin):
self.MediaManagerItem.addToolbar() self.MediaManagerItem.addToolbar()
# Create buttons for the toolbar # Create buttons for the toolbar
## New Bible Button ## ## New Bible Button ##
self.MediaManagerItem.addToolbarButton('New Bible', 'Add a new Bible', self.MediaManagerItem.addToolbarButton('New Bible', 'Register a new Bible',
':/Bibles/Bible_new.png', self.onBibleNewClick, 'BibleNewItem') ':/Bibles/Bible_new.png', self.onBibleNewClick, 'BibleNewItem')
## Separator Line ## ## Separator Line ##
self.MediaManagerItem.addToolbarLine() self.MediaManagerItem.addToolbarLine()
@ -62,7 +68,7 @@ class BiblePlugin(Plugin):
self.MediaManagerItem.PageLayout.addWidget(self.BibleList) self.MediaManagerItem.PageLayout.addWidget(self.BibleList)
def onBibleNewClick(self): def onBibleNewClick(self):
pass self.bibleimportform(self.biblemanager)
def onBiblePreviewClick(self): def onBiblePreviewClick(self):
pass pass
@ -73,15 +79,4 @@ class BiblePlugin(Plugin):
def onBibleAddClick(self): def onBibleAddClick(self):
pass pass
s
class runner(QtGui.QApplication):
def run(self):
values = ["Genesis","Matthew","Revelation"]
self.bim = BibleImportDialog()
self.bim.show()
self.processEvents()
sys.exit(app.exec_())
if __name__ == '__main__':
app = runner(sys.argv)
app.run()

View File

@ -0,0 +1,206 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'bibleimport.ui'
#
# Created: Thu Nov 27 21:12:03 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_BibleImportDialog(object):
def setupUi(self, BibleImportDialog):
BibleImportDialog.setObjectName("BibleImportDialog")
BibleImportDialog.resize(494, 746)
self.BibleImportButtonBox = QtGui.QDialogButtonBox(BibleImportDialog)
self.BibleImportButtonBox.setGeometry(QtCore.QRect(7, 710, 481, 33))
self.BibleImportButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.BibleImportButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel)
self.BibleImportButtonBox.setObjectName("BibleImportButtonBox")
self.ImportToolBox = QtGui.QToolBox(BibleImportDialog)
self.ImportToolBox.setGeometry(QtCore.QRect(8, 8, 481, 401))
self.ImportToolBox.setObjectName("ImportToolBox")
self.CSVImportPage = QtGui.QWidget()
self.CSVImportPage.setGeometry(QtCore.QRect(0, 0, 481, 308))
self.CSVImportPage.setObjectName("CSVImportPage")
self.BibleNameLabel = QtGui.QLabel(self.CSVImportPage)
self.BibleNameLabel.setGeometry(QtCore.QRect(20, 40, 71, 17))
self.BibleNameLabel.setObjectName("BibleNameLabel")
self.BooksLocationLabel = QtGui.QLabel(self.CSVImportPage)
self.BooksLocationLabel.setGeometry(QtCore.QRect(20, 80, 101, 17))
self.BooksLocationLabel.setObjectName("BooksLocationLabel")
self.VerseLocationLabel = QtGui.QLabel(self.CSVImportPage)
self.VerseLocationLabel.setGeometry(QtCore.QRect(20, 120, 91, 17))
self.VerseLocationLabel.setObjectName("VerseLocationLabel")
self.BibleNameEdit = QtGui.QLineEdit(self.CSVImportPage)
self.BibleNameEdit.setGeometry(QtCore.QRect(120, 40, 271, 23))
self.BibleNameEdit.setObjectName("BibleNameEdit")
self.BooksLocationEdit = QtGui.QLineEdit(self.CSVImportPage)
self.BooksLocationEdit.setGeometry(QtCore.QRect(120, 80, 271, 23))
self.BooksLocationEdit.setObjectName("BooksLocationEdit")
self.VerseLocationEdit = QtGui.QLineEdit(self.CSVImportPage)
self.VerseLocationEdit.setGeometry(QtCore.QRect(120, 120, 271, 23))
self.VerseLocationEdit.setObjectName("VerseLocationEdit")
self.BooksFileButton = QtGui.QPushButton(self.CSVImportPage)
self.BooksFileButton.setGeometry(QtCore.QRect(400, 80, 41, 27))
self.BooksFileButton.setObjectName("BooksFileButton")
self.VersesFileButton = QtGui.QPushButton(self.CSVImportPage)
self.VersesFileButton.setGeometry(QtCore.QRect(400, 120, 41, 27))
self.VersesFileButton.setObjectName("VersesFileButton")
self.ImportToolBox.addItem(self.CSVImportPage, "")
self.OSISImportPage = QtGui.QWidget()
self.OSISImportPage.setGeometry(QtCore.QRect(0, 0, 481, 308))
self.OSISImportPage.setObjectName("OSISImportPage")
self.OSISBibleNameEdit = QtGui.QLineEdit(self.OSISImportPage)
self.OSISBibleNameEdit.setGeometry(QtCore.QRect(120, 50, 291, 23))
self.OSISBibleNameEdit.setObjectName("OSISBibleNameEdit")
self.OSISNameLabel = QtGui.QLabel(self.OSISImportPage)
self.OSISNameLabel.setGeometry(QtCore.QRect(10, 50, 101, 17))
self.OSISNameLabel.setObjectName("OSISNameLabel")
self.OSISLocationEdit = QtGui.QLineEdit(self.OSISImportPage)
self.OSISLocationEdit.setGeometry(QtCore.QRect(120, 90, 291, 23))
self.OSISLocationEdit.setObjectName("OSISLocationEdit")
self.LocatioLabel = QtGui.QLabel(self.OSISImportPage)
self.LocatioLabel.setGeometry(QtCore.QRect(10, 90, 91, 17))
self.LocatioLabel.setObjectName("LocationLabel")
self.OsisFileButton = QtGui.QPushButton(self.OSISImportPage)
self.OsisFileButton.setGeometry(QtCore.QRect(420, 90, 41, 27))
self.OsisFileButton.setObjectName("OsisFileButton")
self.ImportToolBox.addItem(self.OSISImportPage, "")
self.WebBiblePage = QtGui.QWidget()
self.WebBiblePage.setGeometry(QtCore.QRect(0, 0, 481, 308))
self.WebBiblePage.setObjectName("WebBiblePage")
self.WebBibleLayout = QtGui.QVBoxLayout(self.WebBiblePage)
self.WebBibleLayout.setSpacing(8)
self.WebBibleLayout.setMargin(8)
self.WebBibleLayout.setObjectName("WebBibleLayout")
self.OptionsGroupBox = QtGui.QGroupBox(self.WebBiblePage)
self.OptionsGroupBox.setObjectName("OptionsGroupBox")
self.OptionsLayout = QtGui.QFormLayout(self.OptionsGroupBox)
self.OptionsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.OptionsLayout.setLabelAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.OptionsLayout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.OptionsLayout.setMargin(8)
self.OptionsLayout.setSpacing(8)
self.OptionsLayout.setObjectName("OptionsLayout")
self.LocationLabel = QtGui.QLabel(self.OptionsGroupBox)
self.LocationLabel.setObjectName("LocationLabel")
self.OptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.LocationLabel)
self.LocationComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.LocationComboBox.setObjectName("LocationComboBox")
self.LocationComboBox.addItem(QtCore.QString())
self.LocationComboBox.addItem(QtCore.QString())
self.OptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.LocationComboBox)
self.TypeLabel = QtGui.QLabel(self.OptionsGroupBox)
self.TypeLabel.setObjectName("TypeLabel")
self.OptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.TypeLabel)
self.TypeComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.TypeComboBox.setObjectName("TypeComboBox")
self.TypeComboBox.addItem(QtCore.QString())
self.TypeComboBox.addItem(QtCore.QString())
self.OptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.TypeComboBox)
self.BibleLabel = QtGui.QLabel(self.OptionsGroupBox)
self.BibleLabel.setObjectName("BibleLabel")
self.OptionsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.BibleLabel)
self.BibleComboBox = QtGui.QComboBox(self.OptionsGroupBox)
self.BibleComboBox.setObjectName("BibleComboBox")
self.BibleComboBox.addItem(QtCore.QString())
self.BibleComboBox.addItem(QtCore.QString())
self.OptionsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.BibleComboBox)
self.WebBibleLayout.addWidget(self.OptionsGroupBox)
self.ProxyGroupBox = QtGui.QGroupBox(self.WebBiblePage)
self.ProxyGroupBox.setObjectName("ProxyGroupBox")
self.ProxySettingsLayout = QtGui.QFormLayout(self.ProxyGroupBox)
self.ProxySettingsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.ProxySettingsLayout.setMargin(8)
self.ProxySettingsLayout.setSpacing(8)
self.ProxySettingsLayout.setObjectName("ProxySettingsLayout")
self.AddressLabel = QtGui.QLabel(self.ProxyGroupBox)
self.AddressLabel.setObjectName("AddressLabel")
self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.AddressLabel)
self.AddressEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.AddressEdit.setObjectName("AddressEdit")
self.ProxySettingsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.AddressEdit)
self.UsernameLabel = QtGui.QLabel(self.ProxyGroupBox)
self.UsernameLabel.setObjectName("UsernameLabel")
self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.UsernameLabel)
self.UsernameEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.UsernameEdit.setObjectName("UsernameEdit")
self.ProxySettingsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.UsernameEdit)
self.PasswordLabel = QtGui.QLabel(self.ProxyGroupBox)
self.PasswordLabel.setObjectName("PasswordLabel")
self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.PasswordLabel)
self.PasswordEdit = QtGui.QLineEdit(self.ProxyGroupBox)
self.PasswordEdit.setObjectName("PasswordEdit")
self.ProxySettingsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.PasswordEdit)
self.WebBibleLayout.addWidget(self.ProxyGroupBox)
self.ImportToolBox.addItem(self.WebBiblePage, "")
self.groupBox = QtGui.QGroupBox(BibleImportDialog)
self.groupBox.setGeometry(QtCore.QRect(20, 430, 461, 111))
self.groupBox.setObjectName("groupBox")
self.label = QtGui.QLabel(self.groupBox)
self.label.setGeometry(QtCore.QRect(10, 20, 54, 17))
self.label.setObjectName("label")
self.label_2 = QtGui.QLabel(self.groupBox)
self.label_2.setGeometry(QtCore.QRect(10, 50, 54, 17))
self.label_2.setObjectName("label_2")
self.label_3 = QtGui.QLabel(self.groupBox)
self.label_3.setGeometry(QtCore.QRect(10, 80, 54, 17))
self.label_3.setObjectName("label_3")
self.lineEdit_4 = QtGui.QLineEdit(self.groupBox)
self.lineEdit_4.setGeometry(QtCore.QRect(80, 20, 361, 23))
self.lineEdit_4.setObjectName("lineEdit_4")
self.lineEdit_5 = QtGui.QLineEdit(self.groupBox)
self.lineEdit_5.setGeometry(QtCore.QRect(80, 50, 361, 23))
self.lineEdit_5.setObjectName("lineEdit_5")
self.lineEdit_6 = QtGui.QLineEdit(self.groupBox)
self.lineEdit_6.setGeometry(QtCore.QRect(80, 80, 361, 23))
self.lineEdit_6.setObjectName("lineEdit_6")
self.groupBox_2 = QtGui.QGroupBox(BibleImportDialog)
self.groupBox_2.setGeometry(QtCore.QRect(20, 560, 461, 71))
self.groupBox_2.setObjectName("groupBox_2")
self.progressBar = QtGui.QProgressBar(self.groupBox_2)
self.progressBar.setGeometry(QtCore.QRect(10, 30, 441, 23))
self.progressBar.setProperty("value", QtCore.QVariant(24))
self.progressBar.setObjectName("progressBar")
self.retranslateUi(BibleImportDialog)
self.ImportToolBox.setCurrentIndex(1)
QtCore.QObject.connect(self.BibleImportButtonBox, QtCore.SIGNAL("accepted()"), BibleImportDialog.accept)
QtCore.QObject.connect(self.BibleImportButtonBox, QtCore.SIGNAL("rejected()"), BibleImportDialog.reject)
QtCore.QMetaObject.connectSlotsByName(BibleImportDialog)
def retranslateUi(self, BibleImportDialog):
BibleImportDialog.setWindowTitle(QtGui.QApplication.translate("BibleImportDialog", "Bible Registration", None, QtGui.QApplication.UnicodeUTF8))
self.BibleNameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Bible Name:", None, QtGui.QApplication.UnicodeUTF8))
self.BooksLocationLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Books Location:", None, QtGui.QApplication.UnicodeUTF8))
self.VerseLocationLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Verse Location:", None, QtGui.QApplication.UnicodeUTF8))
self.BooksFileButton.setText(QtGui.QApplication.translate("BibleImportDialog", "PushButton", 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.OSISNameLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "OSIS Bible Name:", None, QtGui.QApplication.UnicodeUTF8))
self.LocatioLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "File Location:", None, QtGui.QApplication.UnicodeUTF8))
self.OsisFileButton.setText(QtGui.QApplication.translate("BibleImportDialog", "PushButton", 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.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))
self.LocationComboBox.setItemText(1, QtGui.QApplication.translate("BibleImportDialog", "CrossWire", None, QtGui.QApplication.UnicodeUTF8))
self.TypeLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Type:", None, QtGui.QApplication.UnicodeUTF8))
self.TypeComboBox.setItemText(0, QtGui.QApplication.translate("BibleImportDialog", "Download As Needed", None, QtGui.QApplication.UnicodeUTF8))
self.TypeComboBox.setItemText(1, QtGui.QApplication.translate("BibleImportDialog", "Download All", None, QtGui.QApplication.UnicodeUTF8))
self.BibleLabel.setText(QtGui.QApplication.translate("BibleImportDialog", "Bible:", None, QtGui.QApplication.UnicodeUTF8))
self.BibleComboBox.setItemText(0, QtGui.QApplication.translate("BibleImportDialog", "NIV", None, QtGui.QApplication.UnicodeUTF8))
self.BibleComboBox.setItemText(1, QtGui.QApplication.translate("BibleImportDialog", "KJV", None, QtGui.QApplication.UnicodeUTF8))
self.ProxyGroupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Proxy Settings (Optional)", None, QtGui.QApplication.UnicodeUTF8))
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.groupBox.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Licence Details", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("BibleImportDialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("BibleImportDialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("BibleImportDialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_2.setTitle(QtGui.QApplication.translate("BibleImportDialog", "Progress", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
"""
Module implementing BibleImportDialog.
"""
import sys
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from PyQt4.QtCore import pyqtSignature
from bibleimportdialog import Ui_BibleImportDialog
class BibleImportForm(QDialog, Ui_BibleImportDialog):
"""
Class documentation goes here.
"""
def __init__(self, biblemanager = None, parent = None):
"""
Constructor
"""
QDialog.__init__(self, parent)
self.setupUi(self)
self.biblemanager = biblemanager
@pyqtSignature("")
def on_VersesFileButton_clicked(self):
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home')
self.VerseLocationEdit.setText(filename)
@pyqtSignature("")
def on_BooksFileButton_clicked(self):
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home')
self.BooksLocationEdit.setText(filename)
@pyqtSignature("")
def on_OsisFileButton_clicked(self):
filename = QtGui.QFileDialog.getOpenFileName(self, 'Open file','/home')
self.OSISLocationEdit.setText(filename)
class runner(QtGui.QApplication):
def run(self):
values = ["Genesis","Matthew","Revelation"]
self.bim = BibleImportForm()
self.bim.show()
self.processEvents()
sys.exit(app.exec_())
if __name__ == '__main__':
app = runner(sys.argv)
app.run()